class Bundler::Dependency
def current_env?
def current_env? return true unless @env if @env.is_a?(Hash) @env.all? do |key, val| ENV[key.to_s] && (val.is_a?(String) ? ENV[key.to_s] == val : ENV[key.to_s] =~ val) end else ENV[@env.to_s] end end
def current_platform?
def current_platform? return true if @platforms.empty? @platforms.any? { |p| Bundler.current_ruby.send("#{p}?") } end
def gem_platforms(valid_platforms)
def gem_platforms(valid_platforms) return valid_platforms if @platforms.empty? platforms = [] @platforms.each do |p| platform = PLATFORM_MAP[p] next unless valid_platforms.include?(platform) platforms |= [platform] end platforms end
def initialize(name, version, options = {}, &blk)
def initialize(name, version, options = {}, &blk) type = options["type"] || :runtime super(name, version, type) @autorequire = nil @groups = Array(options["group"] || :default).map { |g| g.to_sym } @source = options["source"] @platforms = Array(options["platforms"]) @env = options["env"] if options.key?('require') @autorequire = Array(options['require'] || []) end end
def should_include?
def should_include? current_env? && current_platform? end
def specific?
def specific? super rescue NoMethodError requirement != ">= 0" end
def to_lock
def to_lock out = super out << '!' if source out << "\n" end