lib/soaspec/exe_helpers.rb in soaspec-0.1.14 vs lib/soaspec/exe_helpers.rb in soaspec-0.1.15

- old
+ new

@@ -7,22 +7,25 @@ # Create files in project depending on type of project # @param [String] type Type of project to create, e.g., 'soap', 'rest' def create_files_for(type) case type when 'soap' - create_file filename: 'lib/blz_service.rb' - create_file filename: 'lib/shared_example.rb' + create_files %w[lib/blz_service.rb lib/shared_example.rb spec/soap_spec.rb] create_file(filename: 'template/soap_template.xml', erb: false) - create_file(filename: 'spec/soap_spec.rb') when 'rest' - create_file(filename: 'spec/rest_spec.rb') - create_file(filename: 'lib/package_service.rb') + create_files %w[spec/rest_spec.rb lib/package_service.rb] else # TODO: This needs to have placeholders explaining what to fill in end end + # @param [Array] filenames List of files to create + def create_files(filenames) + raise ArgumentError, 'Expected filenames to be an Array' unless filenames.is_a? Array + filenames.each { |name| create_file filename: name } + end + # 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 @@ -61,10 +64,10 @@ FileUtils.mkdir_p folder puts "Created folder: #{folder}/" end end - # Create class representing wsdl in general + # @return [String] 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 \ No newline at end of file