Buildr
  1. Buildr
  2. BUILDR-616

Buildr development - If using rvm a default .rvmrc file would be helpful

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.7
    • Component/s: None
    • Labels:
      None

      Description

      For those users working on buildr that also use rvm a .rvmrc file might add some convenience.
      Here are the contents of a .rvmrc file that could be placed in the root of the buildr project:
      --------------------------------------------------------------------------------------
      #!/usr/bin/env bash
      ruby_string="$

      {BUILDR_RUBY_VERSION:-ruby-1.9.2}

      "
      bundler_gem_home="vendor/bundle"

      if rvm list strings | grep -q "$

      {ruby_string}" ; then
      rvm use "${ruby_string}

      @buildr"

      gem list | grep 'bundler' &> /dev/null
      if [ $? -gt 0 ]; then
      echo "Installing bundler..."
      gem install bundler
      fi

      bundle install
      else
      echo "$

      {ruby_string} was not found, please run 'rvm install ${ruby_string}

      ' and then cd back into the project directory."
      fi
      --------------------------------------------------------------------------------------

      When cd'ing into the buildr directory and you have rvm installed this script is executed. It will
      1. Set the desired version of ruby to the BUILDR_RUBY_VERSION environment variable or 1.9.2 if not set.
      2. Check to make sure that rvm has that particular version of ruby set.
      3. If not then it kindly tells the user how to install it.
      4. It tells rvm to use the desired version of ruby along with a gemset called 'buildr'
      5. It checks to see if bundler is installed and if it is not it will do a gem install bundler.
      6. And finally it does a bundle install to pull in all of the dependencies.

        Activity

        Hide
        Antoine Toulme added a comment -

        Looks ok to me. I'll try it out.

        Show
        Antoine Toulme added a comment - Looks ok to me. I'll try it out.
        Hide
        Antoine Toulme added a comment -

        Tried, got this:

        error: Gemset 'buildr' does not exist, rvm gemset create 'buildr' first.
        
        info: Using ruby 1.9.2 p0 with gemset buildr
        /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/ui.rb:46:in `<class:UI>': uninitialized constant Gem::SilentUI (NameError)
        	from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/ui.rb:2:in `<module:Bundler>'
        	from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/ui.rb:1:in `<top (required)>'
        	from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/cli.rb:17:in `initialize'
        	from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/vendor/thor.rb:246:in `new'
        	from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/vendor/thor.rb:246:in `dispatch'
        	from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/vendor/thor/base.rb:389:in `start'
        	from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/bin/bundle:13:in `<top (required)>'
        	from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/bin/bundle:19:in `load'
        	from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/bin/bundle:19:in `<main>'
        
        Show
        Antoine Toulme added a comment - Tried, got this: error: Gemset 'buildr' does not exist, rvm gemset create 'buildr' first. info: Using ruby 1.9.2 p0 with gemset buildr /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/ui.rb:46:in `<class:UI>': uninitialized constant Gem::SilentUI (NameError) from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/ui.rb:2:in `<module:Bundler>' from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/ui.rb:1:in `<top (required)>' from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/cli.rb:17:in `initialize' from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/vendor/thor.rb:246:in ` new ' from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/vendor/thor.rb:246:in `dispatch' from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/lib/bundler/vendor/thor/base.rb:389:in `start' from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/gems/bundler-1.0.0.rc.5/bin/bundle:13:in `<top (required)>' from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/bin/bundle:19:in `load' from /Users/antoine/.rvm/gems/ruby-1.9.2-p0@global/bin/bundle:19:in `<main>'
        Hide
        Antoine Toulme added a comment - - edited

        Sorry, an old bundler gem was problematic. Still trying this.

        Show
        Antoine Toulme added a comment - - edited Sorry, an old bundler gem was problematic. Still trying this.
        Hide
        Antoine Toulme added a comment -

        This works great on Mac OS X 10.6, but there is an outstanding issue: it forces RVM to switch to 1.9.2 even if I want to use jruby for example.

        13:12:06~/w>rvm use jruby-1.6.2

        info: Using jruby 1.6.2
        13:12:13~/w>cd buildr

        info: Using ruby 1.9.2 p0 with gemset buildr
        [..]

        This would impact jruby environments, and maybe environments where we want to test out 1.8.7 (for those stuck with the debian packages and such).

        Show
        Antoine Toulme added a comment - This works great on Mac OS X 10.6, but there is an outstanding issue: it forces RVM to switch to 1.9.2 even if I want to use jruby for example. 13:12:06~/w>rvm use jruby-1.6.2 info: Using jruby 1.6.2 13:12:13~/w>cd buildr info: Using ruby 1.9.2 p0 with gemset buildr [..] This would impact jruby environments, and maybe environments where we want to test out 1.8.7 (for those stuck with the debian packages and such).
        Hide
        Russell Teabeault added a comment -

        It should use the BUILDR_RUBY_VERSION environment variable if it is set.

        ruby_string="$

        {BUILDR_RUBY_VERSION:-ruby-1.9.2}

        "

        So try setting that environment variable and rvm should use that version.

        Show
        Russell Teabeault added a comment - It should use the BUILDR_RUBY_VERSION environment variable if it is set. ruby_string="$ {BUILDR_RUBY_VERSION:-ruby-1.9.2} " So try setting that environment variable and rvm should use that version.
        Hide
        Antoine Toulme added a comment -

        OK, tried that and it works well. Thanks!

        Show
        Antoine Toulme added a comment - OK, tried that and it works well. Thanks!
        Hide
        Antoine Toulme added a comment -

        Committed your patch with a notice message:

        ~/w/buildr>svn ci -m "BUILDR-616 Buildr development - If using rvm a default .rvmrc file would be helpful (Russell Teabeault)"
        Adding         .rvmrc
        Sending        CHANGELOG
        Transmitting file data ..
        Committed revision 1202941.
        

        The message goes like this:
        ********************************************************************

        • RVM will install the environment for Buildr development now.
        • By default it will use ruby-1.9.2.
        • To force use an other version of ruby, set BUILDR_RUBY_VERSION.
        • Example:
        • export BUILDR_RUBY_VERSION=jruby-1.6.5
          ********************************************************************
        Show
        Antoine Toulme added a comment - Committed your patch with a notice message: ~/w/buildr>svn ci -m "BUILDR-616 Buildr development - If using rvm a default .rvmrc file would be helpful (Russell Teabeault)" Adding .rvmrc Sending CHANGELOG Transmitting file data .. Committed revision 1202941. The message goes like this: ******************************************************************** RVM will install the environment for Buildr development now. By default it will use ruby-1.9.2. To force use an other version of ruby, set BUILDR_RUBY_VERSION. Example: export BUILDR_RUBY_VERSION=jruby-1.6.5 ********************************************************************
        Hide
        Hudson added a comment -

        Integrated in Buildr-ci-build #291 (See https://builds.apache.org/job/Buildr-ci-build/291/)
        BUILDR-616 Buildr development - If using rvm a default .rvmrc file would be helpful (Russell Teabeault)

        toulmean :
        Files :

        • /buildr/trunk/.rvmrc
        • /buildr/trunk/CHANGELOG
        Show
        Hudson added a comment - Integrated in Buildr-ci-build #291 (See https://builds.apache.org/job/Buildr-ci-build/291/ ) BUILDR-616 Buildr development - If using rvm a default .rvmrc file would be helpful (Russell Teabeault) toulmean : Files : /buildr/trunk/.rvmrc /buildr/trunk/CHANGELOG

          People

          • Assignee:
            Antoine Toulme
            Reporter:
            Russell Teabeault
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development