Sha256: 7a8a91fc507b1f77870476da3f277d6dcc9106ae547edd6cdcd8a88492145c9e

Contents?: true

Size: 497 Bytes

Versions: 2

Compression:

Stored size: 497 Bytes

Contents

require 'delegate'
module Pumper
  class Specification < SimpleDelegator
    def initialize(gemspec)
      specification = File.read(gemspec_file(gemspec))
      super(eval(specification))
    end

    def for_gemfile
      "gem '#{ name }', '~> #{ version }'"
    end

    def gem_file_name
      "#{ name }-#{ version }.gem"
    end

    def version
      super.to_s
    end

    private

    def gemspec_file(gemspec)
      gemspec || File.join(Dir.pwd, Dir.glob('*.gemspec'))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pumper-1.0.1 lib/pumper/specification.rb
pumper-0.0.1 lib/pumper/specification.rb