Class: Railman::CLI

Inherits:
Thor
  • Object
show all
Includes:
Creategem::Git, Thor::Actions
Defined in:
lib/railman/cli.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_nameObject

Returns the value of attribute app_name.



13
14
15
# File 'lib/railman/cli.rb', line 13

def app_name
  @app_name
end

Class Method Details

.source_rootObject

this is where the thor generator templates are found



16
17
18
# File 'lib/railman/cli.rb', line 16

def self.source_root
  File.expand_path('../../../templates', __FILE__)
end

Instance Method Details

#new(app_name) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/railman/cli.rb', line 23

def new(app_name)
  say "Create a new rails application named: #{app_name}", :green
  config = create_config(app_name)
  apply_rails_template(config)
  say "The rails application '#{app_name}' was successfully created.", :green
  say "Please check the settings in .env and run 'rake db:create' to create the local databases.", :blue
end

#upgrade(app_name) ⇒ Object



32
33
34
35
36
37
# File 'lib/railman/cli.rb', line 32

def upgrade(app_name)
  puts "Upgrade the rails application: #{app_name}"
  config = load_config(app_name)
  apply_rails_template(config, false)
  say "The rails application '#{app_name}' was successfully upgraded.", :green
end