Sha256: c3fb5a382f0ef391860e7930ac1ef44d55855beb4fd65cf416b74c6d7023137c

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

require 'albacore/albacoremodel'
require 'albacore/config/nantconfig'

class NAnt 
  include AlbacoreModel
  include RunCommand
  include Configuration::NAnt
  
  attr_accessor :build_file
  attr_array :targets
  attr_hash :properties
  
  def initialize
    super()
    update_attributes nant.to_hash
  end
  
  def run
    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

1 entries across 1 versions & 1 rubygems

Version Path
albacore-0.2.0.preview1 lib/albacore/nant.rb