Sha256: 587d189cf5dee59a753dfce100a03aebb203556756989346b98956236e685284

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

require "albacore/albacoretask"
require "albacore/config/nugetpackconfig"

class NuGetPack
  TaskName = :nugetpack

  include Albacore::Task
  include Albacore::RunCommand
  include Configuration::NuGetPack
  
  attr_reader   :symbols
  
  attr_accessor :nuspec,
                :output_directory,
                :base_path

  attr_hash     :properties

  def initialize()
    @command = "nuget"

    super()
    update_attributes(nugetpack.to_hash)
  end

  def execute  
    unless @nuspec
      fail_with_message("nugetpack requires #nuspec" )
      return
    end
    
    result = run_command("nugetpack", build_parameters)
    fail_with_message("NuGet Pack failed, see the build log for more details.") unless result
  end

  def build_parameters
    p = []
    p << "pack"
    p << "-Symbols" if @symbols
    p << "\"#{@nuspec}\""
    p << "-BasePath \"#{@base_path}\"" if @base_path
    p << "-OutputDirectory \"#{@output_directory}\"" if @output_directory
    p << "-Properties #{@properties.map { |key, value| "#{key}=\"#{value}\"" }.join(";")}" if @properties
    p
  end
  
  def symbols
    @symbols = true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
albacore-1.0.0 lib/albacore/nugetpack.rb
albacore-1.0.0.rc.3 lib/albacore/nugetpack.rb