Sha256: 8dcecad30543119eda09acce60e3049a6d8668e6bb45ade3eb6476ed33c5ea49

Contents?: true

Size: 932 Bytes

Versions: 4

Compression:

Stored size: 932 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

4 entries across 4 versions & 1 rubygems

Version Path
albacore-0.2.5 lib/albacore/nant.rb
albacore-0.2.4 lib/albacore/nant.rb
albacore-0.2.3 lib/albacore/nant.rb
albacore-0.2.2 lib/albacore/nant.rb