Module: RailsPlan

Defined in:
lib/rails_plan.rb,
lib/rails_plan/version.rb,
lib/rails_plan/rails_app.rb,
lib/rails_plan/gem_version.rb,
lib/rails_plan/cli/processor.rb,
lib/rails_plan/cli/fetch_branch.rb,
lib/rails_plan/cli/fetch_template.rb

Defined Under Namespace

Modules: Cli Classes: GemVersion, RailsApp

Constant Summary collapse

RailsNotInstalled =
Class.new(StandardError)
VERSION =
'0.0.5'
RAILS_VERSION =
'7.1.3.3'

Class Method Summary collapse

Class Method Details

.apply(template) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/rails_plan.rb', line 41

def apply(template)
  puts template['title']
  run_commands(template['before_commands'])
  generate_files(template['files'])
  prepend_to_file(template['prepend_code'])
  run_commands(template['after_commands'])
end

.start(template) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rails_plan.rb', line 19

def start(template)
  ::RailsPlan::GemVersion.validate!

  # verify_rails_installation
  
  generate_project(template)
  generate_files(template['files'])
  run_commands(template['before_commands'])
  clone_files(template['clones'])
  inject_code(template['inject_code'])
  append_code(template['append_code'])
  update_files(template['gsub'])

  template['steps'].each do |step|
    puts step['title'] if step['title']
    run_commands(step['before_commands'])
    generate_files(step['files'])
    prepend_to_file(step['prepend_code'])
    run_commands(step['after_commands'])
  end
end