Sha256: 12f06330273a86e5fd1858206d3a8b1cefd2bddc531a525049748f5472d45509

Contents?: true

Size: 732 Bytes

Versions: 4

Compression:

Stored size: 732 Bytes

Contents

require 'pathname'

module Appraisal
  class Gemspec
    attr_reader :options

    def initialize(options = {})
      @options = options
      @options[:path] ||= '.'
    end

    def exists?
      Dir[::File.join(@options[:path], "*.gemspec")].size > 0
    end

    def to_s
      if exists?
        "gemspec #{exported_options.inspect.gsub(/^\{|\}$/, '')}"
      end
    end

    private

    def exported_options
      # Check to see if this is an absolute path
      if @options[:path] =~ /^(?:\/|\S:)/
        @options
      else
        # Remove leading ./ from path, if any
        exported_path = ::File.join("..", @options[:path].sub(/^\.\/?/,''))
        @options.merge(:path => exported_path)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/appraisal-0.5.1/lib/appraisal/gemspec.rb
appraisal-0.5.2 lib/appraisal/gemspec.rb
appraisal-0.5.1 lib/appraisal/gemspec.rb
appraisal-0.5.0 lib/appraisal/gemspec.rb