Rakefile in parallel-0.5.15 vs Rakefile in parallel-0.5.16

- old
+ new

@@ -1,21 +1,23 @@ -task :default => :spec -require "rspec/core/rake_task" -RSpec::Core::RakeTask.new(:spec) do |t| - t.rspec_opts = '--backtrace --color' +require 'bundler/gem_tasks' + +task :default do + sh "rspec spec/" end -begin - require 'jeweler' - Jeweler::Tasks.new do |gem| - gem.name = 'parallel' - gem.summary = "Run any kind of code in parallel processes" - gem.email = "grosser.michael@gmail.com" - gem.homepage = "http://github.com/grosser/#{gem.name}" - gem.authors = ["Michael Grosser"] - gem.license = "MIT" - end +# extracted from https://github.com/grosser/project_template +rule /^version:bump:.*/ do |t| + sh "git status | grep 'nothing to commit'" # ensure we are not dirty + index = ['major', 'minor','patch'].index(t.name.split(':').last) + file = 'lib/parallel/version.rb' - Jeweler::GemcutterTasks.new -rescue LoadError - puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler" + version_file = File.read(file) + old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a + version_parts[index] = version_parts[index].to_i + 1 + version_parts[2] = 0 if index < 2 # remove patch for minor + version_parts[1] = 0 if index < 1 # remove minor for major + new_version = version_parts * '.' + File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) } + + sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'" end +