Module: Indexer

Defined in:
lib/indexer.rb,
lib/indexer/error.rb,
lib/indexer/model.rb,
lib/indexer/valid.rb,
lib/indexer/command.rb,
lib/indexer/importer.rb,
lib/indexer/loadable.rb,
lib/indexer/metadata.rb,
lib/indexer/revision.rb,
lib/indexer/validator.rb,
lib/indexer/attributes.rb,
lib/indexer/conversion.rb,
lib/indexer/importer/file.rb,
lib/indexer/importer/ruby.rb,
lib/indexer/importer/yaml.rb,
lib/indexer/version/number.rb,
lib/indexer/importer/gemfile.rb,
lib/indexer/importer/gemspec.rb,
lib/indexer/importer/version.rb,
lib/indexer/components/author.rb,
lib/indexer/components/engine.rb,
lib/indexer/conversion/gemfile.rb,
lib/indexer/conversion/gemspec.rb,
lib/indexer/version/constraint.rb,
lib/indexer/version/exceptions.rb,
lib/indexer/components/conflict.rb,
lib/indexer/components/resource.rb,
lib/indexer/components/copyright.rb,
lib/indexer/components/dependency.rb,
lib/indexer/components/repository.rb,
lib/indexer/components/requirement.rb,
lib/indexer/components/organization.rb,
lib/indexer/conversion/gemspec_exporter.rb

Defined Under Namespace

Modules: Attributes, Conversion, Error, Loadable, Revision, Valid, Version Classes: Author, Command, Conflict, Copyright, Dependency, Engine, GemspecExporter, Importer, Metadata, Model, Organization, Repository, Requirement, Resource, ValidationError, Validator

Constant Summary collapse

NAME =

Name of this program.

'indexer'
REVISION =

Current stable revision of the specification (by year).

2013
LOCK_FILE =

File name of locked metadata file.

'.index'
USER_FILES =

Default metadata file name for use by end-developer.

'{Index,Indexfile,Metadata}{,.rb,.yml,.yaml}'
LIBDIR =

Indexer library directory.

File.dirname(__FILE__) + '/indexer'
DATADIR =

Indexer library directory.

File.dirname(__FILE__) + '/../data/indexer'

Class Method Summary collapse

Class Method Details

.attributesObject

Tracks supported attributes.



4
5
6
# File 'lib/indexer/attributes.rb', line 4

def self.attributes
  @attributes ||= []
end

.const_missing(const_name) ⇒ Object

Project metadata via RubyGems, fallback to index file.

TODO: The #to_s on the gemspec return value is a bit too simplistic. But how to fix? The goal is reduce the value to a basic type (String, Hash, Array, Numeric).



38
39
40
41
42
43
44
45
# File 'lib/indexer.rb', line 38

def self.const_missing(const_name)
  name = const_name.to_s.downcase
  begin
    Gem.loaded_specs[NAME].send(name).to_s
  rescue StandardError
    index[name] || super(const_name)
  end
end

.import(*sources) ⇒ Object

Import external sources into metadata.



5
6
7
# File 'lib/indexer/importer.rb', line 5

def self.import(*sources)
  Importer.import(*sources)
end

.indexObject

Metadata from the project's indexer.yml index file. This is used as a fallback for #const_missing.

Returns [Hash] of metadata.



24
25
26
27
28
29
30
31
# File 'lib/indexer.rb', line 24

def self.index
  @index ||= (
    require 'yaml'
    dir  = File.dirname(__FILE__)
    file = Dir[File.join(dir, "{#{NAME}.yml,../.index}")].first
    file ? YAML.load_file(file) : {}
  )
end