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)


197
198
199
200
201
202
203
# File 'lib/albacore/task_types/nugets_pack.rb', line 197

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



205
206
207
208
209
210
211
# File 'lib/albacore/task_types/nugets_pack.rb', line 205

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



218
219
220
221
222
223
224
225
226
# File 'lib/albacore/task_types/nugets_pack.rb', line 218

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



213
214
215
# File 'lib/albacore/task_types/nugets_pack.rb', line 213

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