lib/soaspec/exe_helpers.rb in soaspec-0.1.3 vs lib/soaspec/exe_helpers.rb in soaspec-0.1.4

- old
+ new

@@ -20,10 +20,11 @@ # @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) + create_folder File.split(filename).first 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 @@ -31,14 +32,17 @@ File.open(filename, 'w') { |f| f.puts content } puts 'Created: ' + filename end end + # Create folder if there's not a file already there. + # Will create parent folder if necessary. + # @param [String] folder Folder to create 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 + FileUtils.mkdir_p folder puts "Created folder: #{folder}/" end end # Create class representing wsdl in general \ No newline at end of file