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.



241
242
243
244
245
246
247
248
249
250
251
# File 'lib/albacore/task_types/nugets_pack.rb', line 241

def initialize opts, &before_execute

  unless opts.get(:nuspec)
    raise ArgumentError, 'opts is not a map' unless opts.is_a? Map
    raise ArgumentError, 'no files given' unless opts.get(:files).length > 0
  end

  @opts           = opts.apply :out => '.'
  @files          = opts.get :files
  @before_execute = before_execute
end

Instance Method Details

#executeObject



253
254
255
256
257
258
259
260
261
262
263
# File 'lib/albacore/task_types/nugets_pack.rb', line 253

def execute
  unless @opts.get(:nuspec)
    knowns = compute_knowns
    @files.each do |p|
      proj, n, ns = generate_nuspec p, knowns
      execute_inner! proj, n, ns
    end
  else
    create_nuget! "#{Dir.pwd}", @opts.get(:nuspec)
  end
end

#generate_nuspecsObject

generate all nuspecs



274
275
276
277
278
279
280
281
282
# File 'lib/albacore/task_types/nugets_pack.rb', line 274

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(path, cwd) ⇒ Object



265
266
267
268
269
270
271
# File 'lib/albacore/task_types/nugets_pack.rb', line 265

def path_to path, cwd
  if (Pathname.new path).absolute?
     return path
  else
     return File.expand_path( File.join(@opts.get(:original_path), path), cwd )
  end
end