-
Notifications
You must be signed in to change notification settings - Fork 69
Adding Gems
Moonshine works with rails to get your gem dependency. In addition, it handles installing native dependencies (ie nokogiri requires libxml).
Adding a new gem to a Rails application managed by Moonshine is a three step process.
... config.gem "my_cool_gem" ...
rake moonshine:gems
This will regenerate your config/gems.yml to reflect the gems in your environment.rb. Be sure to add this to your git repo by doing:
git add config/gems.yml && git commit -m "Added config/gems.yml generated by moonshine"
The next time you deploy your application Moonshine will ensure all gems specified in config/gems.yml are installed on your server.
If you have a Gemfile
in your app, then bundle install
is run for you automatically during deploy. It will also take care of system dependencies of these gems.
Currently, the bundler support will not install system dependencies, pending a rubygems 1.3.6 release. In the interim, you will need to manually specify these in your application_manifest.rb
. For nokogiri, for example, you’d need this:
def application_packages package 'libxml2-dev', :before => exec('bundle install') package 'libxslt1-dev', :before => exec('bundle install') end recipe :application_packages
Moonshine maintains a mapping of gems to native packages. You can find this in lib/moonshine/manifest/rails/apt_gems.yml
.
If you to define extra mappings, you can update this locally in your config/moonshine.yml
:
:apt_gems: :awesomegem: - awesome - libawesome-dev
If moonshine is missing mappings for publicly available gems, please open an issue