Skip to content

Commit

Permalink
make it easier to run specs against multiple ruby/ar versions, add Ad…
Browse files Browse the repository at this point in the history
…am to the gemfile
  • Loading branch information
zilkey committed Jun 5, 2011
1 parent c8ee114 commit 21485dd
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 2 deletions.
14 changes: 13 additions & 1 deletion Gemfile
Expand Up @@ -3,7 +3,19 @@ source :gemcutter
gemspec

group :development do
gem "activerecord"
activerecord_version = ENV['ACTIVE_HASH_ACTIVERECORD_VERSION']

if activerecord_version == "edge"
git "git://github.com/rails/rails.git" do
gem "activerecord"
gem "activesupport"
end
elsif activerecord_version && activerecord_version.strip != ""
gem "activerecord", activerecord_version
else
gem "activerecord"
end

gem "rake"
gem "rspec", "2.2.0"
gem "sqlite3-ruby", ">= 1.3.2"
Expand Down
49 changes: 49 additions & 0 deletions README.md
Expand Up @@ -325,6 +325,55 @@ Constants are formed by first stripping all non-word characters and then upcasin

The field specified as the _enum_accessor_ must contain unique data values.

## Contributing

If you'd like to become an ActiveHash contributor, the easiest way it to fork this repo, make your changes, run the specs and submit a pull request once they pass.

To run specs, run:

bundle install
bundle exec rspec spec

If your changes seem reasonable and the specs pass I'll give you commit rights to this repo and add you to the list of people who can push the gem.

## Releasing a new version

To make users' lives easier, please maintain support for:

* Ruby 1.8.7
* Ruby Enterprise 1.8.7
* Ruby 1.92
* ActiveRecord/ActiveSupport from 2.3.2 through edge

To that end, there is a prerelease script that will run the tests against those 3 rubies, and against multiple versions of ActiveRecord/ActiveSupport.
Before releasing a new version of ActiveHash, please run the prelease shell script like so:

./prerelease

It requires you to have rvm installed, and it requires the latest patch-versions of 1.8.7, ree and 1.9.2. The prerelease script will:

* switch to rvm's ruby-1.8.7
* check for an active_hash gemset, and create one if it's not there
* check for bundler and install it if it's not there
* run `bundle exec rspec spec` against AR versions 2.3.2, 2.3.5, 2.3.11, the currently released version and edge
* switch to ree-1.8.7 and do the same
* switch to ruby-1.9.2 and do the same

Needless to say, this script takes some time to run. If you have to update your rubies, the first time you run this might take 45 minutes,
but it will save users lots of headaches, and save me from dealing with the bug reports :)

Once `prerelease` passes, follow these steps to release a new version of active_hash:

* update the changelog with a brief summary of the changes that are included in the release
* bump the gem version by editing the `version.rb` file
* if there are new contributors, add them to the list of authors in the Rakefile
* run `rake build`
* commit those changes
* run `rake install` and verify that the gem loads correctly from an irb session
* run `rake release`, which will rebuild the gem, tag it, push the tags (and your latest commit) to github, then push the gem to rubygems.org

If you have any questions about how to maintain backwards compatibility, please email me and we can figure it out.

## Copyright

Copyright (c) 2010 Jeff Dean. See LICENSE for details.
3 changes: 2 additions & 1 deletion active_hash.gemspec
Expand Up @@ -23,7 +23,8 @@ Gem::Specification.new do |s|
"Tom Stuart",
"Joel Chippindale",
"Kevin Olsen",
"Vladimir Andrijevik"
"Vladimir Andrijevik",
"Adam Anderson"
]
s.date = %q{2011-01-22}
s.email = %q{jeff@zilkey.com}
Expand Down
50 changes: 50 additions & 0 deletions prerelease
@@ -0,0 +1,50 @@
#!/bin/sh

# if any of the commands fails, exit the script immediately
set -e

# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi

function run {
gem list --local bundler | grep bundler || gem install bundler --no-ri --no-rdoc

echo 'Running bundle exec rspec spec against activesupport / activerecord 2.3.2...'
ACTIVE_HASH_ACTIVERECORD_VERSION=2.3.2 bundle update activerecord
bundle exec rspec spec

echo 'Running bundle exec rspec spec against activesupport / activerecord 2.3.5...'
ACTIVE_HASH_ACTIVERECORD_VERSION=2.3.5 bundle update activerecord
bundle exec rspec spec

echo 'Running bundle exec rspec spec against activesupport / activerecord 2.3.11...'
ACTIVE_HASH_ACTIVERECORD_VERSION=2.3.11 bundle update activerecord
bundle exec rspec spec

echo 'Running bundle exec rspec spec against the latest released version of activesupport / activerecord...'
ACTIVE_HASH_ACTIVERECORD_VERSION="" bundle update activerecord
bundle exec rspec spec

echo 'Running bundle exec rspec spec against edge activesupport / activerecord...'
ACTIVE_HASH_ACTIVERECORD_VERSION=edge bundle update activerecord activesupport
bundle exec rspec spec
}

rvm use ruby-1.8.7@active_hash --create
run

rvm use ree-1.8.7@active_hash --create
run

rvm use ruby-1.9.2@active_hash --create
run

echo 'Success!'

0 comments on commit 21485dd

Please sign in to comment.