appengine-tools 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/lib/appengine-tools/appcfg.rb +22 -87
- data/lib/appengine-tools/boot.rb +1 -2
- data/lib/appengine-tools/bundler.rb +60 -31
- data/lib/appengine-tools/dev_appserver.rb +5 -0
- data/lib/appengine-tools/gem_bundler.rb +110 -0
- data/lib/appengine-tools/update_check.rb +11 -12
- data/lib/appengine-tools/web-xml.rb +10 -3
- metadata +30 -9
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'date'
|
|
5
5
|
require 'spec/rake/spectask'
|
6
6
|
|
7
7
|
GEM = "appengine-tools"
|
8
|
-
GEM_VERSION = "0.0.
|
8
|
+
GEM_VERSION = "0.0.5"
|
9
9
|
AUTHOR = "Ryan Brown"
|
10
10
|
EMAIL = "ribrdb@gmail.com"
|
11
11
|
HOMEPAGE = "http://code.google.com/p/appengine-jruby"
|
@@ -29,6 +29,8 @@ spec = Gem::Specification.new do |s|
|
|
29
29
|
s.add_dependency('appengine-rack')
|
30
30
|
s.add_dependency('appengine-sdk')
|
31
31
|
s.add_dependency('appengine-jruby-jars')
|
32
|
+
s.add_dependency('bundler', ["0.6.0"])
|
33
|
+
s.add_dependency('rubyzip')
|
32
34
|
end
|
33
35
|
|
34
36
|
task :default => :spec
|
@@ -27,9 +27,6 @@ module AppEngine
|
|
27
27
|
import Java.ComGoogleAppengineToolsAdmin.AppAdminFactory
|
28
28
|
import Java.ComGoogleAppengineToolsAdmin.AppVersionUpload
|
29
29
|
import Java.ComGoogleAppengineToolsUtil.Logging
|
30
|
-
import java.io.FileOutputStream
|
31
|
-
import java.util.jar.JarOutputStream
|
32
|
-
import java.util.zip.ZipEntry
|
33
30
|
|
34
31
|
class JRubyAppVersionUpload < AppVersionUpload
|
35
32
|
def initialize(connection, app)
|
@@ -76,13 +73,12 @@ module AppEngine
|
|
76
73
|
end
|
77
74
|
|
78
75
|
class JRubyAppCfg
|
79
|
-
NO_XML_COMMANDS =
|
80
|
-
RUBY_COMMANDS =
|
76
|
+
NO_XML_COMMANDS = %w{version}
|
77
|
+
RUBY_COMMANDS = %w{gem bundle help run}
|
81
78
|
COMMAND_SUMMARY = <<EOF
|
82
79
|
run: run jruby in your application environment.
|
83
|
-
gem: run rubygems for your application.
|
84
80
|
bundle: package your application for deployment.
|
85
|
-
The '
|
81
|
+
The 'run' command assumes the app directory is the current directory.
|
86
82
|
EOF
|
87
83
|
class << self
|
88
84
|
def main(args)
|
@@ -91,7 +87,7 @@ EOF
|
|
91
87
|
send(command, *parsed_args)
|
92
88
|
return
|
93
89
|
end
|
94
|
-
if command && !
|
90
|
+
if command && !NO_XML_COMMANDS.include?(command)
|
95
91
|
path = parsed_args[0]
|
96
92
|
AppEngine::Admin.bundle_app(path)
|
97
93
|
AppEngine::Development.boot_jruby
|
@@ -100,7 +96,7 @@ EOF
|
|
100
96
|
else
|
101
97
|
AppEngine::Development.boot_jruby
|
102
98
|
end
|
103
|
-
puts "
|
99
|
+
puts "=> Running AppCfg"
|
104
100
|
run_appcfg(args)
|
105
101
|
end
|
106
102
|
|
@@ -111,98 +107,38 @@ EOF
|
|
111
107
|
AppCfg.new(factory, args.to_java(java.lang.String))
|
112
108
|
end
|
113
109
|
|
114
|
-
def bundle(
|
115
|
-
|
110
|
+
def bundle(*args)
|
111
|
+
if File.directory?(args[-1] || '')
|
112
|
+
AppEngine::Admin.bundle_app(*args)
|
113
|
+
else
|
114
|
+
bundle_help
|
115
|
+
end
|
116
116
|
end
|
117
117
|
|
118
118
|
def bundle_help
|
119
119
|
help = <<EOF
|
120
|
-
#{$0} bundle app_dir
|
120
|
+
#{$0} bundle [gem bundle options] app_dir
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
need to run it manually
|
122
|
+
Bundles the gems listed in Gemfile and generates files necessary
|
123
|
+
to run an application as a servlet. This runs automatically for you,
|
124
|
+
but you need to run it manually to update gems if you don't specify
|
125
|
+
a version number. Pass --update to refresh bundled gems.
|
125
126
|
|
126
127
|
EOF
|
127
128
|
end
|
128
|
-
|
129
|
+
|
129
130
|
def gem(*args)
|
130
|
-
|
131
|
-
AppEngine::Development.boot_jruby
|
132
|
-
puts "=> Running RubyGems"
|
133
|
-
require 'rubygems'
|
134
|
-
require 'rubygems/command_manager'
|
135
|
-
Gem.configuration = Gem::ConfigFile.new(args)
|
136
|
-
Gem.use_paths('.gems')
|
137
|
-
Gem::Command.add_specific_extra_args(
|
138
|
-
'install', %w(--no-rdoc --no-ri))
|
139
|
-
saved_gems = all_gem_specs
|
140
|
-
begin
|
141
|
-
Gem::CommandManager.instance.run(Gem.configuration.args)
|
142
|
-
rescue Gem::SystemExitException => e
|
143
|
-
exit e.exit_code unless e.exit_code == 0
|
144
|
-
end
|
145
|
-
unless ((all_gem_specs == saved_gems) &&
|
146
|
-
File.exist?('WEB-INF/lib/gems.jar'))
|
147
|
-
Dir.mkdir 'WEB-INF' unless File.exists? 'WEB-INF'
|
148
|
-
Dir.mkdir 'WEB-INF/lib' unless File.exists? 'WEB-INF/lib'
|
149
|
-
Dir.chdir '.gems'
|
150
|
-
puts '=> Packaging gems'
|
151
|
-
write_jar('../WEB-INF/lib/gems.jar') do |jar|
|
152
|
-
add_to_jar('gems', jar)
|
153
|
-
add_to_jar('specifications', jar)
|
154
|
-
end
|
155
|
-
puts 'If you upgraded any gems, please run `appcfg.rb gem cleanup`'
|
156
|
-
puts 'to remove the old versions.'
|
157
|
-
end
|
131
|
+
gem_help
|
158
132
|
end
|
159
133
|
|
160
134
|
def gem_help
|
161
135
|
help = <<EOF
|
162
|
-
#{$0} gem [rubygems arguments]
|
163
|
-
|
164
136
|
|
165
|
-
|
166
|
-
|
137
|
+
Sorry, the 'appcfg.rb gem' option is deprecated.
|
138
|
+
Simply update the 'Gemfile' and run 'appcfg.rb bundle .' instead.
|
167
139
|
|
168
140
|
EOF
|
169
|
-
|
170
|
-
|
171
|
-
def all_gem_specs
|
172
|
-
Gem.source_index.map do |_, spec|
|
173
|
-
spec
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
def write_jar(filename)
|
178
|
-
filename = File.expand_path(filename)
|
179
|
-
jar = JarOutputStream.new(FileOutputStream.new(filename))
|
180
|
-
begin
|
181
|
-
yield jar
|
182
|
-
ensure
|
183
|
-
jar.close
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
def add_to_jar(path, jar)
|
188
|
-
directory = File.directory?(path)
|
189
|
-
if directory
|
190
|
-
path << '/'
|
191
|
-
end
|
192
|
-
entry = ZipEntry.new(path)
|
193
|
-
jar.put_next_entry(entry)
|
194
|
-
unless directory
|
195
|
-
data = IO.read(path)
|
196
|
-
jar.write(data.to_java_bytes, 0, data.size)
|
197
|
-
end
|
198
|
-
jar.close_entry
|
199
|
-
if directory
|
200
|
-
Dir.entries(path).each do |filename|
|
201
|
-
unless ['.', '..'].include?(filename)
|
202
|
-
add_to_jar(path + filename, jar)
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
141
|
+
puts help
|
206
142
|
end
|
207
143
|
|
208
144
|
def run(*args)
|
@@ -214,7 +150,6 @@ EOF
|
|
214
150
|
help = <<EOF
|
215
151
|
#{$0} run [ruby args]
|
216
152
|
|
217
|
-
|
218
153
|
Starts the jruby interpreter within your application's environment.
|
219
154
|
Use `#{$0} run -S command` to run a command such as rake or irb.
|
220
155
|
Must be run from the application directory, after running bundle.
|
@@ -265,4 +200,4 @@ EOF
|
|
265
200
|
end
|
266
201
|
end
|
267
202
|
end
|
268
|
-
end
|
203
|
+
end
|
data/lib/appengine-tools/boot.rb
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
|
18
18
|
require 'appengine-rack'
|
19
19
|
require 'appengine-tools/boot'
|
20
|
+
require 'appengine-tools/gem_bundler'
|
20
21
|
require 'appengine-tools/web-xml'
|
21
22
|
require 'appengine-tools/xml-formatter'
|
22
23
|
require 'fileutils'
|
@@ -35,43 +36,63 @@ module AppEngine
|
|
35
36
|
def path(*pieces)
|
36
37
|
File.join(@root, *pieces)
|
37
38
|
end
|
38
|
-
|
39
|
+
|
39
40
|
def webinf
|
40
41
|
path('WEB-INF')
|
41
42
|
end
|
42
|
-
|
43
|
+
|
43
44
|
def webinf_lib
|
44
45
|
path('WEB-INF', 'lib')
|
45
46
|
end
|
46
|
-
|
47
|
+
|
48
|
+
def gems_jar
|
49
|
+
path('WEB-INF', 'lib', 'gems.jar')
|
50
|
+
end
|
51
|
+
|
47
52
|
def generation_dir
|
48
53
|
path('WEB-INF', 'appengine-generated')
|
49
54
|
end
|
50
55
|
|
56
|
+
def gems_dir
|
57
|
+
path('.gems')
|
58
|
+
end
|
59
|
+
|
60
|
+
def gemfile
|
61
|
+
path('Gemfile')
|
62
|
+
end
|
63
|
+
|
51
64
|
def config_ru
|
52
65
|
path('config.ru')
|
53
66
|
end
|
54
|
-
|
67
|
+
|
55
68
|
def web_xml
|
56
69
|
path('WEB-INF', 'web.xml')
|
57
70
|
end
|
58
|
-
|
71
|
+
|
59
72
|
def aeweb_xml
|
60
73
|
path('WEB-INF', 'appengine-web.xml')
|
61
74
|
end
|
62
|
-
|
75
|
+
|
63
76
|
def build_status
|
64
77
|
path('WEB-INF', 'appengine-generated', 'build_status.yaml')
|
65
78
|
end
|
66
|
-
|
79
|
+
|
67
80
|
def public_root
|
68
81
|
path(AppEngine::Rack.app.public_root) if AppEngine::Rack.app.public_root
|
69
82
|
end
|
70
|
-
|
83
|
+
|
84
|
+
def favicon_ico
|
85
|
+
File.join(public_root ? public_root : @root, 'favicon.ico')
|
86
|
+
end
|
87
|
+
|
88
|
+
def robots_txt
|
89
|
+
File.join(public_root ? public_root : @root, 'robots.txt')
|
90
|
+
end
|
91
|
+
|
71
92
|
def rack_app
|
72
93
|
AppEngine::Rack.app
|
73
94
|
end
|
74
|
-
|
95
|
+
|
75
96
|
end
|
76
97
|
|
77
98
|
class AppBundler
|
@@ -79,8 +100,7 @@ module AppEngine
|
|
79
100
|
EXISTING_RACK = /jruby-rack.*jar$/
|
80
101
|
EXISTING_APIS = /^appengine-api.*jar$/
|
81
102
|
JRUBY_RACK = 'jruby-rack-0.9.5.jar'
|
82
|
-
JRUBY_RACK_URL =
|
83
|
-
"downloads/download/#{JRUBY_RACK}"
|
103
|
+
JRUBY_RACK_URL = "http://kenai.com/downloads/jruby-rack/#{JRUBY_RACK}"
|
84
104
|
RACKUP = %q{Dir.chdir('..') if Dir.pwd =~ /WEB-INF$/;} +
|
85
105
|
%q{eval IO.read('config.ru'), nil, 'config.ru', 1}
|
86
106
|
|
@@ -88,17 +108,24 @@ module AppEngine
|
|
88
108
|
@app = Application.new(root_path)
|
89
109
|
end
|
90
110
|
|
91
|
-
def bundle
|
92
|
-
bundle_deps
|
111
|
+
def bundle(args=[])
|
112
|
+
bundle_deps(args)
|
93
113
|
convert_config_ru
|
94
114
|
end
|
95
115
|
|
96
|
-
def bundle_deps
|
116
|
+
def bundle_deps(args=[])
|
97
117
|
create_webinf
|
118
|
+
bundle_gems(args)
|
98
119
|
copy_jruby
|
99
120
|
copy_rack
|
100
121
|
copy_sdk
|
101
122
|
end
|
123
|
+
|
124
|
+
def bundle_gems(args)
|
125
|
+
return if defined? JRUBY_VERSION
|
126
|
+
gem_bundler = AppEngine::Admin::GemBundler.new(app.root)
|
127
|
+
gem_bundler.bundle(args)
|
128
|
+
end
|
102
129
|
|
103
130
|
def app
|
104
131
|
@app
|
@@ -111,21 +138,25 @@ module AppEngine
|
|
111
138
|
end
|
112
139
|
|
113
140
|
def create_public
|
114
|
-
return
|
115
|
-
|
141
|
+
return unless defined? JRUBY_VERSION
|
142
|
+
if app.public_root and !File.exists?(app.public_root)
|
143
|
+
Dir.mkdir(app.public_root)
|
144
|
+
end
|
145
|
+
FileUtils.touch(app.favicon_ico) unless File.exists?(app.favicon_ico)
|
146
|
+
FileUtils.touch(app.robots_txt) unless File.exists?(app.robots_txt)
|
116
147
|
end
|
117
148
|
|
118
149
|
def convert_config_ru
|
119
150
|
if !File.exists?(app.config_ru)
|
120
151
|
if File.exists?(app.web_xml)
|
121
152
|
unless File.exists?(app.aeweb_xml)
|
122
|
-
puts "
|
153
|
+
puts "Error: you either need a #{app.config_ru} or "
|
123
154
|
puts " #{app.aeweb_xml}."
|
124
155
|
exit 1
|
125
156
|
end
|
126
157
|
else
|
127
158
|
# TODO auto generate a config.ru
|
128
|
-
puts "
|
159
|
+
puts "Error: you need to create #{app.config_ru}."
|
129
160
|
exit 1
|
130
161
|
end
|
131
162
|
else
|
@@ -136,9 +167,7 @@ module AppEngine
|
|
136
167
|
|
137
168
|
def copy_jruby
|
138
169
|
require 'appengine-jruby-jars'
|
139
|
-
update_jars(
|
140
|
-
"JRuby", EXISTING_JRUBY, [AppEngine::JRubyJars.jruby_jar],
|
141
|
-
/rubygems/, [AppEngine::JRubyJars.rubygems_jar])
|
170
|
+
update_jars("JRuby", EXISTING_JRUBY, [AppEngine::JRubyJars.jruby_jar])
|
142
171
|
end
|
143
172
|
|
144
173
|
def copy_rack
|
@@ -173,7 +202,7 @@ module AppEngine
|
|
173
202
|
def update_jars(name, regex, jars, opt_regex=nil, opt_jars=[])
|
174
203
|
existing = find_jars(regex)
|
175
204
|
if existing.empty?
|
176
|
-
message = "Installing #{name}"
|
205
|
+
message = "=> Installing #{name}"
|
177
206
|
jars_to_install = jars + opt_jars
|
178
207
|
else
|
179
208
|
has_optional_jars = existing.any? {|j| j =~ opt_regex}
|
@@ -182,7 +211,7 @@ module AppEngine
|
|
182
211
|
expected = expected_jars.map {|path| File.basename(path)}
|
183
212
|
if existing.size != expected.size ||
|
184
213
|
(expected & existing) != expected
|
185
|
-
message = "Updating #{name}"
|
214
|
+
message = "=> Updating #{name}"
|
186
215
|
jars_to_install = expected_jars
|
187
216
|
end
|
188
217
|
end
|
@@ -225,14 +254,14 @@ module AppEngine
|
|
225
254
|
end
|
226
255
|
app_root = app.root
|
227
256
|
builder = WebXmlBuilder.new do
|
228
|
-
# First
|
229
|
-
add_jruby_rack_defaults(RACKUP)
|
230
|
-
|
231
|
-
# Now read the user's rackup file
|
257
|
+
# First read the user's rackup file
|
232
258
|
# TODO generate a skeleton if it's missing
|
233
259
|
Dir.chdir(app_root) do
|
234
260
|
eval IO.read('config.ru'), nil, 'config.ru', 1
|
235
261
|
end
|
262
|
+
|
263
|
+
# Now configure the basic jruby-rack settings.
|
264
|
+
add_jruby_rack_defaults(RACKUP)
|
236
265
|
end
|
237
266
|
open(app.web_xml, 'w') do |webxml|
|
238
267
|
xml = AppEngine::Rack::XmlFormatter.format(builder.to_xml)
|
@@ -255,12 +284,12 @@ module AppEngine
|
|
255
284
|
end
|
256
285
|
end
|
257
286
|
|
258
|
-
def self.bundle_app(
|
259
|
-
AppBundler.new(
|
287
|
+
def self.bundle_app(*args)
|
288
|
+
AppBundler.new(args.pop).bundle(args)
|
260
289
|
end
|
261
290
|
|
262
|
-
def self.bundle_deps(
|
263
|
-
AppBundler.new(
|
291
|
+
def self.bundle_deps(*args)
|
292
|
+
AppBundler.new(args.pop).bundle(args)
|
264
293
|
end
|
265
294
|
|
266
295
|
end
|
@@ -72,6 +72,11 @@ module AppEngine
|
|
72
72
|
ENV.delete 'GEM_PATH'
|
73
73
|
java_args << '-classpath'
|
74
74
|
java_args << AppEngine::SDK::TOOLS_JAR
|
75
|
+
java_args << '-Djava.util.logging.config.file=' +
|
76
|
+
AppEngine::SDK::SDK_ROOT + '/config/sdk/logging.properties'
|
77
|
+
if defined? AppEngine::SDK::AGENT_JAR
|
78
|
+
java_args << '-javaagent:' + AppEngine::SDK::AGENT_JAR
|
79
|
+
end
|
75
80
|
command = ['java'] + java_args + DEV_APPSERVER + server_args
|
76
81
|
if ENV['VERBOSE']
|
77
82
|
puts "exec #{command.map{|x| x.inspect}.join(' ')}"
|
@@ -0,0 +1,110 @@
|
|
1
|
+
#!/usr/bin/ruby1.8 -w
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright 2009 Google Inc.
|
4
|
+
# Original Author:: John Woodell (mailto:woodie@google.com)
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (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
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
require 'rubygems'
|
19
|
+
require 'fileutils'
|
20
|
+
require 'zip/zip'
|
21
|
+
require 'zip/zipfilesystem'
|
22
|
+
require 'rubygems/command_manager'
|
23
|
+
require 'appengine-tools/bundler'
|
24
|
+
|
25
|
+
module AppEngine
|
26
|
+
module Admin
|
27
|
+
|
28
|
+
class GemBundler
|
29
|
+
|
30
|
+
def initialize(root)
|
31
|
+
@root = root
|
32
|
+
@app = Application.new(root)
|
33
|
+
end
|
34
|
+
|
35
|
+
def bundle(args)
|
36
|
+
verify_gemfile
|
37
|
+
gem_bundle(args)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def app
|
43
|
+
@app
|
44
|
+
end
|
45
|
+
|
46
|
+
def gems_out_of_date
|
47
|
+
if File.exists?(app.gems_jar) and
|
48
|
+
File.stat(app.gems_jar).mtime > File.stat(app.gemfile).mtime
|
49
|
+
return false
|
50
|
+
end
|
51
|
+
return true
|
52
|
+
end
|
53
|
+
|
54
|
+
def gem_bundle(args)
|
55
|
+
return unless args.include?('--update') || gems_out_of_date
|
56
|
+
Gem.platforms = [Gem::Platform::RUBY,
|
57
|
+
Gem::Platform.new('universal-java')]
|
58
|
+
Gem.configuration = Gem::ConfigFile.new(args.unshift('bundle'))
|
59
|
+
puts "=> Bundling gems"
|
60
|
+
begin
|
61
|
+
Dir.chdir(@root) do
|
62
|
+
Gem::CommandManager.instance.run(Gem.configuration.args)
|
63
|
+
end
|
64
|
+
rescue Gem::SystemExitException => e
|
65
|
+
exit e.exit_code unless e.exit_code == 0
|
66
|
+
end
|
67
|
+
bundler_dir = "#{app.gems_dir}/bundler_gems"
|
68
|
+
# TODO: this temporary hack should be fixed properly
|
69
|
+
gem_patch = <<MOD
|
70
|
+
# Injected by appengine-tools to patch bundler 0.6.0 for Sinatra 0.9.4
|
71
|
+
module Gem
|
72
|
+
def self.dir; ENV['GEM_HOME']; end
|
73
|
+
RubyGemsVersion = "0.0.0" unless defined? RubyGemsVersion
|
74
|
+
end
|
75
|
+
MOD
|
76
|
+
File.open("#{bundler_dir}/environment.rb",'a') {|f| f << gem_patch }
|
77
|
+
FileUtils.rm app.gems_jar, :force => true # blow away the old jar
|
78
|
+
puts "=> Installing gems"
|
79
|
+
gem_files = Dir["#{bundler_dir}/gems/**/**"] +
|
80
|
+
Dir["#{bundler_dir}/environment.rb"]
|
81
|
+
Zip::ZipFile.open(app.gems_jar, 'w') do |jar|
|
82
|
+
gem_files.reject {|f| f == app.gems_jar}.each do |file|
|
83
|
+
jar.add(file.sub("#{app.gems_dir}/",''), file)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def verify_gemfile
|
89
|
+
return if File.exists?(app.gemfile)
|
90
|
+
puts "=> Generating gemfile"
|
91
|
+
|
92
|
+
# TODO: Maybe we should include the latest
|
93
|
+
# versions from updatecheck here?
|
94
|
+
stock_gemfile = <<EOF
|
95
|
+
# Critical default settings:
|
96
|
+
disable_system_gems
|
97
|
+
disable_rubygems
|
98
|
+
bundle_path ".gems/bundler_gems"
|
99
|
+
|
100
|
+
# List gems to bundle here:
|
101
|
+
#gem "rack", "1.0.0"
|
102
|
+
#gem "dm-appengine"
|
103
|
+
#gem "sinatra"
|
104
|
+
EOF
|
105
|
+
File.open(app.gemfile,'w') {|f| f.write(stock_gemfile) }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
@@ -46,13 +46,12 @@ module AppEngine
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def find_gem_version(name)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
Gem::Version.new($1)
|
49
|
+
IO.foreach("#{@approot}/.gems/bundler_gems/environment.rb") do |line|
|
50
|
+
if line =~ %r(/gems/#{name}-(\w+\.\w+.\w+)[/"])
|
51
|
+
return Gem::Version.new($1)
|
53
52
|
end
|
54
|
-
end
|
55
|
-
|
53
|
+
end rescue nil
|
54
|
+
nil
|
56
55
|
end
|
57
56
|
|
58
57
|
def remote_versions
|
@@ -66,7 +65,7 @@ module AppEngine
|
|
66
65
|
def check_for_updates
|
67
66
|
local = local_versions
|
68
67
|
unless local['google-appengine']
|
69
|
-
puts 'Skipping update check'
|
68
|
+
puts '=> Skipping update check'
|
70
69
|
return
|
71
70
|
end
|
72
71
|
latest = remote_versions
|
@@ -74,13 +73,13 @@ module AppEngine
|
|
74
73
|
current = latest[name]
|
75
74
|
if version && version < current
|
76
75
|
prefix = if name == 'google-appengine'
|
77
|
-
"sudo"
|
76
|
+
update_msg = "=> Please run sudo gem update google-appengine."
|
78
77
|
else
|
79
|
-
"
|
78
|
+
update_msg = "=> Please update your Gemfile."
|
80
79
|
end
|
81
|
-
puts "There is a new version of #{name}: #{current} " +
|
80
|
+
puts "=> There is a new version of #{name}: #{current} " +
|
82
81
|
"(You have #{version})"
|
83
|
-
puts
|
82
|
+
puts update_msg
|
84
83
|
end
|
85
84
|
end
|
86
85
|
end
|
@@ -115,4 +114,4 @@ module AppEngine
|
|
115
114
|
end
|
116
115
|
end
|
117
116
|
end
|
118
|
-
end
|
117
|
+
end
|
@@ -27,14 +27,21 @@ class WebXmlBuilder < Rack::Builder
|
|
27
27
|
def initialize(&block)
|
28
28
|
@path = "/"
|
29
29
|
@paths = Hash.new {|h, k| h[k] = []}
|
30
|
+
@skip_defaults = false
|
30
31
|
instance_eval(&block) if block_given?
|
31
32
|
end
|
32
33
|
|
34
|
+
def skip_rack_servlet
|
35
|
+
@skip_defaults = true
|
36
|
+
end
|
37
|
+
|
33
38
|
def add_jruby_rack_defaults(rackup)
|
34
39
|
use JavaContextParams, :rackup => rackup
|
35
|
-
|
36
|
-
|
37
|
-
|
40
|
+
unless @skip_defaults
|
41
|
+
use JavaServletFilter, 'org.jruby.rack.RackFilter',
|
42
|
+
{ :name => 'RackFilter', :wildcard => true }
|
43
|
+
end
|
44
|
+
use JavaContextListener, 'com.google.appengine.jruby.LazyContextListener'
|
38
45
|
end
|
39
46
|
|
40
47
|
def use(middleware, *args, &block)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appengine-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Brown
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-02 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,6 +42,26 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: "0"
|
44
44
|
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: bundler
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.6.0
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubyzip
|
57
|
+
type: :runtime
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
45
65
|
description: Tools for developing and deploying apps to Google App Engine
|
46
66
|
email: ribrdb@gmail.com
|
47
67
|
executables:
|
@@ -56,21 +76,22 @@ files:
|
|
56
76
|
- LICENSE
|
57
77
|
- README.rdoc
|
58
78
|
- Rakefile
|
79
|
+
- lib/appengine-tools/update_check.rb
|
59
80
|
- lib/appengine-tools/appcfg.rb
|
60
|
-
- lib/appengine-tools/boot.rb
|
61
81
|
- lib/appengine-tools/bundler.rb
|
62
|
-
- lib/appengine-tools/
|
63
|
-
- lib/appengine-tools/update_check.rb
|
64
|
-
- lib/appengine-tools/web-xml.rb
|
82
|
+
- lib/appengine-tools/gem_bundler.rb
|
65
83
|
- lib/appengine-tools/xml-formatter.rb
|
84
|
+
- lib/appengine-tools/boot.rb
|
85
|
+
- lib/appengine-tools/web-xml.rb
|
86
|
+
- lib/appengine-tools/dev_appserver.rb
|
66
87
|
- spec/appengine-web.xml
|
88
|
+
- spec/web.xml
|
67
89
|
- spec/config.ru
|
68
|
-
- spec/rack_spec.rb
|
69
90
|
- spec/spec.opts
|
70
|
-
- spec/
|
91
|
+
- spec/rack_spec.rb
|
71
92
|
- spec/update_check_spec.rb
|
93
|
+
- spec/spec_helper.rb
|
72
94
|
- spec/web-xml_spec.rb
|
73
|
-
- spec/web.xml
|
74
95
|
has_rdoc: true
|
75
96
|
homepage: http://code.google.com/p/appengine-jruby
|
76
97
|
licenses: []
|