Sha256: 3576b3b44b701890d71766d196632a42246fe15f356874329e66a299c169ac5f

Contents?: true

Size: 1.47 KB

Versions: 6

Compression:

Stored size: 1.47 KB

Contents

require 'albacore/albacoretask'
require 'albacore/support/supportlinux'

class NuGetInstall
	include Albacore::Task
 	include Albacore::RunCommand
 	include SupportsLinuxEnvironment

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

	attr_array :sources

	def initialize(command='NuGet.exe')
		super()
		@sources = []
		@command = command
		@no_cache = false
		@prerelease = false
		@exclude_version = false
	end

	def execute
		params = generate_params

		@logger.debug "Build NuGet Install Command Line: #{params}"
		result = run_command "NuGet", params

		failure_message = "Nuget Install for package #{@package} failed. See Build log for details."
		fail_with_message failure_message unless result
	end

	def generate_params
		fail_with_message 'A NuGet package must be specified.' unless @package

		params = []
		params << 'install'
		params << package
		params << "-Version #{version}" if @version
		params << "-OutputDirectory #{output_directory}" if @output_directory
		params << "-ExcludeVersion" if @exclude_version
		params << "-NoCache" if @no_cache
		params << "-Prerelease" if @prerelease
		params << "-Source #{build_package_sources}" if @sources unless @sources.empty?

		merged_params = params.join(' ')
	end

	def build_package_sources
		"\"#{@sources.join(';')}\""
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
albacore-0.3.6 lib/albacore/nugetinstall.rb
albacore-1.0.0.rc.2 lib/albacore/nugetinstall.rb
albacore-1.0.0.rc.1 lib/albacore/nugetinstall.rb
albacore-0.3.5 lib/albacore/nugetinstall.rb
albacore-0.3.4 lib/albacore/nugetinstall.rb
albacore-0.3.3 lib/albacore/nugetinstall.rb