Sha256: 7de3e3a2694b92573b576b364dcf4aa5f82ade43c2543f3728f13fb14bbc6934

Contents?: true

Size: 606 Bytes

Versions: 4

Compression:

Stored size: 606 Bytes

Contents

require 'active_support/json'

module Napa
  class GemDependency
    def self.log_all
      Napa::Logger.logger.info(gems: list_all.as_json)
    end

    def self.list_all
      Gem.loaded_specs.map { |spec| new(spec).to_hash }
    end

    def initialize(spec)
      @spec = spec[1]
    end

    def name
      @spec.name
    end

    def version
      @spec.version.to_s
    end

    def git_version
      @spec.git_version
    end

    def to_hash
      {}.tap do |h|
        h[:name] = name
        h[:version] = version
        h[:git_version] = git_version if git_version
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
napa-0.5.0 lib/napa/gem_dependency.rb
napa-0.4.3 lib/napa/gem_dependency.rb
napa-0.4.1 lib/napa/gem_dependency.rb
napa-0.4.0 lib/napa/gem_dependency.rb