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
-
RUBY_PLATFORM_ARRAY =
private
# File 'lib/bundler/dependency.rb', line 93[Gem::Platform::RUBY].freeze
Class Method Summary
Instance Attribute Summary
- #current_env? ⇒ Boolean readonly
- #current_platform? ⇒ Boolean readonly
- #gemfile_dep? ⇒ Boolean readonly
- #gemspec_dev_dep? ⇒ Boolean readonly
- #should_include readonly
- #should_include? ⇒ Boolean readonly
- #specific? ⇒ Boolean readonly
::Gem::Dependency
- Inherited
Instance Method Summary
- #autorequire
- #branch
- #env
- #expanded_platforms
- #force_ruby_platform
-
#gem_platforms(valid_platforms)
Returns the platforms this dependency is valid for, in the same order as passed in the
valid_platforms
parameter. - #gemfile
- #git
- #github
- #glob
- #groups
- #path
- #platforms
- #ref
- #source
- #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 8
def initialize(name, version, = {}, &blk) type = ["type"] || :runtime super(name, version, type) @options = end
Instance Attribute Details
#current_env? ⇒ Boolean
(readonly)
[ GitHub ]
#current_platform? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 132
def current_platform? return true if platforms.empty? platforms.any? do |p| Bundler.current_ruby.send("#{p}?") end end
#gemfile_dep? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 117
def gemfile_dep? !gemspec_dev_dep? end
#gemspec_dev_dep? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 113
def gemspec_dev_dep? @gemspec_dev_dep ||= @options.fetch("gemspec_dev_dep", false) end
#should_include (readonly)
[ GitHub ]# File 'lib/bundler/dependency.rb', line 71
def should_include @should_include ||= @options.fetch("should_include", true) end
#should_include? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 109
def should_include? should_include && current_env? && current_platform? end
#specific? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/dependency.rb', line 145
def specific? super rescue NoMethodError requirement != ">= 0" end
Instance Method Details
#autorequire
[ GitHub ]# File 'lib/bundler/dependency.rb', line 87
def autorequire return @autorequire if defined?(@autorequire) @autorequire = Array(@options["require"] || []) if @options.key?("require") end
#branch
[ GitHub ]# File 'lib/bundler/dependency.rb', line 43
def branch return @branch if defined?(@branch) @branch = @options["branch"] end
#env
[ GitHub ]# File 'lib/bundler/dependency.rb', line 65
def env return @env if defined?(@env) @env = @options["env"] end
#expanded_platforms
[ GitHub ]# File 'lib/bundler/dependency.rb', line 105
def @expanded_platforms ||= platforms.filter_map {|pl| CurrentRuby::PLATFORM_MAP[pl] }.flatten.uniq end
#force_ruby_platform
[ GitHub ]# File 'lib/bundler/dependency.rb', line 81
def force_ruby_platform return @force_ruby_platform if defined?(@force_ruby_platform) @force_ruby_platform = @options["force_ruby_platform"] 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 98
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
#gemfile
[ GitHub ]# File 'lib/bundler/dependency.rb', line 75
def gemfile return @gemfile if defined?(@gemfile) @gemfile = @options["gemfile"] end
#git
[ GitHub ]# File 'lib/bundler/dependency.rb', line 31
def git return @git if defined?(@git) @git = @options["git"] end
#github
[ GitHub ]# File 'lib/bundler/dependency.rb', line 37
def github return @github if defined?(@github) @github = @options["github"] end
#glob
[ GitHub ]# File 'lib/bundler/dependency.rb', line 55
def glob return @glob if defined?(@glob) @glob = @options["glob"] end
#groups
[ GitHub ]# File 'lib/bundler/dependency.rb', line 15
def groups @groups ||= Array(@options["group"] || :default).map(&:to_sym) end
#path
[ GitHub ]# File 'lib/bundler/dependency.rb', line 25
def path return @path if defined?(@path) @path = @options["path"] end
#platforms
[ GitHub ]# File 'lib/bundler/dependency.rb', line 61
def platforms @platforms ||= Array(@options["platforms"]) end
#ref
[ GitHub ]# File 'lib/bundler/dependency.rb', line 49
def ref return @ref if defined?(@ref) @ref = @options["ref"] end
#source
[ GitHub ]# File 'lib/bundler/dependency.rb', line 19
def source return @source if defined?(@source) @source = @options["source"] end
#to_lock
[ GitHub ]# File 'lib/bundler/dependency.rb', line 139
def to_lock out = super out << "!" if source out end