lib/snapshot/snapshot_file.rb in snapshot-0.3.2 vs lib/snapshot/snapshot_file.rb in snapshot-0.3.3
- old
+ new
@@ -34,29 +34,26 @@
raise "scheme has to be an String".red unless value.kind_of?String
@config.manual_scheme = value
when :js_file
raise "js_file has to be an String".red unless value.kind_of?String
raise "js_file at path '#{value}' not found".red unless File.exists?value
- @config.manual_js_file = value.gsub("~", ENV['HOME'])
+ @config.manual_js_file = File.expand_path(value)
when :screenshots_path
raise "screenshots_path has to be an String".red unless value.kind_of?String
- @config.screenshots_path = value.gsub("~", ENV['HOME'])
- when :html_path
- raise "html_path has to be an String".red unless value.kind_of?String
- @config.html_path = value.gsub("~", ENV['HOME'])
- @config.html_path = @config.html_path + "/screenshots.html" unless @config.html_path.include?".html"
+ @config.screenshots_path = File.expand_path(value)
when :build_command
raise "build_command has to be an String".red unless value.kind_of?String
@config.build_command = value
when :skip_alpha_removal
@config.skip_alpha_removal = true
when :project_path
raise "project_path has to be an String".red unless value.kind_of?String
- if File.exists?value and (value.end_with?".xcworkspace" or value.end_with?".xcodeproj")
- @config.project_path = value.gsub("~", ENV['HOME'])
+ path = File.expand_path(value)
+ if File.exists?path and (path.end_with?".xcworkspace" or path.end_with?".xcodeproj")
+ @config.project_path = path
else
- raise "The given project_path '#{value}' could not be found. Make sure to include the extension as well.".red
+ raise "The given project_path '#{path}' could not be found. Make sure to include the extension as well.".red
end
# Blocks
when :setup_for_device_change, :teardown_device, :setup_for_language_change, :teardown_language
raise "#{method_sym} needs to have a block provided." unless block_given?
\ No newline at end of file