Rakefile in orm_adapter-0.0.3 vs Rakefile in orm_adapter-0.0.4
- old
+ new
@@ -1,39 +1,56 @@
require 'rubygems'
require 'rake'
require 'rspec/core/rake_task'
require 'yard'
+require 'git'
+$:.push File.expand_path("../lib", __FILE__)
+require "orm_adapter/version"
-$:.unshift File.expand_path('lib')
-require 'orm_adapter/version'
-
-task :spec => :check_dependencies
task :default => :spec
-desc "Run the specs"
RSpec::Core::RakeTask.new(:spec)
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "orm_adapter"
- gem.version = OrmAdapter::VERSION
- gem.summary = %Q{Provides a single point of entry for using basic features of ruby ORMs}
- gem.description = %Q{Provides a single point of entry for using basic features of ruby ORMs}
- gem.email = "ian.w.white@gmail.com"
- gem.homepage = "http://github.com/ianwhite/orm_adapter"
- gem.authors = ["Ian White", "Jose Valim"]
+YARD::Rake::YardocTask.new(:doc) do |t|
+ t.files = ['lib/**/*.rb', 'README.rdoc']
+end
+
+task :build do
+ system "gem build orm_adapter.gemspec"
+end
+
+namespace :release do
+ task :rubygems => :pre do
+ system "gem push orm_adapter-#{OrmAdapter::VERSION}.gem"
end
- Jeweler::GemcutterTasks.new
- namespace :release do
- desc "release to github and gemcutter"
- task :all => ['release', 'gemcutter:release']
+ task :github => :pre do
+ tag = "v#{OrmAdapter::VERSION}"
+ git = Git.open('.')
+
+ if (git.tag(tag) rescue nil)
+ raise "** repo is already tagged with: #{tag}"
+ end
+
+ git.add_tag(tag)
+ git.push('origin', tag)
end
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
-end
-
-YARD::Rake::YardocTask.new(:doc) do |t|
- t.files = ['lib/**/*.rb', 'README.rdoc']
-end
+ task :pre => [:spec, :build] do
+ git = Git.open('.')
+
+ if File.exists?("Gemfile.lock") && File.read("Gemfile.lock") != File.read("Gemfile.lock.development")
+ cp "Gemfile.lock", "Gemfile.lock.development"
+ raise "** Gemfile.lock.development has been updated, please commit these changes."
+ end
+
+ if (git.status.changed + git.status.added + git.status.deleted).any?
+ raise "** repo is not clean, try committing some files"
+ end
+
+ if git.object('HEAD').sha != git.object('origin/master').sha
+ raise "** origin does not match HEAD, have you pushed?"
+ end
+ end
+
+ task :all => ['release:github', 'release:rubygems']
+end
\ No newline at end of file