class Hyrb::Task

Attributes

env[R]
pipeline[R]

Public Class Methods

depends(*args) click to toggle source
# File lib/hyrb/task.rb, line 11
def self.depends(*args)
  Commands::Pipeline.rules.merge!({self => args})
end
new(pipeline) click to toggle source
# File lib/hyrb/task.rb, line 23
def initialize(pipeline)
  @pipeline = pipeline
end
prompt(hash_name, key, options = {}) click to toggle source
# File lib/hyrb/task.rb, line 15
def self.prompt(hash_name, key, options = {})
  self.prompts << [hash_name, key, options]
end
prompts() click to toggle source
# File lib/hyrb/task.rb, line 19
def self.prompts
  @prompts ||= []
end

Public Instance Methods

run(env) click to toggle source

TODO: run task after

# File lib/hyrb/task.rb, line 29
def run(env)
end
run_before(env) click to toggle source
# File lib/hyrb/task.rb, line 32
def run_before(env)
  self.class.prompts.each do |(hash_name, key, options)|
    if options.is_a?(Hash) && options[:default].respond_to?(:call)
      options[:default] = options[:default].call(env)
    end

    prompt "Please enter #{key}", env[hash_name], key, options
  end
end