class Rake::Ant::BlockTarget
Public Class Methods
new(ant, *options, &block)
click to toggle source
Calls superclass method
# File lib/rake/ant/target.rb, line 35 def initialize(ant, *options, &block) super() set_project ant.project hash = extract_options(options) hash.each_pair {|k,v| send("set_#{k}", v) } @ant, @block = ant, block end
Public Instance Methods
defined_tasks()
click to toggle source
# File lib/rake/ant/target.rb, line 56 def defined_tasks define_target.tasks end
execute()
click to toggle source
# File lib/rake/ant/target.rb, line 43 def execute # Have to dupe this logic b/c Ant doesn't provide a way to # override inner part of execute if_cond, unless_cond = if_condition, unless_condition if if_cond && unless_cond execute_target elsif !if_cond project.log(self, "Skipped because property '#{if_cond}' not set.", Project::MSG_VERBOSE) else project.log(self, "Skipped because property '#{unless_cond}' set.", Project::MSG_VERBOSE) end end
Private Instance Methods
define_target()
click to toggle source
# File lib/rake/ant/target.rb, line 86 def define_target Target.new.tap do |t| t.name = "" begin @ant.current_target = t execute_target ensure @ant.current_target = nil end end end
execute_target()
click to toggle source
# File lib/rake/ant/target.rb, line 82 def execute_target @ant.instance_eval(&@block) if @block end
extract_options(options)
click to toggle source
# File lib/rake/ant/target.rb, line 61 def extract_options(options) hash = Hash === options.last ? options.pop : {} hash[:name] = options[0].to_s if options[0] hash[:description] = options[1].to_s if options[1] hash end
if_condition()
click to toggle source
# File lib/rake/ant/target.rb, line 68 def if_condition cond = get_if return true unless cond val = project.replace_properties(cond) project.get_property(val) && val end
unless_condition()
click to toggle source
# File lib/rake/ant/target.rb, line 75 def unless_condition cond = get_unless return true unless cond val = project.replace_properties(cond) project.get_property(val).nil? && val end