| LEFT | RIGHT |
| 1 #!/usr/bin/ruby1.8 -w | 1 #!/usr/bin/ruby1.8 -w |
| 2 # | 2 # |
| 3 # Copyright:: Copyright 2009 Google Inc. | 3 # Copyright:: Copyright 2009 Google Inc. |
| 4 # Original Author:: Ryan Brown (mailto:ribrdb@google.com) | 4 # Original Author:: Ryan Brown (mailto:ribrdb@google.com) |
| 5 # | 5 # |
| 6 # Licensed under the Apache License, Version 2.0 (the "License"); | 6 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 # you may not use this file except in compliance with the License. | 7 # you may not use this file except in compliance with the License. |
| 8 # You may obtain a copy of the License at | 8 # You may obtain a copy of the License at |
| 9 # | 9 # |
| 10 # http://www.apache.org/licenses/LICENSE-2.0 | 10 # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 # | 11 # |
| 12 # Unless required by applicable law or agreed to in writing, software | 12 # Unless required by applicable law or agreed to in writing, software |
| 13 # distributed under the License is distributed on an "AS IS" BASIS, | 13 # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 # See the License for the specific language governing permissions and | 15 # See the License for the specific language governing permissions and |
| 16 # limitations under the License. | 16 # limitations under the License. |
| 17 | 17 |
| 18 require 'appengine-tools/web-xml' | 18 require 'appengine-tools/web-xml' |
| 19 require 'appengine-tools/rack' | 19 require 'appengine-tools/rack' |
| 20 require 'appengine-tools/xml-formatter' |
| 20 | 21 |
| 21 Dir.mkdir('WEB-INF') unless File.exists?('WEB-INF') | 22 Dir.mkdir('WEB-INF') unless File.exists?('WEB-INF') |
| 22 rackup = File.read('config.ru') | 23 rackup = File.read('config.ru') |
| 23 builder = WebXmlBuilder.new do | 24 builder = WebXmlBuilder.new do |
| 24 eval rackup, nil, 'config.ru', 1 | 25 eval rackup, nil, 'config.ru', 1 |
| 25 end | 26 end |
| 26 builder.write | 27 open('WEB-INF/web.xml', 'w') do |webxml| |
| 28 xml = AppEngine::Rack::XmlFormatter.format(builder.to_xml) |
| 29 webxml.write(xml) |
| 30 end |
| 27 open('WEB-INF/appengine-web.xml', 'w') do |aeweb| | 31 open('WEB-INF/appengine-web.xml', 'w') do |aeweb| |
| 28 aeweb.write(AppEngine::Rack.app.to_xml) | 32 xml = AppEngine::Rack::XmlFormatter.format(AppEngine::Rack.app.to_xml) |
| 33 aeweb.write(xml) |
| 29 end | 34 end |
| LEFT | RIGHT |