public
Created

Shows a strategy for creating both MRI and JRuby versions of a gem.

  • Download Gist
build_gem.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# Builds the gem for the current rvm ruby/platform.
# Run this once for MRI and once for JRuby, as in:
#
# rvm 1.9
# ./build_gem.sh
# rvm jruby
# ./build_gem.sh
 
 
GEM_NAME=my_gem
GEM_SPEC=${GEM_NAME}.gemspec
RUBY_VERSION=`rvm current`
GEMFILE_LOCK_VERSION_SAVE_NAME=Gemfile.lock.${RUBY_VERSION}
 
echo Building gem $GEM_NAME from $GEM_SPEC for Ruby version $RUBY_VERSION.
echo The Gemfile.lock for this version will be copied to $GEMFILE_LOCK_VERSION_SAVE_NAME.
 
mv Gemfile.lock Gemfile.sav 2> /dev/null
 
echo Running bundle install...
bundle install
cp Gemfile.lock $GEMFILE_LOCK_VERSION_SAVE_NAME
 
echo Building gem from $GEM_SPEC...
gem build $GEM_SPEC

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.