class Altria::Command

Public Class Methods

call(*args) click to toggle source
# File lib/altria/command.rb, line 16
def self.call(*args)
  new(*args).call
end
new(argv) click to toggle source
# File lib/altria/command.rb, line 20
def initialize(argv)
  @argv = argv
end

Public Instance Methods

call() click to toggle source
# File lib/altria/command.rb, line 24
def call
  case name
  when "setup"
    setup
  when "start"
    start
  else
    puts "Usage: altria {setup|start}"
  end
end

Private Instance Methods

env() click to toggle source
# File lib/altria/command.rb, line 57
def env
  { "WORKSPACE_PATH" => workspace_path }
end
name() click to toggle source
# File lib/altria/command.rb, line 37
def name
  @argv[0]
end
root_path() click to toggle source
# File lib/altria/command.rb, line 49
def root_path
  File.expand_path("../../..", __FILE__)
end
setup() click to toggle source
# File lib/altria/command.rb, line 41
def setup
  system(env, "cd #{root_path} && bundle install && bundle exec rake db:create db:migrate")
end
start() click to toggle source
# File lib/altria/command.rb, line 45
def start
  system(env, "cd #{root_path} && bundle exec foreman start")
end
workspace_path() click to toggle source
# File lib/altria/command.rb, line 53
def workspace_path
  Dir.pwd
end