Rakefile in archruby-0.2.0 vs Rakefile in archruby-0.3.0

- old
+ new

@@ -1,46 +1,92 @@ require "bundler/gem_tasks" + +begin + require 'rspec/core/rake_task' + + RSpec::Core::RakeTask.new(:spec) + + task :default => :spec +rescue LoadError + # no rspec available +end + +def name + @name ||= File.basename(Dir['*.gemspec'].first, ".*") +end + +def gemspec_file + "#{name}.gemspec" +end + +def version + Archruby::VERSION +end + +def gem_file + "#{name}-#{Gem::Version.new(version).to_s}.gem" +end + +desc "Release #{name} v#{version}" +task :release => :build do + unless `git branch` =~ /^\* master$/ + puts "You must be on the master branch to release!" + exit! + end + sh "git commit --allow-empty -m 'Release :gem: #{version}'" + sh "git tag v#{version}" + sh "git push origin master" + sh "git push origin v#{version}" + sh "gem push pkg/#{name}-#{version}.gem" +end + +desc "Build #{name} v#{version} into pkg/" +task :build do + mkdir_p "pkg" + sh "gem build #{gemspec_file}" + sh "mv #{gem_file} pkg" +end