lib/appraisal/gemspec.rb in appraisal-1.0.0.beta3 vs lib/appraisal/gemspec.rb in appraisal-1.0.0
- old
+ new
@@ -1,6 +1,6 @@
-require 'pathname'
+require 'appraisal/utils'
module Appraisal
class Gemspec
attr_reader :options
@@ -8,21 +8,22 @@
@options = options
@options[:path] ||= '.'
end
def to_s
- "gemspec #{exported_options.inspect.gsub(/^\{|\}$/, '')}"
+ "gemspec #{Utils.format_string(exported_options)}"
end
private
def exported_options
# Check to see if this is an absolute path
- if @options[:path] =~ /^(?:\/|\S:)/
+ if @options[:path] =~ /^(?:\/|\S:)/ || @options[:path] == '../'
@options
else
# Remove leading ./ from path, if any
- exported_path = ::File.join("..", @options[:path].sub(/^\.\/?/,''))
+ cleaned_path = @options[:path].gsub(/(^|\/)\.\/?/, '\1')
+ exported_path = ::File.join("..", cleaned_path)
@options.merge(:path => exported_path)
end
end
end
end