Sha256: f52f52670de5cc2bef199923ec1add9fc5321a80e345f25e3da17b825e4330e8
Contents?: true
Size: 908 Bytes
Versions: 3
Compression:
Stored size: 908 Bytes
Contents
class Require class << self attr_accessor :path_to_gems end def self.files_in(path) files = files_for(path) raise ArgumentError.new("no files found in #{path}") if files.empty? files.each do |file| require file end end def self.unpacked_gem(*gem_names) gem_names.each { |gem| require_unpacked_gem(gem) } end def self.require_unpacked_gem(gem) raise ArgumentError.new("unpacked gem #{gem} could not be found") if gem_path(gem).empty? gem_path(gem).each do |dir| add_load_path "#{dir}/lib" require dir + "/lib/#{gem}" if File.exist?(dir + "/lib/#{gem}.rb") end end def self.files_for(path) Dir["#{RAILS_ROOT}/#{path}/*"] end def self.gem_path(gem) return Dir[path_to_gems + "#{gem}*"] if path_to_gems Dir[RAILS_ROOT + "/vendor/gems/#{gem}*"] end def self.add_load_path(path) $: << path end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
thoughtful-0.0.7 | lib/thoughtful/require.rb |
thoughtful-0.0.6 | lib/thoughtful/require.rb |
thoughtful-0.0.8 | lib/thoughtful/require.rb |