Class: ORS::Commands::Runner
- Inherits:
-
Base
- Object
- Base
- ORS::Commands::Runner
show all
- Defined in:
- lib/ors/commands/runner.rb
Instance Method Summary
collapse
Methods inherited from Base
#help, #help_options
#run, #run_without_setup
Methods included from Helpers
#build_command, #execute_command, #execute_in_parallel, #fatal, #info
#bundle_install, #restart_server, #run_migrations, #setup_repo, #setup_ruby, #start_server, #stop_server, #update_code
#prepare_environment, #prepare_environment_with_rvm, #prepare_initial_environment
#parse_remote_and_or_branch
Instance Method Details
#description ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/ors/commands/runner.rb', line 28
def description
<<-END
Runs rails runner returning the result on STDOUT.
The ruby code will be transmitted within several nested quotes: '"\"ruby code here\""'
Keep that in mind if you need to use quotes.
END
end
|
#execute ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/ors/commands/runner.rb', line 8
def execute
fatal "ERROR: Missing 'ruby code'." if @code.nil?
results = execute_command(ORS.config[:console_server],
prepare_environment,
%(if [ -f script/rails ]; then bundle exec rails runner -e #{ORS.config[:environment]} \\"#{@code}\\"; else ./script/runner -e #{ORS.config[:environment]} \\"#{@code}\\"; fi),
:capture => true, :quiet_ssh => true)
results.sub!(/\AUsing BufferedLogger due to exception: .*?\n/, '')
puts results
end
|
#setup ⇒ Object
4
5
6
|
# File 'lib/ors/commands/runner.rb', line 4
def setup
@code = ORS.config[:args].shift
end
|
#usage ⇒ Object
24
25
26
|
# File 'lib/ors/commands/runner.rb', line 24
def usage
"./ors runner 'ruby code here' [options]"
end
|