BasicSpecification
is an abstract class which implements some common code used by both Specification and StubSpecification.
- A
- B
- C
- D
- E
- F
- G
- L
- M
- N
- P
- R
- S
- T
- V
Attributes
[RW] | loaded_from | The path this gemspec was loaded from. This attribute is not persisted. |
Class Public methods
default_specifications_dir() Link
new() Link
Instance Public methods
activated?() Link
True when the gem has been activated
base_dir() Link
Returns the full path to the base gem directory.
eg: /usr/local/lib/ruby/gems/1.8
contains_requirable_file?(file) Link
Return true if this spec can require file
.
# File ruby/lib/rubygems/basic_specification.rb, line 73 def contains_requirable_file?(file) if @ignored return false elsif missing_extensions? @ignored = true if platform == Gem::Platform::RUBY || Gem::Platform.local === platform warn "Ignoring #{full_name} because its extensions are not built. " \ "Try: gem pristine #{name} --version #{version}" end return false end is_soext = file.end_with?(".so", ".o") if is_soext have_file? file.delete_suffix(File.extname(file)), Gem.dynamic_library_suffixes else have_file? file, Gem.suffixes end end
datadir() Link
The path to the data directory for this gem.
default_gem?() Link
extension_dir() Link
Returns full path to the directory where gem’s extensions are installed.
extensions_dir() Link
Returns path to the extensions directory.
full_gem_path() Link
The full path to the gem (install path + full name).
full_name() Link
Returns the full name (name-version) of this Gem. Platform information is included (name-version-platform) if it is specified and not the default Ruby platform.
full_require_paths() Link
Full paths in the gem to add to $LOAD_PATH
when this gem is activated.
gem_dir() Link
Returns the full path to this spec’s gem directory. eg: /usr/local/lib/ruby/1.8/gems/mygem-1.0
gems_dir() Link
Returns the full path to the gems directory containing this spec’s gem directory. eg: /usr/local/lib/ruby/1.8/gems
lib_dirs_glob() Link
Returns a string usable in Dir.glob
to match all requirable paths for this spec.
# File ruby/lib/rubygems/basic_specification.rb, line 291 def lib_dirs_glob dirs = if raw_require_paths if raw_require_paths.size > 1 "{#{raw_require_paths.join(",")}}" else raw_require_paths.first end else "lib" # default value for require_paths for bundler/inline end "#{full_gem_path}/#{dirs}" end
matches_for_glob(glob) Link
Return all files in this gem that match for glob
.
name() Link
Name of the gem
platform() Link
Platform of the gem
plugins() Link
Returns the list of plugins in this spec.
require_paths() Link
Paths in the gem to add to $LOAD_PATH
when this gem is activated.
See also require_paths=
If you have an extension you do not need to add "ext"
to the require path, the extension build process will copy the extension files into “lib” for you.
The default value is "lib"
Usage:
# If all library files are in the root directory...
spec.require_path = '.'
source_paths() Link
Returns the paths to the source files for use with analysis and documentation tools. These paths are relative to full_gem_path.
stubbed?() Link
Whether this specification is stubbed - i.e. we have information about the gem from a stub line, without having to evaluate the entire gemspec file.
this() Link
to_fullpath(path) Link
Full path of the target library file. If the file is not in this gem, return nil.
# File ruby/lib/rubygems/basic_specification.rb, line 175 def to_fullpath(path) if activated? @paths_map ||= {} Gem.suffixes.each do |suf| full_require_paths.each do |dir| fullpath = "#{dir}/#{path}#{suf}" next unless File.file?(fullpath) @paths_map[path] ||= fullpath end end @paths_map[path] end end
to_spec() Link
Return a Gem::Specification
from this gem