Class: Bundler::Dependency
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::Gem::Dependency
|
|
Instance Chain:
|
|
Inherits: |
Gem::Dependency
|
Defined in: | lib/bundler/dependency.rb |
Constant Summary
-
ALL_RUBY_VERSIONS =
# File 'lib/bundler/dependency.rb', line 12(18..27).to_a.concat((30..34).to_a).freeze
-
PLATFORM_MAP =
# File 'lib/bundler/dependency.rb', line 13{ ruby: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], mri: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], rbx: [Gem::Platform::RUBY], truffleruby: [Gem::Platform::RUBY], jruby: [Gem::Platform::JAVA, [18, 19]], windows: [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS], # deprecated mswin: [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS], mswin64: [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]], mingw: [Gem::Platform::MINGW, ALL_RUBY_VERSIONS], x64_mingw: [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]], }.each_with_object({}) do |(platform, spec), hash| hash[platform] = spec[0] spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] } end.freeze
-
RUBY_PLATFORM_ARRAY =
private
# File 'lib/bundler/dependency.rb', line 52[Gem::Platform::RUBY].freeze
Class Method Summary
Instance Attribute Summary
- #autorequire readonly
- #branch readonly
- #current_env? ⇒ Boolean readonly
- #current_platform? ⇒ Boolean readonly
- #gemfile readonly
- #gemspec_dev_dep? ⇒ Boolean readonly
- #git readonly
- #github readonly
- #glob readonly
- #groups readonly
- #path readonly
- #platforms readonly
- #ref readonly
- #should_include? ⇒ Boolean readonly
- #specific? ⇒ Boolean readonly
::Gem::Dependency
- Inherited
Instance Method Summary
- #expanded_platforms
-
#gem_platforms(valid_platforms)
Returns the platforms this dependency is valid for, in the same order as passed in the
valid_platforms
parameter. - #to_lock
::Gem::Dependency
- Inherited
::Gem::Dependency::FilterIgnoredSpecs
- Included
ForcePlatform
- Included
#default_force_ruby_platform | The |
Constructor Details
.new(name, version, options = {}, &blk) ⇒ Dependency
# File 'lib/bundler/dependency.rb', line 30
def initialize(name, version, = {}, &blk) type = ["type"] || :runtime super(name, version, type) @autorequire = nil @groups = Array( ["group"] || :default).map(&:to_sym) @source = ["source"] @path = ["path"] @git = ["git"] @github = ["github"] @branch = ["branch"] @ref = ["ref"] @glob = ["glob"] @platforms = Array( ["platforms"]) @env = ["env"] @should_include = .fetch("should_include", true) @gemfile = ["gemfile"] @force_ruby_platform = ["force_ruby_platform"] if .key?("force_ruby_platform") @autorequire = Array( ["require"] || []) if .key?("require") end
Instance Attribute Details
#autorequire (readonly)
[ GitHub ]# File 'lib/bundler/dependency.rb', line 9
attr_reader :autorequire
#branch (readonly)
[ GitHub ]
#current_env? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 76
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
#current_platform? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 87
def current_platform? return true if @platforms.empty? @platforms.any? do |p| Bundler.current_ruby.send("#{p}?") end end
#gemfile (readonly)
[ GitHub ]
#gemspec_dev_dep? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 72
def gemspec_dev_dep? type == :development end
#git (readonly)
[ GitHub ]#github (readonly)
[ GitHub ]#glob (readonly)
[ GitHub ]#groups (readonly)
[ GitHub ]#path (readonly)
[ GitHub ]#platforms (readonly)
[ GitHub ]#ref (readonly)
[ GitHub ]
#should_include? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 68
def should_include? @should_include && current_env? && current_platform? end
#specific? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 100
def specific? super rescue NoMethodError requirement != ">= 0" end
Instance Method Details
#expanded_platforms
[ GitHub ]# File 'lib/bundler/dependency.rb', line 64
def @expanded_platforms ||= @platforms.filter_map {|pl| PLATFORM_MAP[pl] }.flatten.uniq end
#gem_platforms(valid_platforms)
Returns the platforms this dependency is valid for, in the same order as passed in the valid_platforms
parameter
# File 'lib/bundler/dependency.rb', line 57
def gem_platforms(valid_platforms) return RUBY_PLATFORM_ARRAY if force_ruby_platform return valid_platforms if @platforms.empty? valid_platforms.select {|p| .include?(GemHelpers.generic(p)) } end
#to_lock
[ GitHub ]# File 'lib/bundler/dependency.rb', line 94
def to_lock out = super out << "!" if source out end