lib/soaspec/exe_helpers.rb in soaspec-0.1.0 vs lib/soaspec/exe_helpers.rb in soaspec-0.1.1
- old
+ new
@@ -1,57 +1,57 @@
-
-require 'fileutils'
-module Soaspec
- # Help with tasks common to soaspec executables
- module ExeHelpers
-
- # Spec task string depending upon whether virtual is used
- def spec_task
- task_name = options[:virtual] ? 'spec: :start_test_server' : ':spec'
- "RSpec::Core::RakeTask.new(#{task_name}) do |t|"
- end
-
- # Retrieve default file contents based on filename
- def retrieve_contents(filename, erb)
- default_file = File.join(File.dirname(__FILE__), 'generator', filename + (erb ? '.erb' : ''))
- contents = File.read(default_file)
- erb ? ERB.new(contents).result(binding) : contents
- end
-
- # @param [String] filename Name of the file to create
- # @param [String] content Content to place inside file
- def create_file(filename: nil, content: nil, ignore_if_present: false, erb: true)
- raise 'Need to pass filename' unless filename
- content ||= retrieve_contents(filename, erb)
- if File.exist? filename
- old_content = File.read(filename)
- if old_content != content && !ignore_if_present
- warn "!! #{filename} already exists and differs from template"
- end
- else
- File.open(filename, 'w') { |f| f.puts content }
- puts 'Created: ' + filename
- end
- end
-
- def create_folder(folder)
- if File.exist? folder
- warn "!! #{folder} already exists and is not a directory" unless File.directory? folder
- else
- FileUtils.mkdir folder
- puts "Created folder: #{folder}/"
- end
- end
-
- # Create class representing wsdl in general
- def class_content
- ERB.new(File.read(File.join(File.dirname(__FILE__), 'generator', 'lib/dynamic_class_content.rb.erb'))).result(binding)
- end
-
- # Create a spec for an WSDL operation
- # @param [String] operation Used in ERB to create a test for a WSDL operation
- def generated_soap_spec_for(operation)
- ERB.new(File.read(File.join(File.dirname(__FILE__), 'generator', 'spec/dynamic_soap_spec.rb.erb'))).result(binding)
- end
-
- end
+
+require 'fileutils'
+module Soaspec
+ # Help with tasks common to soaspec executables
+ module ExeHelpers
+
+ # Spec task string depending upon whether virtual is used
+ def spec_task
+ task_name = options[:virtual] ? 'spec: :start_test_server' : ':spec'
+ "RSpec::Core::RakeTask.new(#{task_name}) do |t|"
+ end
+
+ # Retrieve default file contents based on filename
+ def retrieve_contents(filename, erb)
+ default_file = File.join(File.dirname(__FILE__), 'generator', filename + (erb ? '.erb' : ''))
+ contents = File.read(default_file)
+ erb ? ERB.new(contents).result(binding) : contents
+ end
+
+ # @param [String] filename Name of the file to create
+ # @param [String] content Content to place inside file
+ def create_file(filename: nil, content: nil, ignore_if_present: false, erb: true)
+ raise 'Need to pass filename' unless filename
+ content ||= retrieve_contents(filename, erb)
+ if File.exist? filename
+ old_content = File.read(filename)
+ if old_content != content && !ignore_if_present
+ warn "!! #{filename} already exists and differs from template"
+ end
+ else
+ File.open(filename, 'w') { |f| f.puts content }
+ puts 'Created: ' + filename
+ end
+ end
+
+ def create_folder(folder)
+ if File.exist? folder
+ warn "!! #{folder} already exists and is not a directory" unless File.directory? folder
+ else
+ FileUtils.mkdir folder
+ puts "Created folder: #{folder}/"
+ end
+ end
+
+ # Create class representing wsdl in general
+ def class_content
+ ERB.new(File.read(File.join(File.dirname(__FILE__), 'generator', 'lib/dynamic_class_content.rb.erb'))).result(binding)
+ end
+
+ # Create a spec for an WSDL operation
+ # @param [String] operation Used in ERB to create a test for a WSDL operation
+ def generated_soap_spec_for(operation)
+ ERB.new(File.read(File.join(File.dirname(__FILE__), 'generator', 'spec/dynamic_soap_spec.rb.erb'))).result(binding)
+ end
+
+ end
end
\ No newline at end of file