Class: Albacore::NugetsPack::ProjectTask

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/albacore/task_types/nugets_pack.rb

Overview

a task that handles the generation of nugets from projects or nuspecs.

Instance Method Summary collapse

Methods included from Logging

#debug, #err, #error, #fatal, #info, #puts, #trace, #warn

Constructor Details

#initialize(opts, &before_execute) ⇒ ProjectTask

Returns a new instance of ProjectTask.

Raises:

  • (ArgumentError)


215
216
217
218
219
220
221
# File 'lib/albacore/task_types/nugets_pack.rb', line 215

def initialize opts, &before_execute
  raise ArgumentError, 'opts is not a map' unless opts.is_a? Map
  raise ArgumentError, 'no files given' unless opts.get(:files).length > 0
  @opts           = opts.apply :out => '.'
  @files          = opts.get :files
  @before_execute = before_execute
end

Instance Method Details

#executeObject



223
224
225
226
227
228
229
# File 'lib/albacore/task_types/nugets_pack.rb', line 223

def execute
  knowns = compute_knowns
  @files.each do |p|
    proj, n, ns = generate_nuspec p, knowns
    execute_inner! proj, n, ns
  end
end

#generate_nuspecsObject

generate all nuspecs



236
237
238
239
240
241
242
243
244
# File 'lib/albacore/task_types/nugets_pack.rb', line 236

def generate_nuspecs
  nuspecs = {}
  knowns = compute_knowns
  @files.each do |p|
    proj, n, ns = generate_nuspec p, knowns
    nuspecs[proj.name] = OpenStruct.new({:proj => proj, :nuspec => n, :nuspec_symbols => ns })
  end
  nuspecs
end

#path_to(relative_file_path, cwd) ⇒ Object



231
232
233
# File 'lib/albacore/task_types/nugets_pack.rb', line 231

def path_to relative_file_path, cwd
  File.expand_path( File.join(@opts.get(:original_path), relative_file_path), cwd )
end