Class: NuGetPublish

Inherits:
Object
  • Object
show all
Includes:
Albacore::RunCommand, Albacore::Task, Configuration::NuGetPublish, SupportsLinuxEnvironment
Defined in:
lib/albacore/nugetpublish.rb

Instance Attribute Summary collapse

Attributes included from SupportsLinuxEnvironment

#is_linux

Attributes included from Albacore::RunCommand

#working_directory

Attributes included from Logging

#current_log_device, #logger

Instance Method Summary collapse

Methods included from SupportsLinuxEnvironment

#format_path, #format_reference, #to_OS_format

Methods included from Configuration::NuGetPublish

#nugetpublish, nugetpublishconfig

Methods included from Albacore::Configuration

included

Methods included from Albacore::RunCommand

#get_command, #run_command

Methods included from AttrMethods

#attr_array, #attr_hash

Methods included from Albacore::Task

clean_dirname, create_rake_task, include_config, included

Methods included from UpdateAttributes

#<<, #update_attributes

Methods included from YAMLConfig

#configure, #load_config_by_task_name

Methods included from Logging

#create_logger, #log_device=, #log_level, #log_level=

Methods included from Failure

#fail_with_message

Constructor Details

#initialize(command = "NuGet.exe") ⇒ NuGetPublish

users might have put the NuGet.exe in path



17
18
19
20
21
# File 'lib/albacore/nugetpublish.rb', line 17

def initialize(command = "NuGet.exe") # users might have put the NuGet.exe in path
  super()
  update_attributes nugetpublish.to_hash
  @command = command
end

Instance Attribute Details

#apikeyObject

Package Id



11
12
13
# File 'lib/albacore/nugetpublish.rb', line 11

def apikey
  @apikey
end

#commandObject

Package Id



11
12
13
# File 'lib/albacore/nugetpublish.rb', line 11

def command
  @command
end

#idObject

Package Id



11
12
13
# File 'lib/albacore/nugetpublish.rb', line 11

def id
  @id
end

#sourceObject

Package Id



11
12
13
# File 'lib/albacore/nugetpublish.rb', line 11

def source
  @source
end

#versionObject

Package Id



11
12
13
# File 'lib/albacore/nugetpublish.rb', line 11

def version
  @version
end

Instance Method Details

#executeObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/albacore/nugetpublish.rb', line 23

def execute

  fail_with_message 'id must be specified.' if @id.nil?
  fail_with_message 'version must be specified.' if @version.nil?
  # don't validate @apikey as required, coz it might have been set in the config file using 'SetApiKey'
  
  puts @create_only
  params = []
  params << "publish"
  params << "#{@id}"
  params << "#{@version}"
  params << "#{@apikey}" if @apikey
  params << "-Source #{source}" unless @source.nil?
  
  merged_params = params.join(' ')
  
  @logger.debug "Build NuGet publish Command Line: #{merged_params}"

  result = run_command "NuGet", merged_params
  
  failure_message = 'NuGet Publish Failed. See Build Log For Details'
  fail_with_message failure_message if !result
end