Sha256: 9bbe135429249ec1ec55a5cad4fd79d3c5b4abc4cf880f61227f15bb16b7db3d
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
require 'sinatra' module Soaspec # Server for generating code class GenerateServer < Sinatra::Application include Soaspec::ExeHelpers class << self # @return [Hash] Parameters used when creating handler attr_accessor :create_params end set :port, (ENV['port'] || 8999).to_i get '/css/bootstrap.css' do [200, { 'Content-Type' => 'text/css' }, retrieve_contents('css/bootstrap.css', false)] end get '/' do GenerateServer.create_params ||= {} puts GenerateServer.create_params retrieve_contents('generate_exchange.html') end post '/generate' do type = :rest # SOAP will be added to later @name = params['className'] @base_url = params['baseUrl'] filename = File.join('lib', "#{params['className'].snakecase}.rb") feedback = create_file filename: filename, content: retrieve_contents(File.join('lib', "new_#{type}_service.rb")) GenerateServer.create_params = params GenerateServer.create_params['feedback'] = feedback redirect '/' end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
soaspec-0.2.23 | lib/soaspec/generate_server.rb |
soaspec-0.2.22 | lib/soaspec/generate_server.rb |
soaspec-0.2.21 | lib/soaspec/generate_server.rb |
soaspec-0.2.20 | lib/soaspec/generate_server.rb |