Class: Railyard::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/railyard.rb

Instance Method Summary collapse

Instance Method Details

#helpObject



49
50
51
52
# File 'lib/railyard.rb', line 49

def help
  puts "railyard #{Railyard::VERSION}"
  super
end

#new(app_path = nil, *args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/railyard.rb', line 33

def new(app_path = nil, *args)
  if !installed?
    puts "Installing Rails..."
    install
  end

  if app_path && app_path !~ /^--?/
    args.unshift expand_path(app_path)
    args << "--skip-bundle" unless args.include?("--skip-bundle")
  else
    args << "--help"
  end

  rails_new(args)
end

#version(number = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/railyard.rb', line 13

def version(number = nil)
  if number
    message = installed? ? "Changing Rails version..." : "Installing Rails..."

    Gemfile.new(gemfile_path).update_version(number)
    puts message

    success = install
    puts "Rails version #{number} doesn't appear to exist." unless success
  else
    if !installed?
      puts "Installing Rails..."
      install
    end

    sandbox("bundle exec rails --version")
  end
end