Class: Naf::ApplicationType
- Defined in:
- app/models/naf/application_type.rb
Constant Summary collapse
- SCRIPT_RUNNER =
"#{Gem.ruby} #{Rails.root}/script/rails runner"
Class Method Summary collapse
Instance Method Summary collapse
- #bash_command_invocator(job) ⇒ Object
- #bash_script_invocator(job) ⇒ Object
- #invoke(job, command) ⇒ Object
- #rails_invocator(job) ⇒ Object
- #ruby_script_invocator(job) ⇒ Object
-
#spawn(job) ⇒ Object
————————- *** Instance Methods *** +++++++++++++++++++++++++.
Methods inherited from NafBase
Class Method Details
.bash_command ⇒ Object
63 64 65 |
# File 'app/models/naf/application_type.rb', line 63 def self.bash_command @bash_command ||= find_by_script_type_name('bash command') end |
.bash_script ⇒ Object
67 68 69 |
# File 'app/models/naf/application_type.rb', line 67 def self.bash_script @bash_script ||= find_by_script_type_name('bash script') end |
.rails ⇒ Object
55 56 57 |
# File 'app/models/naf/application_type.rb', line 55 def self.rails @rails ||= find_by_script_type_name('rails') end |
.ruby ⇒ Object
59 60 61 |
# File 'app/models/naf/application_type.rb', line 59 def self.ruby @ruby ||= find_by_script_type_name('ruby') end |
Instance Method Details
#bash_command_invocator(job) ⇒ Object
43 44 45 |
# File 'app/models/naf/application_type.rb', line 43 def bash_command_invocator(job) invoke(job, job.command) end |
#bash_script_invocator(job) ⇒ Object
47 48 49 |
# File 'app/models/naf/application_type.rb', line 47 def bash_script_invocator(job) invoke(job, job.command) end |
#invoke(job, command) ⇒ Object
35 36 37 |
# File 'app/models/naf/application_type.rb', line 35 def invoke(job, command) Process.spawn({ "NAF_JOB_ID" => job.id.to_s }, command) end |
#rails_invocator(job) ⇒ Object
39 40 41 |
# File 'app/models/naf/application_type.rb', line 39 def rails_invocator(job) invoke(job, SCRIPT_RUNNER + " " + job.command) end |
#ruby_script_invocator(job) ⇒ Object
51 52 53 |
# File 'app/models/naf/application_type.rb', line 51 def ruby_script_invocator(job) invoke(job, job.command) end |
#spawn(job) ⇒ Object
*** Instance Methods *** +++++++++++++++++++++++++
31 32 33 |
# File 'app/models/naf/application_type.rb', line 31 def spawn(job) self.send(invocation_method.to_sym, job) end |