Class: AuxiliaryRails::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/auxiliary_rails/cli.rb

Constant Summary collapse

TEMPLATES_DIR =
File.expand_path("#{__dir__}/../../templates/")
REPOSITORY_URL =
'https://raw.githubusercontent.com/ergoserv/' \
'auxiliary_rails/develop/templates'
.freeze

Instance Method Summary collapse

Instance Method Details

#new(app_path) ⇒ Object



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

def new(app_path)
  run "rails new #{app_path} " \
    "--database=#{options[:database]} " \
    "--template=#{rails_template_path(options[:template])} " \
    '--skip-action-cable ' \
    '--skip-coffee ' \
    '--skip-test '
end

#rails_template_path(template) ⇒ Object (private)



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

def rails_template_path(template)
  if options[:develop] == true
    "#{REPOSITORY_URL}/rails/#{template}.rb"
  else
    "#{TEMPLATES_DIR}/rails/#{template}.rb"
  end
end