Exemple #1
0
def create_skeleton():
    """Creates module based on a pattern supplied as a git repo.
	"""
    shutit = shutit_global.shutit

    skel_path = shutit.cfg['skeleton']['path']
    skel_module_name = shutit.cfg['skeleton']['module_name']
    skel_domain = shutit.cfg['skeleton']['domain']
    skel_domain_hash = shutit.cfg['skeleton']['domain_hash']
    skel_depends = shutit.cfg['skeleton']['depends']
    skel_shutitfiles = shutit.cfg['skeleton']['shutitfiles']
    skel_delivery = shutit.cfg['skeleton']['delivery']

    # Check setup
    if len(skel_path) == 0 or skel_path[0] != '/':
        shutit.fail('Must supply a directory and it must be absolute')
    if os.path.exists(skel_path):
        shutit.fail(skel_path + ' already exists')
    if len(skel_module_name) == 0:
        shutit.fail('Must supply a name for your module, eg mymodulename')
    if not re.match('^[a-zA-z_][0-9a-zA-Z_]+$', skel_module_name):
        shutit.fail(
            'Module names must comply with python classname standards: cf: http://stackoverflow.com/questions/10120295/valid-characters-in-a-python-class-name'
        )
    if len(skel_domain) == 0:
        shutit.fail(
            'Must supply a domain for your module, eg com.yourname.madeupdomainsuffix'
        )

    # Create folders and process pattern
    os.makedirs(skel_path)
    os.chdir(skel_path)
    if shutit.cfg['skeleton']['pattern'] == 'bash':
        from shutit_patterns import bash
        bash.setup_bash_pattern(skel_path=skel_path,
                                skel_delivery=skel_delivery,
                                skel_domain=skel_domain,
                                skel_module_name=skel_module_name,
                                skel_shutitfiles=skel_shutitfiles,
                                skel_domain_hash=skel_domain_hash,
                                skel_depends=skel_depends)
    elif shutit.cfg['skeleton']['pattern'] == 'docker':
        from shutit_patterns import docker
        docker.setup_docker_pattern(skel_path=skel_path,
                                    skel_delivery=skel_delivery,
                                    skel_domain=skel_domain,
                                    skel_module_name=skel_module_name,
                                    skel_shutitfiles=skel_shutitfiles,
                                    skel_domain_hash=skel_domain_hash,
                                    skel_depends=skel_depends)
    elif shutit.cfg['skeleton']['pattern'] == 'vagrant':
        from shutit_patterns import vagrant
        vagrant.setup_vagrant_pattern(skel_path=skel_path,
                                      skel_delivery=skel_delivery,
                                      skel_domain=skel_domain,
                                      skel_module_name=skel_module_name,
                                      skel_shutitfiles=skel_shutitfiles,
                                      skel_domain_hash=skel_domain_hash,
                                      skel_depends=skel_depends)
    elif shutit.cfg['skeleton']['pattern'] == 'shutitfile':
        from shutit_patterns import shutitfile
        shutitfile.setup_shutitfile_pattern(skel_path=skel_path,
                                            skel_delivery=skel_delivery,
                                            skel_domain=skel_domain,
                                            skel_module_name=skel_module_name,
                                            skel_shutitfiles=skel_shutitfiles,
                                            skel_domain_hash=skel_domain_hash,
                                            skel_depends=skel_depends)
    elif shutit.cfg['skeleton']['pattern'] == 'docker_tutorial':
        shutit.fail('docker_tutorial not yet supported')
Exemple #2
0
def create_skeleton(shutit):
	"""Creates module based on a pattern supplied as a git repo.
	"""
	skel_path        = shutit.cfg['skeleton']['path']
	skel_module_name = shutit.cfg['skeleton']['module_name']
	skel_domain      = shutit.cfg['skeleton']['domain']
	skel_domain_hash = shutit.cfg['skeleton']['domain_hash']
	skel_depends     = shutit.cfg['skeleton']['depends']
	skel_shutitfiles = shutit.cfg['skeleton']['shutitfiles']
	skel_delivery    = shutit.cfg['skeleton']['delivery']
	skel_pattern     = shutit.cfg['skeleton']['pattern']
	# For vagrant only
	skel_vagrant_num_machines   = shutit.cfg['skeleton']['vagrant_num_machines']
	skel_vagrant_machine_prefix = shutit.cfg['skeleton']['vagrant_machine_prefix']
	skel_vagrant_ssh_access     = shutit.cfg['skeleton']['vagrant_ssh_access']
	skel_vagrant_docker         = shutit.cfg['skeleton']['vagrant_docker']
	skel_vagrant_snapshot       = shutit.cfg['skeleton']['vagrant_snapshot']
	skel_vagrant_upload         = shutit.cfg['skeleton']['vagrant_upload']
	skel_vagrant_image_name     = shutit.cfg['skeleton']['vagrant_image_name']

	# Check setup
	if not skel_path or skel_path[0] != '/':
		shutit.fail('Must supply a directory and it must be absolute') # pragma: no cover
	if os.path.exists(skel_path):
		shutit.fail(skel_path + ' already exists') # pragma: no cover
	if not skel_module_name:
		shutit.fail('Must supply a name for your module, eg mymodulename') # pragma: no cover
	if not re.match('^[a-zA-z_][0-9a-zA-Z_]+$', skel_module_name):
		shutit.fail('Module names must comply with python classname standards: cf: http://stackoverflow.com/questions/10120295/valid-characters-in-a-python-class-name name: ' + skel_module_name) # pragma: no cover
	if not skel_domain:
		shutit.fail('Must supply a domain for your module, eg com.yourname.madeupdomainsuffix') # pragma: no cover

	# Create folders and process pattern
	os.makedirs(skel_path)
	os.chdir(skel_path)
	# If it's shutitfile and vagrant
	if shutit.cfg['skeleton']['pattern'] == 'bash':
		from shutit_patterns import bash
		bash.setup_bash_pattern(shutit,
		                        skel_path=skel_path,
		                        skel_delivery=skel_delivery,
		                        skel_domain=skel_domain,
		                        skel_module_name=skel_module_name,
		                        skel_shutitfiles=skel_shutitfiles,
		                        skel_domain_hash=skel_domain_hash,
		                        skel_depends=skel_depends)
	elif shutit.cfg['skeleton']['pattern'] == 'docker':
		from shutit_patterns import docker
		docker.setup_docker_pattern(shutit,
		                            skel_path=skel_path,
		                            skel_delivery=skel_delivery,
		                            skel_domain=skel_domain,
		                            skel_module_name=skel_module_name,
		                            skel_shutitfiles=skel_shutitfiles,
		                            skel_domain_hash=skel_domain_hash,
		                            skel_depends=skel_depends)
	elif shutit.cfg['skeleton']['pattern'] == 'vagrant': # pragma: no cover
		from shutit_patterns import vagrant
		vagrant.setup_vagrant_pattern(shutit,
		                              skel_path=skel_path,
		                              skel_delivery=skel_delivery,
		                              skel_domain=skel_domain,
		                              skel_module_name=skel_module_name,
		                              skel_shutitfiles=skel_shutitfiles,
		                              skel_domain_hash=skel_domain_hash,
		                              skel_depends=skel_depends,
		                              skel_vagrant_num_machines=skel_vagrant_num_machines,
		                              skel_vagrant_machine_prefix=skel_vagrant_machine_prefix,
		                              skel_vagrant_ssh_access=skel_vagrant_ssh_access,
		                              skel_vagrant_docker=skel_vagrant_docker,
		                              skel_vagrant_snapshot=skel_vagrant_snapshot,
		                              skel_vagrant_upload=skel_vagrant_upload,
		                              skel_vagrant_image_name=skel_vagrant_image_name)
	elif shutit.cfg['skeleton']['pattern'] == 'shutitfile':
		shutitfile.setup_shutitfile_pattern(shutit,
		                                    skel_path=skel_path,
		                                    skel_delivery=skel_delivery,
		                                    skel_pattern=skel_pattern,
		                                    skel_domain=skel_domain,
		                                    skel_module_name=skel_module_name,
		                                    skel_vagrant_num_machines=skel_vagrant_num_machines,
		                                    skel_vagrant_machine_prefix=skel_vagrant_machine_prefix,
		                                    skel_vagrant_ssh_access=skel_vagrant_ssh_access,
		                                    skel_vagrant_docker=skel_vagrant_docker)
	elif shutit.cfg['skeleton']['pattern'] == 'docker_tutorial': # pragma: no cover
		shutit.fail('docker_tutorial not yet supported')
Exemple #3
0
def create_skeleton(shutit):
	"""Creates module based on a pattern supplied as a git repo.
	"""
	skel_path        = shutit.cfg['skeleton']['path']
	skel_module_name = shutit.cfg['skeleton']['module_name']
	skel_domain      = shutit.cfg['skeleton']['domain']
	skel_domain_hash = shutit.cfg['skeleton']['domain_hash']
	skel_depends     = shutit.cfg['skeleton']['depends']
	skel_shutitfiles = shutit.cfg['skeleton']['shutitfiles']
	skel_delivery    = shutit.cfg['skeleton']['delivery']
	skel_pattern     = shutit.cfg['skeleton']['pattern']
	# For vagrant only
	skel_vagrant_num_machines   = shutit.cfg['skeleton']['vagrant_num_machines']
	skel_vagrant_machine_prefix = shutit.cfg['skeleton']['vagrant_machine_prefix']
	skel_vagrant_ssh_access     = shutit.cfg['skeleton']['vagrant_ssh_access']
	skel_vagrant_docker         = shutit.cfg['skeleton']['vagrant_docker']
	skel_vagrant_snapshot       = shutit.cfg['skeleton']['vagrant_snapshot']
	skel_vagrant_upload         = shutit.cfg['skeleton']['vagrant_upload']
	skel_vagrant_image_name     = shutit.cfg['skeleton']['vagrant_image_name']

	# Check setup
	if not skel_path or skel_path[0] != '/':
		shutit.fail('Must supply a directory and it must be absolute') # pragma: no cover
	if os.path.exists(skel_path):
		shutit.fail(skel_path + ' already exists') # pragma: no cover
	if not skel_module_name:
		shutit.fail('Must supply a name for your module, eg mymodulename') # pragma: no cover
	if not re.match('^[a-zA-z_][0-9a-zA-Z_]+$', skel_module_name):
		shutit.fail('Module names must comply with python classname standards: cf: http://stackoverflow.com/questions/10120295/valid-characters-in-a-python-class-name name: ' + skel_module_name) # pragma: no cover
	if not skel_domain:
		shutit.fail('Must supply a domain for your module, eg com.yourname.madeupdomainsuffix') # pragma: no cover

	# Create folders and process pattern
	os.makedirs(skel_path)
	os.chdir(skel_path)
	# If it's shutitfile and vagrant
	if shutit.cfg['skeleton']['pattern'] == 'bash':
		from shutit_patterns import bash
		bash.setup_bash_pattern(shutit,
		                        skel_path=skel_path,
		                        skel_delivery=skel_delivery,
		                        skel_domain=skel_domain,
		                        skel_module_name=skel_module_name,
		                        skel_shutitfiles=skel_shutitfiles,
		                        skel_domain_hash=skel_domain_hash,
		                        skel_depends=skel_depends)
	elif shutit.cfg['skeleton']['pattern'] == 'docker':
		from shutit_patterns import docker
		docker.setup_docker_pattern(shutit,
		                            skel_path=skel_path,
		                            skel_delivery=skel_delivery,
		                            skel_domain=skel_domain,
		                            skel_module_name=skel_module_name,
		                            skel_shutitfiles=skel_shutitfiles,
		                            skel_domain_hash=skel_domain_hash,
		                            skel_depends=skel_depends)
	elif shutit.cfg['skeleton']['pattern'] == 'vagrant': # pragma: no cover
		from shutit_patterns import vagrant
		vagrant.setup_vagrant_pattern(shutit,
		                              skel_path=skel_path,
		                              skel_delivery=skel_delivery,
		                              skel_domain=skel_domain,
		                              skel_module_name=skel_module_name,
		                              skel_shutitfiles=skel_shutitfiles,
		                              skel_domain_hash=skel_domain_hash,
		                              skel_depends=skel_depends,
		                              skel_vagrant_num_machines=skel_vagrant_num_machines,
		                              skel_vagrant_machine_prefix=skel_vagrant_machine_prefix,
		                              skel_vagrant_ssh_access=skel_vagrant_ssh_access,
		                              skel_vagrant_docker=skel_vagrant_docker,
		                              skel_vagrant_snapshot=skel_vagrant_snapshot,
		                              skel_vagrant_upload=skel_vagrant_upload,
		                              skel_vagrant_image_name=skel_vagrant_image_name)
	elif shutit.cfg['skeleton']['pattern'] == 'shutitfile':
		shutitfile.setup_shutitfile_pattern(shutit,
		                                    skel_path=skel_path,
		                                    skel_delivery=skel_delivery,
		                                    skel_pattern=skel_pattern,
		                                    skel_domain=skel_domain,
		                                    skel_module_name=skel_module_name,
		                                    skel_vagrant_num_machines=skel_vagrant_num_machines,
		                                    skel_vagrant_machine_prefix=skel_vagrant_machine_prefix,
		                                    skel_vagrant_ssh_access=skel_vagrant_ssh_access,
		                                    skel_vagrant_docker=skel_vagrant_docker)
	elif shutit.cfg['skeleton']['pattern'] == 'docker_tutorial': # pragma: no cover
		shutit.fail('docker_tutorial not yet supported')