Class: Gem::Specification
- Inherits:
-
Object
- Object
- Gem::Specification
show all
- Includes:
- Bundler::MatchPlatform
- Defined in:
- lib/bundler/resolver.rb,
lib/bundler/rubygems_ext.rb,
lib/bundler/rubygems_ext.rb
Constant Summary
Bundler::GemHelpers::GENERICS, Bundler::GemHelpers::GENERIC_CACHE
Instance Attribute Summary collapse
Instance Method Summary
collapse
#match_platform
#generic
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
15
16
17
|
# File 'lib/bundler/rubygems_ext.rb', line 15
def location
@location
end
|
#relative_loaded_from ⇒ Object
Returns the value of attribute relative_loaded_from.
15
16
17
|
# File 'lib/bundler/rubygems_ext.rb', line 15
def relative_loaded_from
@relative_loaded_from
end
|
#source ⇒ Object
Returns the value of attribute source.
15
16
17
|
# File 'lib/bundler/rubygems_ext.rb', line 15
def source
@source
end
|
Instance Method Details
#add_bundler_dependencies(*groups) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/bundler/rubygems_ext.rb', line 67
def add_bundler_dependencies(*groups)
Bundler.ui.warn "#add_bundler_dependencies is deprecated and will " \
"be removed in Bundler 1.0. Instead, please use the #gemspec method " \
"in your Gemfile, which will pull in any dependencies specified in " \
"your gemspec"
groups = [:default] if groups.empty?
Bundler.definition.dependencies.each do |dep|
if dep.groups.include?(:development)
self.add_development_dependency(dep.name, dep.requirement.to_s)
elsif (dep.groups & groups).any?
self.add_dependency(dep.name, dep.requirement.to_s)
end
end
end
|
#full_gem_path ⇒ Object
20
21
22
23
24
|
# File 'lib/bundler/rubygems_ext.rb', line 20
def full_gem_path
source.respond_to?(:path) ?
Pathname.new(loaded_from).dirname.expand_path.to_s :
rg_full_gem_path
end
|
#git_version ⇒ Object
46
47
48
49
50
51
|
# File 'lib/bundler/rubygems_ext.rb', line 46
def git_version
if @loaded_from && File.exist?(File.join(full_gem_path, ".git"))
sha = Dir.chdir(full_gem_path){ `git rev-parse HEAD`.strip }
" #{sha[0..6]}"
end
end
|
#groups ⇒ Object
42
43
44
|
# File 'lib/bundler/rubygems_ext.rb', line 42
def groups
@groups ||= []
end
|
#load_paths ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/bundler/rubygems_ext.rb', line 32
def load_paths
require_paths.map do |require_path|
if require_path.include?(full_gem_path)
require_path
else
File.join(full_gem_path, require_path)
end
end
end
|
#loaded_from ⇒ Object
26
27
28
29
30
|
# File 'lib/bundler/rubygems_ext.rb', line 26
def loaded_from
relative_loaded_from ?
source.path.join(relative_loaded_from).to_s :
rg_loaded_from
end
|
#nondevelopment_dependencies ⇒ Object
63
64
65
|
# File 'lib/bundler/rubygems_ext.rb', line 63
def nondevelopment_dependencies
dependencies - development_dependencies
end
|
#required_by ⇒ Object
11
12
13
|
# File 'lib/bundler/resolver.rb', line 11
def required_by
@required_by ||= []
end
|
#rg_full_gem_path ⇒ Object
17
|
# File 'lib/bundler/rubygems_ext.rb', line 17
alias_method :rg_full_gem_path, :full_gem_path
|
#rg_loaded_from ⇒ Object
18
|
# File 'lib/bundler/rubygems_ext.rb', line 18
alias_method :rg_loaded_from, :loaded_from
|
#to_gemfile(path = nil) ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'lib/bundler/rubygems_ext.rb', line 53
def to_gemfile(path = nil)
gemfile = "source :gemcutter\n"
gemfile << dependencies_to_gemfile(nondevelopment_dependencies)
unless development_dependencies.empty?
gemfile << "\n"
gemfile << dependencies_to_gemfile(development_dependencies, :development)
end
gemfile
end
|