require 'rake' require 'rake/testtask' require 'bundler/gem_tasks' require 'date' desc 'Test the rumeme gem' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end task :default => [:test] desc "Bumps the version by a minor or patch version, depending on what was passed in." task :bump, :part do |t, args| if Rumeme::VERSION =~ /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/ major = $1.to_i minor = $2.to_i patch = $3.to_i else abort end case args[:part] when /minor/ minor += 1 patch = 0 when /patch/ patch += 1 else abort abort end version = [major, minor, patch].compact.join('.') File.open(File.join("lib", "rumeme", "version.rb"), "w") do |f| f.write < 1.3.0)" task :minor do |t| Rake::Task['bump'].invoke(t.name) Rake::Task['change'].invoke end desc "Bump by a patch version, (1.2.3 => 1.2.4)" task :patch do |t| Rake::Task['bump'].invoke(t.name) Rake::Task['change'].invoke end desc "Push the latest version and tags" task :push do system("git push origin master") system("git push origin $(git tag | tail -1)") end #desc 'Preparing release' #task :prepare_release, :part do |t, args| # Rake::Task['bump'].invoke(args[:part]) # Rake::Task['change'].invoke # Rake::Task['push'].invoke #end