-
Notifications
You must be signed in to change notification settings - Fork 64
nugets_pack
This task type will automatically construct nuget packages for each of the projects you've given it as an Enumerable (the assignment to #files
).
It will use the metadata that's already available in the xxproj-file to construct the nuget metadata, instead of forcing you to populate a nuspec
file manually.
You can override the metadata by setting values inside #with_metadata
.
The project's <Name />
element will map to the id
and title
nuspec attributes, unless an Id
element has been given, in which case it will map to the id
nuspec attribute, and <Title />
to the title
nuspec attribute.
nugets_pack :create_nugets do |p|
p.configuration = 'Release'
p.files = FileList['src/**/*.{csproj,fsproj,nuspec}'].
exclude(/Tests/)
# This line will bypass creating a nuspec file and configure the task with a precompiled nuspec file
p.nuspec = 'nuget/app.nuspec'
p.out = 'build/pkg'
p.exe = 'buildsupport/NuGet.exe'
# This line will leave the nuspec so you can inspect and verify it, take it out if you don't want the nuspec file to
# stay around.
p.leave_nuspec
p.with_metadata do |m|
m.description = 'A cool nuget'
m.authors = 'Henrik'
m.version = ENV['NUGET_VERSION']
m.add_dependency "NugetId", "[1.0.0)"
end
p.with_package do |p|
p.add_file 'file/relative/to/proj', 'lib/net40'
end
end
The available metadata properties are in the nuspec specification. Translate the camel case property to snake case. You can also browse the albacore code to a list.
Cancel following of references between projects that cause nugets_pack to find and add as nuget dependencies, linked projects.
nugets_pack :create_nugets do |p|
...
p.gen_symbols
...
end
Instead of having nuget in your source you can depend on the nuget gem So in the above example you can replace "p.exe" with "p.nuget_gem_exe":
nugets_pack :create_nugets do |p|
...
p.nuget_gem_exe
...
end
And in your gemfile add the line:
gem 'nuget'
in addition to albacore.