generators/handsoap/handsoap_generator.rb in troelskn-handsoap-0.3.6 vs generators/handsoap/handsoap_generator.rb in troelskn-handsoap-0.3.7
- old
+ new
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
require "#{File.dirname(__FILE__)}/../../lib/handsoap/parser.rb"
require "#{File.dirname(__FILE__)}/../../lib/handsoap/compiler.rb"
+require 'pathname'
# TODO
# options:
# soap_actions (true/false)
# soap_version (1/2/auto)
@@ -73,14 +74,10 @@
module Commands #:nodoc:
module Create
def file_contents(relative_destination, &block)
destination = destination_path(relative_destination)
temp_file = Tempfile.new("handsoap_generator")
- if RUBY_PLATFORM =~ /linux/
- canonical_path = `readlink -fn '#{source_path("/.")}'`
- else
- canonical_path = File.expand_path(source_path("/."))
- end
+ canonical_path = Pathname.new(source_path("/.")).realpath.to_s
temp_file_relative_path = relative_path(temp_file.path, canonical_path)
begin
yield temp_file
temp_file.close
return self.file(temp_file_relative_path, relative_destination)