instance method
Gem::RequestSet::GemDependencyAPI#gemspec
gemspec(options = {})
lib/rubygems/request_set/gem_dependency_api.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/rubygems/request_set/gem_dependency_api.rb, line 638
def gemspec(options = {})
name = options.delete(:name) || "{,*}"
path = options.delete(:path) || "."
development_group = options.delete(:development_group) || :development
spec = find_gemspec name, path
groups = gem_group spec.name, {}
self_dep = Gem::Dependency.new spec.name, spec.version
add_dependencies groups, [self_dep]
add_dependencies groups, spec.runtime_dependencies
@dependencies[spec.name] = Gem::Requirement.source_set
spec.dependencies.each do |dep|
@dependencies[dep.name] = dep.requirement
end
groups << development_group
add_dependencies groups, spec.development_dependencies
@vendor_set.add_vendor_gem spec.name, path
gem_requires spec.name, options
end
Loads dependencies from a gemspec file.
options include:
- name:
-
The name portion of the gemspec file. Defaults to searching for any gemspec file in the current directory.
Examplegemspec name: 'my_gem'
- path:
-
The path the gemspec lives in. Defaults to the current directory:
Examplegemspec 'my_gem', path: 'gemspecs', name: 'my_gem'
- development_group:
-
The group to add development dependencies to. By default this is :development. Only one group may be specified.