Skip to content

Instantly share code, notes, and snippets.

@amirci
Created March 27, 2011 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amirci/888798 to your computer and use it in GitHub Desktop.
Save amirci/888798 to your computer and use it in GitHub Desktop.
Rakefile to generate nuget packages passing the name of the package, version and folder to get the assemblies from
require 'rubygems'
require 'rake/clean'
require 'albacore'
include FileUtils
desc 'Publish nuget package'
task :default => ["deploy:publish"]
namespace :deploy do
nuget_lib = "nuget/lib"
desc "Publish nuspec package"
task :publish, [:package, :version, :path] do |t, args|
Rake::Task["util:clean_folder"].invoke("nuget")
Dir.mkdir(nuget_lib)
puts "Using path #{args.path}"
FileList["#{args.path}/*.dll"].each { |f| cp f, nuget_lib }
Rake::Task["deploy:spec"].invoke(args.package, args.version)
Rake::Task["deploy:package"].invoke(args.package, args.version)
# Here you could use FTP or any other way of publishing your package
cp "nuget/#{args.package}.#{args.version}.nupkg", "PUT HERE THE NUGET FOLDER"
end
nugetpack :package, [:package_id, :version] do |t, args|
t.nuspec = "nuget/#{args.package_id}.#{args.version}.nuspec"
t.output = "nuget"
end
nuspec :spec, [:package_id, :version] do |t, args|
t.id = args.package_id
t.version = args.version
t.authors = "Price Developer"
t.description = "#{args.package_id} library"
t.summary = "#{args.package_id} library"
t.language = "en-US"
t.working_directory = "nuget"
t.output_file = "#{args.package_id}.#{args.version}.nuspec"
end
end
namespace :util do
task :clean_folder, :folder do |t, args|
rm_rf(args.folder)
Dir.mkdir(args.folder) unless File.directory? args.folder
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment