appengine-rack 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -3,6 +3,9 @@ require 'rake/gempackagetask'
3
3
  require 'rubygems/specification'
4
4
  require 'date'
5
5
  require 'spec/rake/spectask'
6
+ require 'fileutils'
7
+
8
+ BOOT_JAR = "appengine-rack.jar"
6
9
 
7
10
  SUMMARY = <<EOF
8
11
  Commom dependencies for configuring an App Engine application via Rack.
@@ -10,7 +13,7 @@ EOF
10
13
 
11
14
  spec = Gem::Specification.new do |s|
12
15
  s.name = "appengine-rack"
13
- s.version = "0.0.7"
16
+ s.version = "0.0.8"
14
17
  s.author = "Ryan Brown"
15
18
  s.email = "ribrdb@google.com"
16
19
  s.homepage = "http://code.google.com/p/appengine-jruby"
@@ -28,6 +31,11 @@ end
28
31
  task :default => :spec
29
32
 
30
33
  Rake::GemPackageTask.new(spec) do |pkg|
34
+ chdir 'src'
35
+ system "jar -cf ../lib/#{BOOT_JAR} com/google/appengine/jruby/*.class"
36
+ chdir '../lib'
37
+ system "jar -uf #{BOOT_JAR} appengine-rack/boot.rb"
38
+ chdir '..'
31
39
  pkg.gem_spec = spec
32
40
  end
33
41
 
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/ruby1.8 -w
2
+ #
3
+ # Copyright:: Copyright 2010 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 'jruby/rack/booter'
19
+
20
+ # try to require the bundled environment
21
+ begin
22
+ require 'bundler_gems/environment'
23
+ rescue LoadError
24
+ # continue
25
+ end
26
+
27
+ module JRuby
28
+ module Rack
29
+ class AppEngineLayout < WebInfLayout
30
+ def app_uri
31
+ @app_uri ||= '/'
32
+ end
33
+
34
+ def gem_path
35
+ "bundler_gems/jruby/1.8"
36
+ end
37
+
38
+ def public_uri
39
+ @public_uri ||= begin
40
+ path = @rack_context.getInitParameter('public.root') || '/public'
41
+ path = "/#{path}" unless path =~ %r{^/}
42
+ path.chomp("/")
43
+ end
44
+ end
45
+
46
+ def change_working_directory
47
+ if @rack_context.server_info.include?('Development')
48
+ ENV['RACK_ENV'] = 'development'
49
+ else
50
+ ENV['RACK_ENV'] = 'production'
51
+ end
52
+ super
53
+ end
54
+ end
55
+
56
+ class Booter
57
+ def default_layout_class
58
+ AppEngineLayout
59
+ end
60
+ end
61
+ end
62
+ end
Binary file
@@ -294,17 +294,16 @@ module AppEngine
294
294
  @app.configure(options)
295
295
  end
296
296
 
297
+ # Deprecated, use ENV['RACK_ENV'] instead
297
298
  def environment
298
- if $servlet_context
299
- if $servlet_context.server_info =~ %r{^Google App Engine Development/}
300
- "development"
301
- elsif $servlet_context.server_info =~ %r{^Google App Engine/}
302
- "production"
303
- end
299
+ if !$servlet_context.nil? and
300
+ $servlet_context.server_info.include? 'Development'
301
+ 'development'
302
+ else
303
+ 'production'
304
304
  end
305
305
  end
306
306
 
307
-
308
307
  def make_wildcard(pattern)
309
308
  "#{pattern}/*".squeeze('/')
310
309
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 7
9
- version: 0.0.7
8
+ - 8
9
+ version: 0.0.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ryan Brown
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-07 00:00:00 -07:00
17
+ date: 2010-05-04 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -56,7 +56,9 @@ extra_rdoc_files: []
56
56
  files:
57
57
  - LICENSE
58
58
  - Rakefile
59
+ - lib/appengine-rack/boot.rb
59
60
  - lib/appengine-rack/java.rb
61
+ - lib/appengine-rack.jar
60
62
  - lib/appengine-rack.rb
61
63
  has_rdoc: true
62
64
  homepage: http://code.google.com/p/appengine-jruby