Class: Garlic::Target::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/garlic/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ Runner

Returns a new instance of Runner.



99
100
101
# File 'lib/garlic/target.rb', line 99

def initialize(target)
  @target = target
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



109
110
111
# File 'lib/garlic/target.rb', line 109

def method_missing(method, *args, &block)
  target.garlic.send(method, *args, &block)
end

Instance Attribute Details

#targetObject (readonly)

Returns the value of attribute target.



97
98
99
# File 'lib/garlic/target.rb', line 97

def target
  @target
end

Instance Method Details

#dependency(repo, dest, options = {}, &block) ⇒ Object



121
122
123
# File 'lib/garlic/target.rb', line 121

def dependency(repo, dest, options = {}, &block)
  target.send(:install_dependency, repo, dest, options, &block)
end

#plugin(plugin, options = {}, &block) ⇒ Object



117
118
119
# File 'lib/garlic/target.rb', line 117

def plugin(plugin, options = {}, &block)
  target.send(:install_dependency, plugin, "vendor/plugins/#{options[:as] || plugin}", options, &block)
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/garlic/target.rb', line 113

def respond_to?(method)
  super(method) || target.garlic.respond_to?(method)
end

#run(&block) ⇒ Object



103
104
105
106
107
# File 'lib/garlic/target.rb', line 103

def run(&block)
  cd target.path do
    instance_eval(&block)
  end
end