Class: ORS::Commands::Runner
Constant Summary
Constants included from ORS::Config
Instance Method Summary collapse
Methods inherited from Base
Methods included from Base::ClassMethods
Methods included from Helpers
#build_command, #bundle_install, #execute_command, #execute_in_parallel, #fatal, #info, #prepare_environment, #restart_server, #run_migrations, #setup_repo, #setup_ruby, #start_server, #stop_server, #update_code
Methods included from ORS::Config
#all_servers, #deploy_directory, #revision, #ruby_servers
Methods included from ORS::Config::ModuleMethods
#git, #parse_config_file, #parse_options, #valid_environments, #valid_options?
Instance Method Details
#execute ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ors/commands/runner.rb', line 3 def execute begin code = ORS::Config.[ ORS::Config..index{|e| e =~ /^(-c|--code)$/} + 1 ] raise if code.strip.empty? rescue fatal "ERROR: Missing option --code 'ruby code'." end results = execute_command console_server, prepare_environment, %(if [ -f script/rails ]; then bundle exec rails runner -e #{environment} \\"#{code}\\"; else ./script/runner -e #{environment} \\"#{code}\\"; fi), :capture => true, :quiet_ssh => true results.sub!(/\AUsing BufferedLogger due to exception: .*?\n/, '') # The central_logger gem spits this out without any way of shutting it up puts results end |
#help ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ors/commands/runner.rb', line 17 def help puts "Usage: ./ors runner [environment=production] --code \"ruby code here\" [options]\n\n=== Description\nRuns rails runner returning the result on STDOUT.\nThe ruby code will be transmitted within several nested quotes: '\"\\\"ruby code here\\\"\"'\nKeep that in mind if you need to use quotes.\n\n=== Options\n--code (or -c) The code to run.\n--pretend (or -p) Don't execute anything, just show me what you're going to do\n--no-gateway (or -ng) Don't use a gateway (if you're inside the firewall)\n END\nend\n" |