stibium-bundled 
This gem is intended to mimic Bundler's behavior and conform to bundler configuration options.
stibium-bundled detects gems.rb and gems.locked
(or Gemfile and Gemfile.lock)
and bundler/setup (for standalone installation).
standalone makes a bundle that can work without depending on Bundler (or Rubygems) at runtime. Bundler generates
a bundler/setup.rb file to replace Bundler's own setup in the manner required.
Configuration settings are loaded in this order:
- Local config (
.bundle/configor"$BUNDLE_APP_CONFIG/config) - Environment variables (
ENV) - Global config (
~/.bundle/config) - Default config
Sample of use
# file: lib/awesome_gem.rb
require 'stibium/bundled'
module AwesomeGem
include(Stibium::Bundled)
self.bundled_from("#{__dir__}/..", setup: true)
end
or more concise:
# file: lib/awesome_gem.rb
require 'stibium/bundled'
module AwesomeGem
include(Stibium::Bundled).bundled_from("#{__dir__}/..", setup: true)
end
or load a gem depending on status:
# file: lib/awesome_gem.rb
require 'stibium/bundled'
module AwesomeGem
include(Stibium::Bundled).bundled_from("#{__dir__}/..", setup: true) do |bundle|
if Object.const_defined?(:Gem) and bundle.locked? and bundle.installed?
'foo-bar'.tap do |gem_name|
unless bundle.specifications.keep_if { |spec| spec.name == gem_name }.empty?
require gem_name.gsub('-', '/')
end
end
end
end
end
Install
bundle config set --local clean 'true'
bundle config set --local path 'vendor/bundle'
bundle install --standalone