Class: Albacore::NugetsPack::Cmd

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

Overview

the nuget command

Constant Summary

Constants included from CrossPlatformCmd

CrossPlatformCmd::KILL_TIMEOUT

Instance Attribute Summary

Attributes included from CrossPlatformCmd

#pid

Instance Method Summary collapse

Methods included from CrossPlatformCmd

#chdir, #make_command, #normalise_slashes, #sh, #shie, #stop, #system, #which

Methods included from Logging

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

Constructor Details

#initialize(executable, *args) ⇒ Cmd

executable => the nuget executable

Raises:

  • (ArgumentError)


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/albacore/task_types/nugets_pack.rb', line 22

def initialize executable, *args
  opts = Map.options args
  raise ArgumentError, 'out is nil' if opts.getopt(:out).nil?

  @work_dir   = opts.getopt :work_dir, default: nil
  @executable = executable
  @parameters = [%W{Pack -OutputDirectory #{opts.get(:out)}}].flatten
  @opts = opts

  mono_command
end

Instance Method Details

#execute(nuspec_file, nuspec_symbols_file = nil) ⇒ Object

run nuget on the nuspec to create a new package returns: a tuple-array of the package and the symbol package

of which the symbol package is nil if it was not generated


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/albacore/task_types/nugets_pack.rb', line 37

def execute nuspec_file, nuspec_symbols_file = nil
  debug "NugetsPack::Cmd#execute, opts: #{@opts} [nugets pack: cmd]"
  original_pars = @parameters.dup

  pars = original_pars.dup
  pars << nuspec_file
  pkg = get_nuget_path_of do
    system @executable, pars, :work_dir => @work_dir
  end

  debug "package at '#{pkg}'"

  # if the symbols flag is set and there's a symbols file specified
  # then run NuGet.exe to generate the .symbols.nupkg file
  if nuspec_symbols_file
    pars = original_pars.dup 
    pars << '-Symbols' 
    pars << nuspec_symbols_file 
    spkg = with_subterfuge pkg do
      get_nuget_path_of do
        system @executable, pars, :work_dir => @work_dir
      end
    end

    debug "symbol package at '#{spkg}'"

    [pkg, spkg]
  else
    info "symbols not configured for generation, use Config#gen_symbols to do so [nugets pack: cmd]"
    [pkg, nil]
  end
end