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.



232
233
234
235
236
237
238
239
240
241
242
# File 'lib/albacore/task_types/nugets_pack.rb', line 232

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



244
245
246
247
248
249
250
251
252
253
254
# File 'lib/albacore/task_types/nugets_pack.rb', line 244

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



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

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



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

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