lib/appraisal/gemspec.rb in appraisal-0.3.3 vs lib/appraisal/gemspec.rb in appraisal-0.3.4

- old
+ new

@@ -4,20 +4,30 @@ class Gemspec attr_reader :options def initialize(options = {}) @options = options - - # figure out the right path for the gemspec @options[:path] ||= '.' - @options[:path] = ::File.expand_path(@options[:path]) end def exists? Dir[::File.join(@options[:path], "*.gemspec")].size > 0 end def to_s - "gemspec #{@options.inspect.gsub(/^\{|\}$/, '')}" if exists? + "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