Class: ElasticWhenever::Task
- Inherits:
-
Object
- Object
- ElasticWhenever::Task
- Defined in:
- lib/elastic_whenever/task.rb,
lib/elastic_whenever/task/role.rb,
lib/elastic_whenever/task/rule.rb,
lib/elastic_whenever/task/target.rb,
lib/elastic_whenever/task/cluster.rb,
lib/elastic_whenever/task/definition.rb
Defined Under Namespace
Classes: Cluster, Definition, Role, Rule, Target
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#frequency ⇒ Object
readonly
Returns the value of attribute frequency.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #command(task) ⇒ Object
-
#initialize(environment, bundle_command, frequency, options = {}) ⇒ Task
constructor
A new instance of Task.
- #method_missing(name, *args) ⇒ Object
- #rake(task) ⇒ Object
- #runner(src) ⇒ Object
- #script(script) ⇒ Object
Constructor Details
#initialize(environment, bundle_command, frequency, options = {}) ⇒ Task
Returns a new instance of Task.
7 8 9 10 11 12 13 |
# File 'lib/elastic_whenever/task.rb', line 7 def initialize(environment, bundle_command, frequency, = {}) @environment = environment @bundle_command = bundle_command.split(" ") @frequency = frequency = @commands = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
31 32 33 |
# File 'lib/elastic_whenever/task.rb', line 31 def method_missing(name, *args) Logger.instance.warn("Skipping unsupported method: #{name}") end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
3 4 5 |
# File 'lib/elastic_whenever/task.rb', line 3 def commands @commands end |
#frequency ⇒ Object (readonly)
Returns the value of attribute frequency.
4 5 6 |
# File 'lib/elastic_whenever/task.rb', line 4 def frequency @frequency end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/elastic_whenever/task.rb', line 5 def end |
Instance Method Details
#command(task) ⇒ Object
15 16 17 |
# File 'lib/elastic_whenever/task.rb', line 15 def command(task) @commands << task.split(" ") end |
#rake(task) ⇒ Object
19 20 21 |
# File 'lib/elastic_whenever/task.rb', line 19 def rake(task) @commands << [@bundle_command, "rake", task, "--silent"].flatten end |
#runner(src) ⇒ Object
23 24 25 |
# File 'lib/elastic_whenever/task.rb', line 23 def runner(src) @commands << [@bundle_command, "bin/rails", "runner", "-e", @environment, src].flatten end |
#script(script) ⇒ Object
27 28 29 |
# File 'lib/elastic_whenever/task.rb', line 27 def script(script) @commands << [@bundle_command, "script/#{script}"].flatten end |