Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Using RubyGems with ScoutApp

zdennis edited this page · 1 revision

ScoutApp doesn't currently provide a built-in mechanism through the UI for integrating rubygems. Until it's a part of the UI it can be worked around but it requires a little command-line effort:

On OSX

Installing RubyGems for Scout

Disclaimer: this step doesn't upgrade with Scoutt. If you install a newer version of Scout you may have to repeat this step. Once this is available in the UI you won't need to do this step any more.

Open Terminal (don't re-use an existing session, we'll set some environment variables later and close this Terminal session, so open a new window that you won't mind closing later).

Change directory to where ScoutApp is installed (usually in /Applications):

cd /Applications/Scout.app/Contents/Resources 

Now open up the Gemfile that ScoutApp uses by default:

open config/Gemfile

It's just a text file so any text editor will do. Now, add the gems you want to use:

gem "some-gem"
gem "some-other-gem"

Save the file. Now you should still be in /Applications/Scout.app/Contents/Resources directory. From this directory you need to tell ScoutApp to update its gems.

export BUNDLE_GEMFILE=config/Gemfile 
export GEM_PATH="`pwd`/vendor/gems"
export GEM_HOME="`pwd`/vendor/gems" 
java -jar vendor/jruby-complete.jar -S vendor/gems/gems/bundler-1.2.0/bin/bundle

To make sure they are installed properly, if you run the following command you should see the gems added:

ls vendor/gems/gems/

If they're not there they didn't install to the right location (make sure the BUNDLE_GEMFILE, GEM_PATH, and GEM_HOME were all set). If they did then go ahead and close the terminal window.

Now ScoutApp will have access to the gems you've added, but there's one more step so you can use them.

Configuring Your Project To Use The Rubygems

Disclaimer: the previous step doesn't upgrade well, but your configuration file won't be touched by upgrading a new version of ScoutApp.

Run ScoutApp. Select a project. In the Configuration pane there's a "Config File" option. You'll need to specify a config file. If you don't have one you can create one inside your project and choose it here. This file is going to be a plain text file with some Ruby code.

Open your config file in a text editor and then add the require statements for loading the gems you added above:

require "some-gem"
require "some-other-gem"

At this point you should have access to whatever functionality was provided by the gem. And all you should have to do is start watching your project by clicking the Play button.

P.S. - if requiring the gem didn't work then make sure you're requiring it by the right name. Refer to the documentation for the gem(s) you're using

Something went wrong with that request. Please try again.