Class: NuGetUpdate

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

Instance Attribute Summary collapse

Attributes included from SupportsLinuxEnvironment

#is_linux

Attributes included from Albacore::RunCommand

#command, #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::NuGetUpdate

#nugetupdate, nugetupdateconfig

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") ⇒ NuGetUpdate

users might have put the NuGet.exe in path



18
19
20
21
22
# File 'lib/albacore/nugetupdate.rb', line 18

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

Instance Attribute Details

#input_fileObject

Returns the value of attribute input_file.



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

def input_file
  @input_file
end

#repository_pathObject

Returns the value of attribute repository_path.



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

def repository_path
  @repository_path
end

#safeObject

Returns the value of attribute safe.



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

def safe
  @safe
end

Instance Method Details

#executeObject



24
25
26
27
28
29
30
31
# File 'lib/albacore/nugetupdate.rb', line 24

def execute
  params = get_command_parameters
  
  @logger.debug "Build NuGet Update Command Line: #{params}"
  result = run_command "NuGet", params
  
  fail_with_message 'NuGet Update Failed. See Build Log For Detail' unless result
end

#get_array_parameter(arr) ⇒ Object



47
48
49
# File 'lib/albacore/nugetupdate.rb', line 47

def get_array_parameter(arr)
  "\"#{arr.join(';')}\""
end

#get_command_parametersObject



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/albacore/nugetupdate.rb', line 33

def get_command_parameters
  fail_with_message 'An input file must be specified (packages.config|solution).' if self.input_file.nil?
  
  params = []
  params << "update"
  params << "#{self.input_file}"
  params << "-Source #{get_array_parameter(self.source)}" unless self.source.nil?
  params << "-Id #{get_array_parameter(self.id)}" unless self.id.nil?
  params << "-RepositoryPath #{self.repository_path}" unless self.repository_path.nil?
  params << "-Safe" if self.safe
  
  merged_params = params.join(' ')
end