Sha256: d0dc73ec6674e1ab9e4422574248921d121414cf31c6e567c992efaed671d43e
Contents?: true
Size: 1.99 KB
Versions: 11
Compression:
Stored size: 1.99 KB
Contents
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
Version data entries
11 entries across 11 versions & 1 rubygems