Here's how to freeze any gem into your Rails app. This is a simplified version of the larger discussion Vendor Everything at err.the_blog.
- Copy the gems you want into the directory vendor/gems.
$ mkdir vendor/gems $ cd vendor/gems $ gem unpack some_gem_name # repeat for each gem
- Edit config/environment.rb and add the following inside the
Rails::Initializer.run
block:Rails::Initializer.run do |config| # add the next three lines config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir| File.directory?(lib = "#{dir}/lib") ? lib : dir end end
Now you can require those gems in your code, even if the system you are running on doesn't have that gem installed.
1 comment:
Thanks mate! This is really useful
Post a Comment