Merging Gems Workers run in a Ruby environment in the cloud. A limited number of gems are included as part of the native environment. See Supported Gems for the list. You can merge gems (and specific gem versions) with your worker by using the Here's how:
That's it! ExampleFor example, to use the dropbox gem, simply add:
For including a specific version of a gem, just include the version number after the gem.
For gems with different sub-directory names, include a require with the path.
Merging Gems with Data FilesFor including non .rb files with the gem, you can include the directory after the gem
Global merge_gemYou can also specify gems that you would like to use globally. In your configuration block you can use:
This will then be used in all of your workers. Gems with DependenciesGems with other gem dependencies will not automatically be merged. You may have to merge in the dependent gems in these situations. Use the Also, if one gem depends on another at require/load time, then they will need to appear in the correct order. One way to think of merge_gem is as if it were just a require. For example, if you're using the gdocs4ruby gem, running
Given this dependency, you'll want to merge them both into your worker -- in the order of dependency.
Gems with Binary EncodingsGems that make use of binary encodings may have issues running within SimpleWorker. Contact us if you are having difficulties when using a binary gem. Other Notes
|
Ruby > Working with Gems >