#!/usr/bin/env ruby require 'thor' $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) require 'savon' require 'soaspec' module Soaspec # Common executable for Soaspec class Exe < Thor include Soaspec::ExeHelpers desc 'soaspec [type]', 'Initialize soaspec repository' def init puts 'Creating files for soaspec' create_file(filename: 'Gemfile', content: gem_content) create_file(filename: 'Rakefile', content: rake_virtual_content) create_file(filename: 'README.md', content: readme_content) create_folder 'lib' create_file(filename: 'lib/blz_service.rb', content: weather_web_service) create_file filename: 'lib/shared_example.rb', content: shared_examples_content create_folder 'config' create_folder 'config/data' create_file(filename: 'config/data/default.yml', content: default_yaml_content) create_folder 'spec' create_folder 'spec/test_data' create_folder 'spec/test_data/wsdl' create_file(filename: 'spec/spec_helper.rb', content: spec_helper_content) create_file(filename: 'spec/soap_spec.rb', content: soap_spec_content) create_file(filename: 'spec/test_server.rb', content: test_server_content) create_file(filename: 'spec/test_data/wsdl/get_bank.wsdl', content: test_wsdl_content) create_folder 'template' create_file(filename: 'template/soap_template.xml', content: soap_template_content) create_folder 'logs' puts "Run 'bundle install' to install necessary gems" puts "Run 'rake spec' to run the tests" puts "Note: Setup runs Sinatra for Test Service on port 4567 by default. Change Rakefile 'start_test_server' task to update this" end end end Soaspec::Exe.start(ARGV)