Class: ORS::Commands::Setup

Inherits:
Base
  • Object
show all
Defined in:
lib/ors/commands/setup.rb

Instance Method Summary collapse

Methods inherited from Base

#description, #help, #help_options, #setup, #usage

Methods included from Base::ClassMethods

#run, #run_without_setup

Methods included from Helpers

#build_command, #execute_command, #execute_in_parallel, #fatal, #info

Methods included from Helpers::CommandHelpers

#bundle_install, #restart_server, #run_migrations, #setup_repo, #setup_ruby, #start_server, #stop_server, #update_code

Methods included from Helpers::PrepareHelpers

#prepare_environment, #prepare_environment_with_rvm, #prepare_initial_environment

Methods included from Helpers::ParseHelpers

#parse_remote_and_or_branch

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ors/commands/setup.rb', line 5

def execute
  info "setting up #{ORS.config[:name]} #{ORS.config[:environment]}..."

  info "Are you sure? ('yes' + ctrl+D^2)"
  if ORS.config[:pretending] || STDIN.read == "yes"
    execute_in_parallel(ORS.config[:all_servers]) {|server| setup_repo server }

    Ruby.run_without_setup

    execute_command(ORS.config[:migration_server],
                    prepare_environment,
                    %(RAILS_ENV=#{environment} bundle exec rake db:create))
  else
    info "Setup aborted."
  end
end