Generates a new project.
769695
def generate
      self.destination_root = path

      enable_templates!
      initialize_variables!

      extend Template::Helpers::MARKUP.fetch(@markup)

      unless options.quiet?
        say "Generating #{self.destination_root}", :green
      end

      generate_directories!
      generate_files!
      initialize_scm!
    end
420041
def autogen(project_path):
    """"""
    generate_quickstart(project_path)

    project = StatikProject(project_path)
    project.config = StatikConfig(project.config_file_path)

    models = list(project.load_models().values())

    logger.info('Creating view and template for home page (index.html).')
    generate_yaml_file(os.path.join(project_path, StatikProject.VIEWS_DIR, 'index.yaml'),
                        {   
                            'path': '/',
                            'template': 'index'
                        }
    )
    generate_index_file(os.path.join(project_path, StatikProject.TEMPLATES_DIR, 'index.jinja2'))

    for model in models:
        logger.info('Creating view and template for model: %s' % model.name)
        generate_yaml_file(os.path.join(project_path, StatikProject.VIEWS_DIR, '%s.yaml' % model.name),
                            {   
                                'path': {
                                    'template': '/%s/{{ %s.pk }}' % (model.name, model.name),
                                    'for-each': {
                                        '%s' % model.name: 'session.query(%s).all()' % model.name
                                    }
                                },
                                'template': ('%s' % model.name),
                            }
        )
        generate_model_file(os.path.join(project_path, StatikProject.TEMPLATES_DIR, '%s.jinja2' % model.name),
                            project,
                            model,
                            model.fields.values())
1140529
def create(cls, path_name=None, name=None, project_id=None,
               log_modified_at=None, crawlable=True):
        """"""
        result = cls(path_name, name, project_id, log_modified_at, crawlable)

        db.session.add(result)
        db.session.commit()

        crawl_result(result, True)

        return result
1060588
public void generate() throws IOException {
        final Document doc = DocumentFactory.getInstance().createDocument();
        final Element root = doc.addElement("project");
        //iterate through entities in correct order
        for (final ResourceXMLParser.Entity entity : entities) {
            if (NODE_ENTITY_TAG.equals(entity.getResourceType())) {
                final Element ent = genEntityCommon(root, entity);
                genNode(ent, entity);
            }
        }

        if (null != file) {
            FileOutputStream out=new FileOutputStream(file);
            try{
                serializeDocToStream(out, doc);
            }finally{
                out.close();
            }
        } else if (null != output) {
            serializeDocToStream(output, doc);
        }
    }
12147
def main():
    

    print_head()
    puts("Welcome to the will project generator.")
    puts("")

    if args.config_dist_only:
        print("Generating config.py.dist...")

    else:
        print("\nGenerating will scaffold...")

    current_dir = os.getcwd()
    plugins_dir = os.path.join(current_dir, "plugins")
    templates_dir = os.path.join(current_dir, "templates")

    if not args.config_dist_only:
        print("  /plugins")
        # Set up the directories
        if not os.path.exists(plugins_dir):
            os.makedirs(plugins_dir)

        print("     __init__.py")
        # Create the plugins __init__.py
        with open(os.path.join(plugins_dir, "__init__.py"), 'w+') as f:
            pass

        print("     morning.py")
        # Create the morning plugin
        morning_file_path = os.path.join(plugins_dir, "morning.py")
        if not os.path.exists(morning_file_path):
            with open(morning_file_path, 'w+') as f:
                f.write("""from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings


class MorningPlugin(WillPlugin):

    @respond_to("^good morning")
    def good_morning(self, message):
        self.reply("oh, g'morning!")
""")

        print("  /templates")
        if not os.path.exists(templates_dir):
            os.makedirs(templates_dir)

        print("     blank.html")
        # Create the plugins __init__.py
        with open(os.path.join(templates_dir, "blank.html"), 'w+') as f:
            pass

        print("  .gitignore")
        # Create .gitignore, or at least add shelf.db
        gitignore_path = os.path.join(current_dir, ".gitignore")
        if not os.path.exists(gitignore_path):
            with open(gitignore_path, 'w+') as f:
                f.write("""*.py[cod]
pip-log.txt
shelf.db
        """)
        else:
            append_ignore = False
            with open(gitignore_path, "r+") as f:
                if "shelf.db" not in f.read():
                    append_ignore = True
            if append_ignore:
                with open(gitignore_path, "a") as f:
                    f.write("\nshelf.db\n")

        # Create run_will.py
        print("  run_will.py")
        run_will_path = os.path.join(current_dir, "run_will.py")
        if not os.path.exists(run_will_path):
            with open(run_will_path, 'w+') as f:
                f.write("""#!/usr/bin/env python
from will.main import WillBot

if __name__ == '__main__':
    bot = WillBot()
    bot.bootstrap()
""")
        # And make it executable
        st = os.stat('run_will.py')
        os.chmod("run_will.py", st.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)

    # Create config.py
        print("  config.py.dist")

    config_path = os.path.join(current_dir, "config.py.dist")
    if not os.path.exists(config_path) or ask_user("! config.py.dist exists.  Overwrite it?"):
        with open(os.path.join(PROJECT_ROOT, "config.py.dist"), "r") as source_f:
            source = source_f.read()
            if args.backends:
                for backend in SERVICE_BACKENDS:
                    if backend in args.backends:
                        _enable_service(backend, source)
                    else:
                        __disable_service(backend, source)
            else:
                # Ask user thru cmd line what backends to enable
                print("\nWill supports a few different service backends.  Let's set up the ones you want:\n")
                source = enable_disable_service("Slack", source)
                source = enable_disable_service("HipChat", source)
                source = enable_disable_service("Rocket.Chat", source)
                source = enable_disable_service("Shell", source)

            with open(config_path, "w+") as f:
                config = source
                f.write(config)

    if not args.config_dist_only:
        print("  requirements.txt")
        # Create requirements.txt
        requirements_path = os.path.join(current_dir, "requirements.txt")
        if not os.path.exists(requirements_path) or ask_user("! requirements.txt exists.  Overwrite it?"):
            with open(requirements_path, 'w+') as f:
                f.write(requirements_txt)

        print("  Procfile")
        # Create Procfile
        requirements_path = os.path.join(current_dir, "Procfile")
        if not os.path.exists(requirements_path):
            with open(requirements_path, 'w+') as f:
                f.write("web: python run_will.py")

        print("  README.md")
        # Create the readme
        readme_path = os.path.join(current_dir, "README.md")
        if not os.path.exists(readme_path):
            with open(readme_path, 'w+') as f:
                f.write("""
This is our bot, a [will](https://github.com/skoczen/will) bot.
    """)

        print("\nDone.")

        print("\n Your will is now ready to go. Run ./run_will.py to get started!")
    else:
        print("\nCreated a config.py.dist.  Open it up to see what's new!\n")
198719
function generateProject(config, callback) {
  var dirName = config.siteName;

  if(config.firebase !== 'webhook') {
    dirName = unescapeSite(dirName);
  }

  wrench.copyDirSyncRecursive('.wh-generate/', process.cwd() + '/' + dirName, {
      forceDelete: true
  });

  callback();
}
604036
def create_project(type, schema, server, name, output, verbose):
    
    if verbose:
        log("Entity Matching Server: {}".format(server))

    if schema is not None:
        schema_json = json.load(schema)
        # Validate the schema
        clkhash.schema.validate_schema_dict(schema_json)
    else:
        raise ValueError("Schema must be provided when creating new linkage project")

    name = name if name is not None else ''

    # Creating new project
    try:
        project_creation_reply = project_create(server, schema_json, type, name)
    except ServiceError as e:
        log("Unexpected response - {}".format(e.status_code))
        log(e.text)
        raise SystemExit
    else:
        log("Project created")

    json.dump(project_creation_reply, output)
762437
def new
      @project = Project.new
  
      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @project }
      end
    end
333375
function generateProject(config, callback) {
  var dirName = config.siteName;

  if(config.firebase !== 'webhook') {
    dirName = unescapeSite(dirName);
  }

  wrench.copyDirSyncRecursive('.wh-generate/', process.cwd() + '/' + dirName, {
      forceDelete: true
  });

  var siteDir = process.cwd() + '/' + dirName;

  if(fs.existsSync(siteDir + '/.wh-original')) {
    if(fs.existsSync(siteDir + '/.wh-original/pages')) {
      wrench.rmdirSyncRecursive(siteDir + '/pages');
      wrench.copyDirSyncRecursive(siteDir + '/.wh-original/pages', siteDir + '/pages', {
        forceDelete: true
      })
    }
    if(fs.existsSync(siteDir + '/.wh-original/templates')) {
      wrench.rmdirSyncRecursive(siteDir + '/templates');
      wrench.copyDirSyncRecursive(siteDir + '/.wh-original/templates', siteDir + '/templates', {
        forceDelete: true
      })
    }
    if(fs.existsSync(siteDir + '/.wh-original/static')) {
      wrench.rmdirSyncRecursive(siteDir + '/static');
      wrench.copyDirSyncRecursive(siteDir + '/.wh-original/static', siteDir + '/static', {
        forceDelete: true
      })
    }

    wrench.rmdirSyncRecursive(siteDir + '/.wh-original'); 
  }

  callback();
}
1147444
public function projectSetupNew()
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $this->projectInstance()->setupNewProject();
        $this->executeCommandHook(__FUNCTION__, 'after');
    }
437565
def generate(num, prompt_default=True):
    """"""
    p = Problem(num)

    problem_text = p.text

    msg = "Generate file for problem %i?" % num
    click.confirm(msg, default=prompt_default, abort=True)

    # Allow skipped problem files to be recreated
    if p.glob:
        filename = str(p.file)
        msg = '"{}" already exists. Overwrite?'.format(filename)
        click.confirm(click.style(msg, fg='red'), abort=True)
    else:
        # Try to keep prefix consistent with existing files
        previous_file = Problem(num - 1).file
        prefix = previous_file.prefix if previous_file else ''
        filename = p.filename(prefix=prefix)

    header = 'Project Euler Problem %i' % num
    divider = '=' * len(header)
    text = '\n'.join([header, divider, '', problem_text])
    content = '\n'.join(['"""', text, '"""'])

    with open(filename, 'w') as f:
        f.write(content + '\n\n\n')

    click.secho('Successfully created "{}".'.format(filename), fg='green')

    # Copy over problem resources if required
    if p.resources:
        p.copy_resources()
543021
public function actionGenerate() {
		$versionList = MiscHelper::getAllVersions();
		$versionList = array_combine($versionList, $versionList);
		$selected = Select::display('Select package', $versionList);
		$version = Select::getFirstValue($selected);
		ApiDocHelper::generate($version);
		Output::block('Success generated');
	}
1324663
def create():
    
    # Generate project locale
    locale = env.locale.replace("UTF-8", "utf8")
    with hide("stdout"):
        if locale not in run("locale -a"):
            sudo("locale-gen %s" % env.locale)
            sudo("update-locale %s" % env.locale)
            sudo("service postgresql restart")
            run("exit")

    # Create project path
    run("mkdir -p %s" % env.proj_path)

    # Set up virtual env
    run("mkdir -p %s" % env.venv_home)
    with cd(env.venv_home):
        if exists(env.proj_name):
            if confirm("Virtualenv already exists in host server: %s"
                       "\nWould you like to replace it?" % env.proj_name):
                run("rm -rf %s" % env.proj_name)
            else:
                abort()
        run("virtualenv %s" % env.proj_name)

    # Upload project files
    if env.deploy_tool in env.vcs_tools:
        vcs_upload()
    else:
        rsync_upload()

    # Create DB and DB user
    pw = db_pass()
    user_sql_args = (env.proj_name, pw.replace("'", "\'"))
    user_sql = "CREATE USER %s WITH ENCRYPTED PASSWORD '%s';" % user_sql_args
    psql(user_sql, show=False)
    shadowed = "*" * len(pw)
    print_command(user_sql.replace("'%s'" % pw, "'%s'" % shadowed))
    psql("CREATE DATABASE %s WITH OWNER %s ENCODING = 'UTF8' "
         "LC_CTYPE = '%s' LC_COLLATE = '%s' TEMPLATE template0;" %
         (env.proj_name, env.proj_name, env.locale, env.locale))

    # Set up SSL certificate
    if not env.ssl_disabled:
        conf_path = "/etc/nginx/conf"
        if not exists(conf_path):
            sudo("mkdir %s" % conf_path)
        with cd(conf_path):
            crt_file = env.proj_name + ".crt"
            key_file = env.proj_name + ".key"
            if not exists(crt_file) and not exists(key_file):
                try:
                    crt_local, = glob(join("deploy", "*.crt"))
                    key_local, = glob(join("deploy", "*.key"))
                except ValueError:
                    parts = (crt_file, key_file, env.domains[0])
                    sudo("openssl req -new -x509 -nodes -out %s -keyout %s "
                         "-subj '/CN=%s' -days 3650" % parts)
                else:
                    upload_template(crt_local, crt_file, use_sudo=True)
                    upload_template(key_local, key_file, use_sudo=True)

    # Install project-specific requirements
    upload_template_and_reload("settings")
    with project():
        if env.reqs_path:
            pip("-r %s/%s" % (env.proj_path, env.reqs_path))
        pip("gunicorn setproctitle psycopg2 "
            "django-compressor python-memcached")
    # Bootstrap the DB
        manage("createdb --noinput --nodata")
        python("from django.conf import settings;"
               "from django.contrib.sites.models import Site;"
               "Site.objects.filter(id=settings.SITE_ID).update(domain='%s');"
               % env.domains[0])
        for domain in env.domains:
            python("from django.contrib.sites.models import Site;"
                   "Site.objects.get_or_create(domain='%s');" % domain)
        if env.admin_pass:
            pw = env.admin_pass
            user_py = ("from django.contrib.auth import get_user_model;"
                       "User = get_user_model();"
                       "u, _ = User.objects.get_or_create(username='admin');"
                       "u.is_staff = u.is_superuser = True;"
                       "u.set_password('%s');"
                       "u.save();" % pw)
            python(user_py, show=False)
            shadowed = "*" * len(pw)
            print_command(user_py.replace("'%s'" % pw, "'%s'" % shadowed))

    return True
199899
protected function generate()
    {
        $steps = [
            'Generating module...' => 'generateModule',
            'Optimizing module cache...' => 'optimizeModules',
        ];

        $progress = new ProgressBar($this->output, count($steps));
        $progress->start();

        foreach ($steps as $message => $function) {
            $progress->setMessage($message);

            $this->$function();

            $progress->advance();
        }

        $progress->finish();

        event($this->container['slug'] . '.module.made');

        $this->info("\nModule generated successfully.");
    }
239990
public static Builder newBuilder(String projectId, String datasetId) {
    return newBuilder(DatasetId.of(projectId, datasetId));
  }
696597
def new_project_from_template_options
        input = gets.chomp.strip.downcase
        case
        when input.to_i <= JumpStart.existing_templates.count && input.to_i > 0
          @template_name = JumpStart.existing_templates[(input.to_i - 1)]
          check_project_name
          project = JumpStart::Base.new([@project_name, @template_name])
          project.check_setup
          project.start
        when input == "b"
          jumpstart_menu
        when input == "x"
          exit_normal
        else
          puts "That command hasn't been understood. Try again!".red
          new_project_from_template_options
        end
      end
1329643
def generate(self, blueprint, context, interactive=True):
        """"""
        if not isinstance(blueprint, Blueprint):
            bp = self.blueprints.get(blueprint)
            if not bp:
                raise ValueError('%s is not a valid blueprint' % blueprint)
            blueprint = bp

        self.stdout.write(
            style.format_command(
                'Generating',
                blueprint.full_name
            )
        )
        generator = Generator(
            self,
            blueprint,
            context,
            interactive=interactive
        )
        result = generator.generate()
        if blueprint.name == 'init':
            # try re-setting the name
            self.refresh()
        return result