class BundlerExt::Runtime
Public Class Methods
namespaced_file(file)
click to toggle source
Helper to generate, taken from bundler_ext
# File lib/bundler_ext/runtime.rb, line 31 def self.namespaced_file(file) return nil unless file.to_s.include?('-') file.respond_to?(:name) ? file.name.gsub('-', '/') : file.to_s.gsub('-', '/') end
Public Instance Methods
add_spec(spec)
click to toggle source
# File lib/bundler_ext/runtime.rb, line 62 def add_spec(spec) # copied from Bundler::Runtime#setup rubygems.mark_loaded spec load_paths = spec.load_paths.reject {|path| $LOAD_PATH.include?(path)} $LOAD_PATH.unshift(*load_paths) end
bundler()
click to toggle source
# File lib/bundler_ext/runtime.rb, line 15 def bundler @bundler_runtime ||= Bundler::Runtime.new(root, gemfile) end
clear()
click to toggle source
# File lib/bundler_ext/runtime.rb, line 58 def clear bundler.send :clean_load_path end
gemfile(new_val = nil)
click to toggle source
# File lib/bundler_ext/runtime.rb, line 5 def gemfile(new_val = nil) @bext_gemfile ||= Bundler.default_gemfile @bext_gemfile = new_val unless new_val.nil? @bext_gemfile end
root()
click to toggle source
# File lib/bundler_ext/runtime.rb, line 11 def root gemfile.dirname.expand_path end
rubygems()
click to toggle source
# File lib/bundler_ext/runtime.rb, line 19 def rubygems @bundler_rubygems ||= Bundler::RubygemsIntegration.new end
setup_env()
click to toggle source
# File lib/bundler_ext/runtime.rb, line 24 def setup_env # some rubygems do not play well with daemonized processes ($HOME is empty) ENV['HOME'] = ENV['BEXT_HOME'] if ENV['BEXT_HOME'] ENV['HOME'] = ENV['BUNDLER_EXT_HOME'] if ENV['BUNDLER_EXT_HOME'] end
system_require(files)
click to toggle source
# File lib/bundler_ext/runtime.rb, line 36 def system_require(files) files.each do |dep| # this part also take from lib/bundler/runtime.rb (github/master) begin Output.verbose_msg "Attempting to require #{dep}" require dep rescue LoadError => err_regular begin namespaced_file = self.class.namespaced_file(dep) if namespaced_file.nil? Output.strict_err "Gem loading error: #{err_regular.message}" else Output.verbose_msg "Attempting to require #{namespaced_file}" require namespaced_file end rescue LoadError => err_namespaced Output.strict_err "Gem loading error: #{err_namespaced.message}" end end end end