Sha256: 0a2143ff4c219a2909c650aa6bf37e687d39a31a1eb246bd7217060fc6005260

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

require "albacore/albacoretask"
require "albacore/config/nugetinstallconfig"

class NuGetInstall
  TaskName = :nugetinstall

  include Albacore::Task
  include Albacore::RunCommand
  include Configuration::NuGetInstall

  attr_reader   :no_cache,
                :prerelease,
                :exclude_version
  
  attr_accessor	:package,
                :output_directory,
                :version

	attr_array    :sources

	def initialize()
		@command = "nuget"
    
    super()
    update_attributes(nugetinstall.to_hash)
	end

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

	def build_parameters
		p = []
		p << "install"
		p << @package
		p << "-Version #{@version}" if @version
		p << "-OutputDirectory \"#{@output_directory}\"" if @output_directory
		p << "-ExcludeVersion" if @exclude_version
		p << "-NoCache" if @no_cache
		p << "-Prerelease" if @prerelease
		p << "-Source \"#{@sources.join(";")}\"" if @sources
		p
	end

  def no_cache
    @no_cache = true
  end

  def prerelease
    @prerelease = true
  end
  
  def exclude_version
    @exclude_version = true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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