Skip to content

Instantly share code, notes, and snippets.

@renier
Created May 18, 2014 15:56
Show Gist options
  • Save renier/fc3c5bf0a87d239db972 to your computer and use it in GitHub Desktop.
Save renier/fc3c5bf0a87d239db972 to your computer and use it in GitHub Desktop.
PackageTask example
require 'bundler/gem_tasks'
require 'rake/packagetask'
require 'rubocop/rake_task'
require 'rspec/core/rake_task'
ROOT_DIR = File.dirname(__FILE__)
gemspec = Gem::Specification.load("#{Dir.glob(ROOT_DIR + '/*.gemspec')[0]}")
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = '-f d -c'
end
task :rubocop do
Rubocop::RakeTask.new
end
Rake::PackageTask.new(gemspec.name, gemspec.version.to_s) do |pkg|
pkg.need_tar_bz2 = pkg.need_zip = true
pkg.package_files = gemspec.files
end
task default: [:rubocop, :spec]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment