Sha256: ebebce02a3bfb05d9a51e0dc42b25f710e71062a531141328efd36da997fe708

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

module Indexer

  class Importer

    # It is not the recommended that a .gemspec be the usual source of metadata.
    # Rather it is recommended that a the gemspec be produced from the metadata
    # instead. (Rumber's metadata covers almost every aspect of a emspec, and
    # a gemspec can be augmented where needed.) Nonetheless, a gemspec can serve
    # as a good soruce for creating an initial metadata file.
    #
    module GemspecImportation

      #
      # If the source file is a gemspec, import it.
      #
      def import(source)
        case File.extname(source)
        when '.gemspec'
          # TODO: handle YAML-based gemspecs
          gemspec = ::Gem::Specification.load(source)
          metadata.import_gemspec(gemspec)
          true
        else
          super(source) if defined?(super)
        end
      end

      #
      #def local_files(root, glob, *flags)
      #  bits = flags.map{ |f| File.const_get("FNM_#{f.to_s.upcase}") }
      #  files = Dir.glob(File.join(root,glob), bits)
      #  files = files.map{ |f| f.sub(root,'') }
      #  files
      #end
    end

    # Include GemspecImportation mixin into Builder class.
    include GemspecImportation

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
indexer-0.3.1 lib/indexer/importer/gemspec.rb
indexer-0.3.0 lib/indexer/importer/gemspec.rb
indexer-0.2.0 lib/indexer/importer/gemspec.rb
indexer-0.1.0 lib/indexer/importer/gemspec.rb