Sha256: 48df0f9a3cde21317b49c0ab5f1a1c6d67f7d7cdfb98fb148b7ddf501711c065

Contents?: true

Size: 714 Bytes

Versions: 7

Compression:

Stored size: 714 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
      "gemspec #{exported_options.inspect.gsub(/^\{|\}$/, '')}" if exists?
    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

7 entries across 7 versions & 1 rubygems

Version Path
appraisal-0.4.1 lib/appraisal/gemspec.rb
appraisal-0.4.0 lib/appraisal/gemspec.rb
appraisal-0.3.8 lib/appraisal/gemspec.rb
appraisal-0.3.7 lib/appraisal/gemspec.rb
appraisal-0.3.6 lib/appraisal/gemspec.rb
appraisal-0.3.5 lib/appraisal/gemspec.rb
appraisal-0.3.4 lib/appraisal/gemspec.rb