Skip to content

Commit

Permalink
adds some checks to the release process, and ensures that Gemfile.loc…
Browse files Browse the repository at this point in the history
…k.development is updated before a new release
  • Loading branch information
ianwhite committed Jan 4, 2011
1 parent 448d878 commit cb97882
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Gemfile.lock.development
Expand Up @@ -73,6 +73,7 @@ GEM
data_objects (= 0.10.2)
extlib (0.9.15)
fastercsv (1.5.3)
git (1.2.5)
i18n (0.5.0)
json_pure (1.4.6)
mongo (1.1.5)
Expand Down Expand Up @@ -108,6 +109,7 @@ DEPENDENCIES
datamapper (>= 1.0)
dm-active_model (>= 1.0)
dm-sqlite-adapter (>= 1.0)
git (>= 1.2.5)
mongoid (>= 2.0.0.beta.20)
orm_adapter!
rake (>= 0.8.7)
Expand Down
34 changes: 28 additions & 6 deletions Rakefile
Expand Up @@ -2,6 +2,7 @@ require 'rubygems'
require 'rake'
require 'rspec/core/rake_task'
require 'yard'
require 'git'
$:.push File.expand_path("../lib", __FILE__)
require "orm_adapter/version"

Expand All @@ -18,16 +19,37 @@ task :build do
end

namespace :release do
task :rubygems => :build do
task :rubygems => :pre do
system "gem push orm_adapter-#{OrmAdapter::VERSION}"
end

task :github => :build do
`git rev-parse HEAD` == `git rev-parse origin/master` or raise "\n** origin does not match HEAD, have you pushed?"
task :github => :pre do
tag = "v#{OrmAdapter::VERSION}"
`git tag`.split("\n").include?(tag) and raise "\n** tag: #{tag} is already tagged."
`git tag #{tag}`
`git push --tags`
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

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') != git.object('origin/master')
raise "** origin does not match HEAD, have you pushed?"
end
end

task :all => ['release:github', 'release:rubygems']
Expand Down
1 change: 1 addition & 0 deletions orm_adapter.gemspec
Expand Up @@ -19,6 +19,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]

s.add_development_dependency "bundler", ">= 1.0.0"
s.add_development_dependency "git", ">= 1.2.5"
s.add_development_dependency "yard", ">= 0.6.0"
s.add_development_dependency "rake", ">= 0.8.7"
s.add_development_dependency "activerecord", ">= 3.0.0"
Expand Down

0 comments on commit cb97882

Please sign in to comment.