Sha256: b77d738fb39e011b6cbca0ac728d1e2812cad7d69d2363b71a64cc55e3f1e68c

Contents?: true

Size: 894 Bytes

Versions: 11

Compression:

Stored size: 894 Bytes

Contents

require 'albacore/albacoretask'

class NAnt 
  include Albacore::Task
  include Albacore::RunCommand
  
  attr_accessor :build_file
  attr_array :targets
  attr_hash :properties
  
  def initialize
    super()
    update_attributes Albacore.configuration.nant.to_hash
  end
  
  def execute
    command_parameters = []
    command_parameters << "-buildfile:#{@build_file}" unless @build_file.nil?
    command_parameters << "#{build_properties}" unless @properties.nil?
    command_parameters << "#{build_targets}" unless @targets.nil?
    
    result = run_command "NAnt", command_parameters.join(" ")
    
    failure_msg = 'NAnt task Failed. See Build Log For Detail.'
    fail_with_message failure_msg if !result
  end
  
  private 
  
  def build_targets
    @targets.join " "
  end
  
  def build_properties
     @properties.map {|key, value| "-D:#{key}=#{value}" }.join(" ")
  end
  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
albacore-0.3.6 lib/albacore/nant.rb
albacore-1.0.0.rc.2 lib/albacore/nant.rb
albacore-1.0.0.rc.1 lib/albacore/nant.rb
albacore-0.3.5 lib/albacore/nant.rb
albacore-0.3.4 lib/albacore/nant.rb
albacore-0.3.3 lib/albacore/nant.rb
albacore-0.3.2 lib/albacore/nant.rb
albacore-0.3.1 lib/albacore/nant.rb
albacore-0.3.0 lib/albacore/nant.rb
albacore-0.2.7 lib/albacore/nant.rb
albacore-0.2.6 lib/albacore/nant.rb