Class: RelevanceRails::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/relevance_rails/runner.rb

Class Method Summary collapse

Class Method Details

.start(argv = ARGV) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/relevance_rails/runner.rb', line 5

def self.start(argv=ARGV)
  if argv.empty? || (argv[0] == '--help') || (argv[0] == '-h')
    print_help
  elsif argv.delete('--version')
    puts "RelevanceRails #{RelevanceRails::VERSION}"
  elsif argv[0] == 'new'
    add_default_options! argv
    if ENV['rvm_path'].nil? || ENV['NO_RVM']
      exec 'rails', *argv
    else
      app_name = argv[1]
      env = setup_rvm(app_name)

      new_rvm_string = "#{env.environment_name.split('@')[0]}@#{app_name}"
      install_relevance_rails argv, new_rvm_string, env.environment_name
      exec new_rvm_string,'-S','rails', *argv
    end
  end
end