Method: Xing::CLI::Generators::NewProject#generate

Defined in:
lib/xing/cli/generators/new_project.rb

#generateObject

For the moment, this is the simplest thing that can work. Zero templating is done so the project will still have the default module names etc.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/xing/cli/generators/new_project.rb', line 22

def generate

  user_input.gather

  command = cmd('cp', '-a', File.expand_path('../../../../../default_configuration/base_app/', __FILE__), target_name)
  result = shell.run(command)

  unless result.succeeded?
    raise "Attempt to copy base application to #{target_name} failed!"
  end

  write_ruby_version
  write_ruby_version "frontend"
  write_ruby_version "backend"

  if with_gemset
    write_ruby_gemset
    write_ruby_gemset "frontend"
    write_ruby_gemset "backend"
  end

  database_yml_templater.template
  secrets_yml_templater.template
  control_files_templater.template
  doc_files_templater.template
  code_of_conduct_templater.template

  Bundler.with_clean_env do
    if with_gemset
      bundler = shell.run(setup_env_command &
        cmd("cd", target_name) &
        cmd("gem", "install", "bundler"))
    end

    shell.run(
      setup_env_command &
              cmd("cd", target_name) &
              cmd("bundle", "install")).must_succeed!

    shell.run(
      setup_env_command &
      cmd("cd", File.join(target_name, "frontend")) &
              cmd("bundle", "install") &
              cmd("npm", "install")).must_succeed!

    shell.run(
      setup_env_command &
      cmd("cd", File.join(target_name, "backend")) &
              cmd("bundle", "install") &
              cmd("rake", "xing:install:migrations")).must_succeed!
  end

end