Class: Albacore::NugetsPack::Config

Inherits:
Object
  • Object
show all
Extended by:
ConfigDSL
Includes:
CmdConfig
Defined in:
lib/albacore/task_types/nugets_pack.rb

Overview

This tasktype allows you to quickly package project files to nuget packages.

Point files to the project files, that should be in MsBuild XML.

Examples

nugets_pack :pack => ['build/pkg', :versioning] do |p|
  p.files   = FileList['src/**/*.csproj']
  p.out     = 'build/pkg'
  p.exe     = 'buildsupport/NuGet.exe'
  p. do |m|
    m.version = ENV['NUGET_VERSION']
  end
  p.gen_symbols
  p.no_project_dependencies
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConfigDSL

attr_path, attr_path_accessor

Methods included from CmdConfig

#add_parameter, #parameters

Methods included from Logging

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

Constructor Details

#initializeConfig

Returns a new instance of Config.



143
144
145
146
147
148
149
150
# File 'lib/albacore/task_types/nugets_pack.rb', line 143

def initialize
  @package = Albacore::NugetModel::Package.new
  @target  = 'net40'
  @symbols = false
  @project_dependencies = true
  @leave_nuspec = false
  fill_required
end

Instance Attribute Details

#configuration=(value) ⇒ Object (writeonly)

sets the MsBuild configuration that is used to produce the output into <OutputPath>…</OutputPath>



141
142
143
# File 'lib/albacore/task_types/nugets_pack.rb', line 141

def configuration=(value)
  @configuration = value
end

#files=(value) ⇒ Object (writeonly)

sets the files to search



137
138
139
# File 'lib/albacore/task_types/nugets_pack.rb', line 137

def files=(value)
  @files = value
end

#target=(value) ⇒ Object (writeonly)

the .net target (e.g. net40, mono20, mono3, etc)



134
135
136
# File 'lib/albacore/task_types/nugets_pack.rb', line 134

def target=(value)
  @target = value
end

Instance Method Details

#gen_symbolsObject

generate symbols for the nugets: just call this method to enable generation



163
164
165
# File 'lib/albacore/task_types/nugets_pack.rb', line 163

def gen_symbols
  @symbols = true
end

#leave_nuspecObject

leave the nuspec behind, don’t delete it after generating it



169
170
171
# File 'lib/albacore/task_types/nugets_pack.rb', line 169

def leave_nuspec
  @leave_nuspec = true
end

#no_project_dependenciesObject

call this if you want to cancel ‘smart’ scanning of the *proj file for its dependencies



175
176
177
# File 'lib/albacore/task_types/nugets_pack.rb', line 175

def no_project_dependencies
  @project_dependencies = false
end

#optsObject

gets the options specified for the task, used from the task



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/albacore/task_types/nugets_pack.rb', line 180

def opts
  files = @files.respond_to?(:each) ? @files : [@files]

  [:authors, :description, :version].each do |required|
    warn "metadata##{required} is missing from nugets_pack [nugets pack: config]" if @package..send(required) == 'MISSING' 
  end
  
  Map.new({
    :out           => @out,
    :exe           => @exe,
    :symbols       => @symbols,
    :package       => @package,
    :target        => @target,
    :files         => @files,
    :configuration => @configuration,
    :project_dependencies => @project_dependencies,
    :original_path => FileUtils.pwd,
    :leave_nuspec  => @leave_nuspec
  })
end

#with_metadata {|@package.metadata| ... } ⇒ Object

Yields:

  • (@package.metadata)


152
153
154
# File 'lib/albacore/task_types/nugets_pack.rb', line 152

def  &block
  yield @package.
end

#with_package {|@package| ... } ⇒ Object

configure the package with a block

Yields:

  • (@package)


157
158
159
# File 'lib/albacore/task_types/nugets_pack.rb', line 157

def with_package &block
  yield @package
end