Beispiel #1
0
 private Templater createTemplater(String path) {
   Templater templater =
       new Templater(
           path,
           fs().join(
                   Context.instance().limelightHome,
                   "ruby",
                   "lib",
                   "limelight",
                   "templates",
                   "sources"));
   if (logger != null) templater.setLogger(logger);
   templater.setFs(fs());
   return templater;
 }
Beispiel #2
0
  private void createProject(Map<String, String> args) {
    final String projectPath = args.get("path");
    String testsPath = fs().join(projectPath, getArgOrDefault(args, "test-path", "spec"));
    String sceneName = getArgOrDefault(args, "scene-name", "default_scene");

    String projectName = fs().filename(projectPath);
    Templater templater = createTemplater(fs().parentPath(projectPath));

    templater.addToken("LLP_NAME", projectName);

    templater.file(
        fs().join(projectName, "features/step_definitions/limelight_steps.rb"),
        "features/step_definitions/limelight_steps.rb.template");
    templater.file(
        fs().join(projectName, "features/support/env.rb"), "features/support/env.rb.template");
    templater.file(fs().join(projectName, "Rakefile"), "project/Rakefile.template");

    createProduction(
        templater, fs().join(projectName, "production"), projectName, sceneName, testsPath);
  }
Beispiel #3
0
  private void createScene(Templater templater, String scenePath, String testsPath) {
    final String sceneName = fs().filename(scenePath);
    templater.addToken("SCENE_NAME", sceneName);
    templater.addToken("SCENE_TITLE", StringUtil.titleCase(sceneName));

    templater.file(fs().join(scenePath, "props.rb"), "scene/props.rb.template");
    templater.file(fs().join(scenePath, "styles.rb"), "scene/styles.rb.template");
    templater.directory(fs().join(scenePath, "players"));
    templater.file(
        fs().join(testsPath, sceneName, sceneName + "_spec.rb"),
        "scene_spec/scene_spec.rb.template");
  }
Beispiel #4
0
  private void createProduction(
      Templater templater,
      String productionPath,
      String productionName,
      String sceneName,
      String testsPath) {
    templater.addToken("DEFAULT_SCENE_NAME", sceneName);
    templater.addToken("PRODUCTION_NAME", StringUtil.titleCase(productionName));
    templater.addToken("CURRENT_VERSION", About.version.toString());

    templater.file(fs().join(productionPath, "production.rb"), "production/production.rb.template");
    templater.file(fs().join(productionPath, "stages.rb"), "production/stages.rb.template");
    templater.file(fs().join(productionPath, "styles.rb"), "production/styles.rb.template");
    templater.file(
        fs().join(testsPath, "spec_helper.rb"), "production/spec/spec_helper.rb.template");

    createScene(templater, fs().join(productionPath, sceneName), testsPath);
  }