Rakefile in pacto-0.3.0 vs Rakefile in pacto-0.3.1

- old
+ new

@@ -1,6 +1,5 @@ -require 'bundler/gem_tasks' require 'rspec/core/rake_task' require 'pacto/rake_task' require 'cucumber' require 'cucumber/rake/task' require 'coveralls/rake/task' @@ -25,5 +24,41 @@ RSpec::Core::RakeTask.new(:integration) do |t| t.pattern = 'spec/integration/**/*_spec.rb' end task :default => [:unit, :integration, :journeys, :rubocop, 'coveralls:push'] + +desc 'Build gems into the pkg directory' +task :build do + FileUtils.rm_rf('pkg') + Dir['*.gemspec'].each do |gemspec| + system "gem build #{gemspec}" + end + FileUtils.mkdir_p('pkg') + FileUtils.mv(Dir['*.gem'], 'pkg') +end + +desc 'Tags version, pushes to remote, and pushes gems' +task :release => :build do + sh 'git', 'tag', '-m', changelog, "v#{Pacto::VERSION}" + sh 'git push origin master' + sh "git push origin v#{Pacto::VERSION}" + sh 'ls pkg/*.gem | xargs -n 1 gem push' +end + +task :changelog do + changelog +end + +def changelog + changelog = File.read('CHANGELOG').split("\n\n\n", 2).first + confirm "Does the CHANGELOG look correct? ", changelog +end + +def confirm(question, data) + puts "Please confirm..." + puts data + print question + abort "Aborted" unless $stdin.gets.strip == 'y' + puts "Confirmed" + data +end