appengine-tools 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -3
- data/lib/appengine-tools/appcfg.rb +9 -1
- data/lib/appengine-tools/bundler.rb +6 -3
- data/lib/appengine-tools/gem_bundler.rb +7 -5
- data/lib/appengine-tools/web-xml.rb +9 -3
- metadata +4 -8
- data/spec/appengine-web.xml +0 -19
- data/spec/config.ru +0 -36
- data/spec/spec.opts +0 -1
- data/spec/web.xml +0 -84
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.6"
|
9
9
|
AUTHOR = "Ryan Brown"
|
10
10
|
EMAIL = "ribrdb@gmail.com"
|
11
11
|
HOMEPAGE = "http://code.google.com/p/appengine-jruby"
|
@@ -24,12 +24,12 @@ spec = Gem::Specification.new do |s|
|
|
24
24
|
s.homepage = HOMEPAGE
|
25
25
|
|
26
26
|
s.require_path = 'lib'
|
27
|
-
s.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{lib,spec}
|
27
|
+
s.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{lib,spec}/**/*.rb")
|
28
28
|
s.executables = [ 'appcfg.rb', 'dev_appserver.rb' ]
|
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'
|
32
|
+
s.add_dependency('bundler')
|
33
33
|
s.add_dependency('rubyzip')
|
34
34
|
end
|
35
35
|
|
@@ -46,7 +46,15 @@ module AppEngine
|
|
46
46
|
def getCronYaml
|
47
47
|
cron = File.join(app.path, 'cron.yaml')
|
48
48
|
if File.exists?(cron)
|
49
|
-
return cron
|
49
|
+
return IO.read(cron)
|
50
|
+
end
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
|
54
|
+
def getQueueYaml
|
55
|
+
queue = File.join(app.path, 'queue.yaml')
|
56
|
+
if File.exists?(queue)
|
57
|
+
return IO.read(queue)
|
50
58
|
end
|
51
59
|
nil
|
52
60
|
end
|
@@ -101,9 +101,11 @@ module AppEngine
|
|
101
101
|
EXISTING_APIS = /^appengine-api.*jar$/
|
102
102
|
JRUBY_RACK = 'jruby-rack-0.9.5.jar'
|
103
103
|
JRUBY_RACK_URL = "http://kenai.com/downloads/jruby-rack/#{JRUBY_RACK}"
|
104
|
-
RACKUP = %q{Dir.chdir('..') if Dir.pwd =~ /WEB-INF$/;} +
|
104
|
+
RACKUP = %q{Dir.chdir('..') if Dir.pwd =~ /WEB-INF$/; } +
|
105
|
+
%q{begin; require 'bundler_gems/environment'; } +
|
106
|
+
%q{rescue LoadError; end;} +
|
105
107
|
%q{eval IO.read('config.ru'), nil, 'config.ru', 1}
|
106
|
-
|
108
|
+
|
107
109
|
def initialize(root_path)
|
108
110
|
@app = Application.new(root_path)
|
109
111
|
end
|
@@ -188,7 +190,7 @@ module AppEngine
|
|
188
190
|
|
189
191
|
def copy_sdk
|
190
192
|
require 'appengine-sdk'
|
191
|
-
glob = "appengine-api-1.0-sdk-*.jar"
|
193
|
+
glob = "appengine-api-{1.0-sdk,labs}-*.jar"
|
192
194
|
jars = Dir.glob("#{AppEngine::SDK::SDK_ROOT}/lib/user/#{glob}")
|
193
195
|
update_jars('appengine-sdk', EXISTING_APIS, jars)
|
194
196
|
end
|
@@ -257,6 +259,7 @@ module AppEngine
|
|
257
259
|
# First read the user's rackup file
|
258
260
|
# TODO generate a skeleton if it's missing
|
259
261
|
Dir.chdir(app_root) do
|
262
|
+
require '.gems/bundler_gems/environment'
|
260
263
|
eval IO.read('config.ru'), nil, 'config.ru', 1
|
261
264
|
end
|
262
265
|
|
@@ -67,16 +67,18 @@ module AppEngine
|
|
67
67
|
bundler_dir = "#{app.gems_dir}/bundler_gems"
|
68
68
|
# TODO: this temporary hack should be fixed properly
|
69
69
|
gem_patch = <<MOD
|
70
|
-
# Injected by appengine-tools to patch bundler
|
70
|
+
# Injected by appengine-tools to patch bundler for Sinatra and Rails 3
|
71
71
|
module Gem
|
72
|
-
def self.
|
73
|
-
|
72
|
+
def self.default_dir; ENV['GEM_HOME']; end
|
73
|
+
def self.dir; ENV['GEM_HOME']; end
|
74
|
+
def self.path; ENV['GEM_PATH']; end
|
74
75
|
end
|
75
76
|
MOD
|
76
77
|
File.open("#{bundler_dir}/environment.rb",'a') {|f| f << gem_patch }
|
77
78
|
FileUtils.rm app.gems_jar, :force => true # blow away the old jar
|
78
|
-
puts "=>
|
79
|
+
puts "=> Packaging gems"
|
79
80
|
gem_files = Dir["#{bundler_dir}/gems/**/**"] +
|
81
|
+
Dir["#{bundler_dir}/dirs/**/**"] +
|
80
82
|
Dir["#{bundler_dir}/environment.rb"]
|
81
83
|
Zip::ZipFile.open(app.gems_jar, 'w') do |jar|
|
82
84
|
gem_files.reject {|f| f == app.gems_jar}.each do |file|
|
@@ -98,7 +100,7 @@ disable_rubygems
|
|
98
100
|
bundle_path ".gems/bundler_gems"
|
99
101
|
|
100
102
|
# List gems to bundle here:
|
101
|
-
|
103
|
+
gem "appengine-rack"
|
102
104
|
#gem "dm-appengine"
|
103
105
|
#gem "sinatra"
|
104
106
|
EOF
|
@@ -28,13 +28,18 @@ class WebXmlBuilder < Rack::Builder
|
|
28
28
|
@path = "/"
|
29
29
|
@paths = Hash.new {|h, k| h[k] = []}
|
30
30
|
@skip_defaults = false
|
31
|
+
@mime_mapping = {}
|
31
32
|
instance_eval(&block) if block_given?
|
32
33
|
end
|
33
34
|
|
34
|
-
def
|
35
|
-
@
|
35
|
+
def add_mime_mapping(doc)
|
36
|
+
@mime_mapping.each_pair do |key,val|
|
37
|
+
mime = doc.add_element('mime-mapping')
|
38
|
+
mime.add_element('extension').add_text(key.to_s)
|
39
|
+
mime.add_element('mime-type').add_text(val)
|
40
|
+
end
|
36
41
|
end
|
37
|
-
|
42
|
+
|
38
43
|
def add_jruby_rack_defaults(rackup)
|
39
44
|
use JavaContextParams, :rackup => rackup
|
40
45
|
unless @skip_defaults
|
@@ -81,6 +86,7 @@ class WebXmlBuilder < Rack::Builder
|
|
81
86
|
end
|
82
87
|
end
|
83
88
|
end
|
89
|
+
add_mime_mapping(doc)
|
84
90
|
doc
|
85
91
|
end
|
86
92
|
|
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.6
|
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-12-07 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -48,9 +48,9 @@ dependencies:
|
|
48
48
|
version_requirement:
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0
|
53
|
+
version: "0"
|
54
54
|
version:
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubyzip
|
@@ -84,10 +84,6 @@ files:
|
|
84
84
|
- lib/appengine-tools/boot.rb
|
85
85
|
- lib/appengine-tools/web-xml.rb
|
86
86
|
- lib/appengine-tools/dev_appserver.rb
|
87
|
-
- spec/appengine-web.xml
|
88
|
-
- spec/web.xml
|
89
|
-
- spec/config.ru
|
90
|
-
- spec/spec.opts
|
91
87
|
- spec/rack_spec.rb
|
92
88
|
- spec/update_check_spec.rb
|
93
89
|
- spec/spec_helper.rb
|
data/spec/appengine-web.xml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
<appengine-web-app xmlns='http://appengine.google.com/ns/1.0'>
|
2
|
-
<application>tools-test</application>
|
3
|
-
<version>foo</version>
|
4
|
-
<public-root>/public</public-root>
|
5
|
-
<static-files>
|
6
|
-
<include expiration='365d' path='/public/images/**'/>
|
7
|
-
<include path='/public/**'/>
|
8
|
-
</static-files>
|
9
|
-
<resource-files/>
|
10
|
-
<system-properties>
|
11
|
-
<property name='os.arch' value=''/>
|
12
|
-
<property name='jruby.management.enabled' value='false'/>
|
13
|
-
<property name='jruby.rack.input.rewindable' value='false'/>
|
14
|
-
</system-properties>
|
15
|
-
<ssl-enabled>true</ssl-enabled>
|
16
|
-
<inbound-services>
|
17
|
-
<service>xmpp_message</service>
|
18
|
-
</inbound-services>
|
19
|
-
</appengine-web-app>
|
data/spec/config.ru
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'appengine-rack'
|
2
|
-
|
3
|
-
AppEngine::Rack.configure_app(
|
4
|
-
:application => 'tools-test', :version => 'foo', :ssl_enabled => true)
|
5
|
-
AppEngine::Rack.app.inbound_services << :xmpp_message
|
6
|
-
AppEngine::Rack.app.static_files.include('/public/images/**', '365d')
|
7
|
-
AppEngine::Rack.app.static_files.include('/public/**')
|
8
|
-
|
9
|
-
ruby_app = lambda {|env| [200, {}, "Hello Rack!"]}
|
10
|
-
|
11
|
-
map '/admin' do
|
12
|
-
use JavaServletFilter, 'com.example.AdminFilter', :wildcard => true
|
13
|
-
run JavaServlet.new('com.example.AdminServlet', :wildcard => true)
|
14
|
-
end
|
15
|
-
|
16
|
-
map '/store' do
|
17
|
-
use JavaServletFilter, 'com.example.StoreFilter', :name => 'StoreFilter'
|
18
|
-
run JavaServlet.new('com.example.StoreServlet', :name => 'store')
|
19
|
-
end
|
20
|
-
|
21
|
-
map '/admin2' do
|
22
|
-
use AppEngine::Rack::AdminRequired
|
23
|
-
run ruby_app
|
24
|
-
end
|
25
|
-
|
26
|
-
map '/private' do
|
27
|
-
use AppEngine::Rack::LoginRequired
|
28
|
-
run ruby_app
|
29
|
-
end
|
30
|
-
|
31
|
-
map '/secure' do
|
32
|
-
use AppEngine::Rack::SSLRequired
|
33
|
-
run ruby_app
|
34
|
-
end
|
35
|
-
|
36
|
-
run ruby_app
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour --diff
|
data/spec/web.xml
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
<web-app version='2.5' xmlns='http://java.sun.com/xml/ns/javaee'>
|
2
|
-
<security-constraint>
|
3
|
-
<web-resource-collection>
|
4
|
-
<url-pattern>/private</url-pattern>
|
5
|
-
<url-pattern>/private/*</url-pattern>
|
6
|
-
</web-resource-collection>
|
7
|
-
<auth-constraint>
|
8
|
-
<role-name>*</role-name>
|
9
|
-
</auth-constraint>
|
10
|
-
</security-constraint>
|
11
|
-
<security-constraint>
|
12
|
-
<web-resource-collection>
|
13
|
-
<url-pattern>/admin2</url-pattern>
|
14
|
-
<url-pattern>/admin2/*</url-pattern>
|
15
|
-
</web-resource-collection>
|
16
|
-
<auth-constraint>
|
17
|
-
<role-name>admin</role-name>
|
18
|
-
</auth-constraint>
|
19
|
-
</security-constraint>
|
20
|
-
<security-constraint>
|
21
|
-
<web-resource-collection>
|
22
|
-
<url-pattern>/secure</url-pattern>
|
23
|
-
<url-pattern>/secure/*</url-pattern>
|
24
|
-
</web-resource-collection>
|
25
|
-
<user-data-constraint>
|
26
|
-
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
|
27
|
-
</user-data-constraint>
|
28
|
-
</security-constraint>
|
29
|
-
<filter>
|
30
|
-
<filter-name>StoreFilter</filter-name>
|
31
|
-
<filter-class>com.example.StoreFilter</filter-class>
|
32
|
-
</filter>
|
33
|
-
<filter-mapping>
|
34
|
-
<filter-name>StoreFilter</filter-name>
|
35
|
-
<url-pattern>/store</url-pattern>
|
36
|
-
</filter-mapping>
|
37
|
-
<servlet>
|
38
|
-
<servlet-name>store</servlet-name>
|
39
|
-
<servlet-class>com.example.StoreServlet</servlet-class>
|
40
|
-
</servlet>
|
41
|
-
<servlet-mapping>
|
42
|
-
<servlet-name>store</servlet-name>
|
43
|
-
<url-pattern>/store</url-pattern>
|
44
|
-
</servlet-mapping>
|
45
|
-
<filter>
|
46
|
-
<filter-name>com.example.AdminFilter</filter-name>
|
47
|
-
<filter-class>com.example.AdminFilter</filter-class>
|
48
|
-
</filter>
|
49
|
-
<filter-mapping>
|
50
|
-
<filter-name>com.example.AdminFilter</filter-name>
|
51
|
-
<url-pattern>/admin</url-pattern>
|
52
|
-
</filter-mapping>
|
53
|
-
<filter-mapping>
|
54
|
-
<filter-name>com.example.AdminFilter</filter-name>
|
55
|
-
<url-pattern>/admin/*</url-pattern>
|
56
|
-
</filter-mapping>
|
57
|
-
<servlet>
|
58
|
-
<servlet-name>com.example.AdminServlet</servlet-name>
|
59
|
-
<servlet-class>com.example.AdminServlet</servlet-class>
|
60
|
-
</servlet>
|
61
|
-
<servlet-mapping>
|
62
|
-
<servlet-name>com.example.AdminServlet</servlet-name>
|
63
|
-
<url-pattern>/admin</url-pattern>
|
64
|
-
</servlet-mapping>
|
65
|
-
<servlet-mapping>
|
66
|
-
<servlet-name>com.example.AdminServlet</servlet-name>
|
67
|
-
<url-pattern>/admin/*</url-pattern>
|
68
|
-
</servlet-mapping>
|
69
|
-
<context-param>
|
70
|
-
<param-name>rackup</param-name>
|
71
|
-
<param-value>rackup</param-value>
|
72
|
-
</context-param>
|
73
|
-
<filter>
|
74
|
-
<filter-name>RackFilter</filter-name>
|
75
|
-
<filter-class>org.jruby.rack.RackFilter</filter-class>
|
76
|
-
</filter>
|
77
|
-
<filter-mapping>
|
78
|
-
<filter-name>RackFilter</filter-name>
|
79
|
-
<url-pattern>/*</url-pattern>
|
80
|
-
</filter-mapping>
|
81
|
-
<listener>
|
82
|
-
<listener-class>org.jruby.rack.RackServletContextListener</listener-class>
|
83
|
-
</listener>
|
84
|
-
</web-app>
|