Sha256: cd52aa543f032d6358d2bd84fb445e8d8136aa3cfa23abc841fe6e1c6887d042

Contents?: true

Size: 628 Bytes

Versions: 3

Compression:

Stored size: 628 Bytes

Contents

require 'active_support/json'

module ServiceTemplate
  class GemDependency
    def self.log_all
      ServiceTemplate::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

3 entries across 3 versions & 1 rubygems

Version Path
service_template-0.5.2 lib/service_template/gem_dependency.rb
service_template-0.5.1 lib/service_template/gem_dependency.rb
service_template-0.5.0 lib/service_template/gem_dependency.rb