ulbrich-jruby-enginize 0.6.5 → 0.7.0
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/README.rdoc +53 -40
- data/bin/jruby-enginize +1 -1
- data/lib/generator.rb +9 -6
- data/lib/script.rb +3 -1
- data/templates/merb/config/framework.rb +4 -4
- data/templates/merb/config/init.rb +1 -1
- data/templates/merb/config.ru +19 -0
- data/templates/merb/lib/tasks/merb.rake +32 -24
- data/templates/merb/views/index.html.erb +2 -1
- data/templates/shared/README +39 -11
- data/templates/shared/Rakefile +20 -58
- data/templates/sinatra/app.rb +9 -2
- data/templates/sinatra/config.ru +8 -8
- data/templates/sinatra/lib/tasks/haml-2_2_2-util.patch +5 -0
- data/templates/sinatra/lib/tasks/sinatra.rake +14 -5
- data/templates/sinatra/views/index.haml +2 -1
- metadata +5 -6
- data/templates/merb/config/warble.rb +0 -85
- data/templates/shared/appengine-web.xml +0 -21
- data/templates/shared/lib/jruby-rack-0.9.4.jar +0 -0
- data/templates/sinatra/config/warble.rb +0 -85
data/README.rdoc
CHANGED
@@ -12,70 +12,83 @@ what's up running Ruby applications on a Java VM.
|
|
12
12
|
== Prerequisites
|
13
13
|
|
14
14
|
JRuby-Enginize needs a proper JRuby installation including rake and the
|
15
|
-
Google AppEngine SDK
|
16
|
-
|
15
|
+
Google AppEngine SDK (http://code.google.com/appengine/downloads.html) for
|
16
|
+
Java.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
For Merb (http://www.merbivore.com), you will need the "merb-core" gem with
|
22
|
-
"extlib" and "appengine-apis".
|
23
|
-
|
24
|
-
Be sure to install gems with <tt>jgem</tt> or <tt>jruby -S gem</tt> as you
|
25
|
-
need them for JRuby and not for Ruby.
|
26
|
-
|
27
|
-
You also need an Google AppEngine account to actually publish your code.
|
28
|
-
Without account you can still play around with the tool and run applications
|
29
|
-
locally.
|
18
|
+
More dependencies depend on the framework template to generate an application
|
19
|
+
for, but installation of additional gems is done with tools provided by
|
20
|
+
Google (so below).
|
30
21
|
|
31
22
|
== Installation
|
32
23
|
|
33
|
-
|
24
|
+
The Google people worked hard to make JRuby easier to deploy than it was at
|
25
|
+
the beginning, so don't blindly trust all those blog posts and samples you'll
|
26
|
+
find but use the newest version of jruby-enginize and have a look at the Wiki
|
27
|
+
page of the Google AppEngine JRuby tools
|
28
|
+
(http://code.google.com/p/appengine-jruby/wiki/GettingStarted)
|
29
|
+
to learn about the details beyond.
|
30
|
+
|
31
|
+
These are the steps for installing the Google tools plus JRuby-Enginize
|
32
|
+
running on top of it to streamline your first steps:
|
34
33
|
|
35
|
-
sudo
|
36
|
-
sudo
|
34
|
+
sudo gem sources -a http://gems.github.com # Only needed once!
|
35
|
+
sudo gem install google-appengine
|
36
|
+
sudo gem install ulbrich-jruby-enginize
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
You also need an Google AppEngine account to actually publish your code.
|
39
|
+
Without account you can still play around with the tools and run applications
|
40
|
+
locally.
|
41
41
|
|
42
42
|
== Using jruby-enginize
|
43
43
|
|
44
|
-
|
45
|
-
inspired by the <tt>rails</tt> tool for generating Rails applications.
|
46
|
-
call
|
44
|
+
JRuby-Enginize includes is a single executable named <tt>jruby-enginize</tt>
|
45
|
+
which is inspired by the <tt>rails</tt> tool for generating Rails applications.
|
46
|
+
So just call
|
47
47
|
|
48
|
-
jruby
|
48
|
+
jruby-enginize
|
49
49
|
|
50
50
|
and have a look at the options.
|
51
51
|
|
52
52
|
Here are the steps for creating and deploying a new Sinatra application:
|
53
53
|
|
54
|
-
* Register with Google AppEngine and
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
* Register with Google AppEngine and create a new application ID.
|
55
|
+
|
56
|
+
* Generate your application with that new ID as directory name. Sample:
|
57
|
+
|
58
|
+
<tt>jruby-enginize --template sinatra jruby-enginize</tt>
|
59
|
+
|
60
|
+
* Go to the new directory and install the missing gems first (depends on the
|
61
|
+
template you have chosen):
|
62
|
+
|
63
|
+
<tt>sudo rake template:gems</tt>
|
64
|
+
|
65
|
+
!!Attention: Whenever you want to install additional gems, be sure
|
66
|
+
to use <tt>appcfg.rb gem</tt> provided by the Google AppEngine JRuby tools
|
67
|
+
and not <tt>jgem</tt> as Google maintains a local repository per project and
|
68
|
+
bundles the files to upload from that information. You will run into missing
|
69
|
+
gems on the server if you bypass this! Best approach is to use a separate
|
70
|
+
JRuby installation for AppEngine development to run into missing gems when
|
71
|
+
running the application locally, too.
|
58
72
|
|
59
|
-
*
|
73
|
+
* Learn about the available rake tasks
|
60
74
|
|
61
|
-
<tt>
|
75
|
+
<tt>rake --tasks</tt>
|
62
76
|
|
63
|
-
*
|
64
|
-
your application:
|
77
|
+
* Try out your application locally running on port 8080:
|
65
78
|
|
66
|
-
<tt>
|
67
|
-
<tt>jruby rake --tasks</tt>
|
79
|
+
<tt>rake appengine:run</tt>
|
68
80
|
|
69
|
-
|
81
|
+
* Deploy the application:
|
70
82
|
|
71
|
-
|
72
|
-
generated with:
|
83
|
+
<tt>rake appengine:deploy</tt>
|
73
84
|
|
74
|
-
|
85
|
+
The first time you deploy your application, you will be asked for e-mail and
|
86
|
+
password to confirm your upload to the server.
|
75
87
|
|
76
88
|
You can repeat the deployment whenever you want. Be sure to set the version
|
77
|
-
number in "
|
78
|
-
an unstable version and don't want to
|
89
|
+
number in the AppEngine::Rack.configure_app part of "config.ru" to a new
|
90
|
+
value, when you are experimenting with an unstable version and don't want to
|
91
|
+
risk your users getting exceptions.
|
79
92
|
|
80
93
|
You can try the new version by opening e.g.
|
81
94
|
|
data/bin/jruby-enginize
CHANGED
data/lib/generator.rb
CHANGED
@@ -60,9 +60,9 @@ module JRubyEnginize # :nodoc:
|
|
60
60
|
raise ArgumentError, "Template \"#{template}\" missing" unless File.stat(templatedir).directory?
|
61
61
|
|
62
62
|
if dryrun
|
63
|
-
puts "Dry run which would generate the following files
|
63
|
+
puts "Dry run which would generate the following files from template \"#{template}\":"
|
64
64
|
else
|
65
|
-
puts "Generating files
|
65
|
+
puts "Generating files from template \"#{template}\"."
|
66
66
|
end
|
67
67
|
|
68
68
|
template_files(shareddir, templatedir).each do |key, path|
|
@@ -78,8 +78,10 @@ module JRubyEnginize # :nodoc:
|
|
78
78
|
if not dryrun
|
79
79
|
puts "Done with directory \"#{self.path}\"."
|
80
80
|
|
81
|
-
puts "\nYour next steps:\n cd #{self.path}\n\n
|
82
|
-
puts "
|
81
|
+
puts "\nYour next steps:\n cd #{self.path}\n\n sudo rake template:gems"
|
82
|
+
puts "\n rake\n rake --tasks"
|
83
|
+
puts "\n rake appengine:run # First call may fail: Just retry!"
|
84
|
+
puts "\n rake appengine:deploy"
|
83
85
|
end
|
84
86
|
end
|
85
87
|
|
@@ -159,11 +161,12 @@ module JRubyEnginize # :nodoc:
|
|
159
161
|
content = File.read(source).gsub(/\{\{[^}]*\}\}/) do |variable|
|
160
162
|
case variable
|
161
163
|
when '{{email}}'
|
164
|
+
raise 'missing e-mail address' if email.nil? or email.empty?
|
162
165
|
email
|
163
166
|
when '{{name}}'
|
164
167
|
name
|
165
168
|
else
|
166
|
-
if hexrand = variable.match(
|
169
|
+
if hexrand = variable.match(/\{\{hexrand-([0-9]+)\}\}/) and
|
167
170
|
hexrand.length == 2 and (len = hexrand[1].to_i) > 0
|
168
171
|
then
|
169
172
|
str = ''
|
@@ -173,7 +176,7 @@ module JRubyEnginize # :nodoc:
|
|
173
176
|
end
|
174
177
|
|
175
178
|
str[0, len]
|
176
|
-
elsif numrand = variable.match(
|
179
|
+
elsif numrand = variable.match(/\{\{numrand-([0-9]+)\}\}/) and
|
177
180
|
numrand.length == 2 and (len = numrand[1].to_i) > 0
|
178
181
|
then
|
179
182
|
str = ''
|
data/lib/script.rb
CHANGED
@@ -26,6 +26,7 @@ module JRubyEnginize # :nodoc:
|
|
26
26
|
|
27
27
|
prog = File.basename($0)
|
28
28
|
|
29
|
+
=begin
|
29
30
|
# Check for running with JRuby: The whole generator makes no sense if not
|
30
31
|
# running with or at least for JRuby...
|
31
32
|
|
@@ -35,6 +36,7 @@ module JRubyEnginize # :nodoc:
|
|
35
36
|
$stderr.puts "!!#{prog} makes only sense on JRuby systems. Please try again."
|
36
37
|
exit(1)
|
37
38
|
end
|
39
|
+
=end
|
38
40
|
|
39
41
|
# The AppEngine SDK has to be around, too.
|
40
42
|
|
@@ -67,7 +69,7 @@ module JRubyEnginize # :nodoc:
|
|
67
69
|
raise 'missing directory name' if (path = ARGV.first).nil? or path.empty?
|
68
70
|
raise 'directory already exists' if FileTest.exists? path
|
69
71
|
raise 'unknown template' if not JRubyEnginize::Generator.templates.include? template
|
70
|
-
|
72
|
+
|
71
73
|
raise 'missing e-mail address' if email.nil? or email.empty?
|
72
74
|
rescue SystemExit
|
73
75
|
exit(1)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Merb::Config[:framework] = {
|
2
|
-
:application => Merb.root /
|
3
|
-
:config => [Merb.root /
|
4
|
-
:public => [Merb.root /
|
5
|
-
:view => Merb.root /
|
2
|
+
:application => Merb.root / 'app.rb',
|
3
|
+
:config => [Merb.root / 'config', nil],
|
4
|
+
:public => [Merb.root / 'public', nil],
|
5
|
+
:view => Merb.root / 'views'
|
6
6
|
}
|
7
7
|
|
@@ -17,7 +17,7 @@ end
|
|
17
17
|
|
18
18
|
# Move this to app.rb if you want it to be reloadable in dev mode.
|
19
19
|
Merb::Router.prepare do
|
20
|
-
match('/').to(:controller =>
|
20
|
+
match('/').to(:controller => 'engine_app', :action =>'index')
|
21
21
|
|
22
22
|
default_routes
|
23
23
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'appengine-rack'
|
3
|
+
|
4
|
+
require 'merb-core'
|
5
|
+
|
6
|
+
AppEngine::Rack.configure_app(
|
7
|
+
# :ssl_enabled => true,
|
8
|
+
:application => '{{name}}',
|
9
|
+
:version => 1)
|
10
|
+
|
11
|
+
Merb::Config.setup(:merb_root => File.dirname(__FILE__),
|
12
|
+
:environment => ENV['RACK_ENV'])
|
13
|
+
|
14
|
+
Merb.environment = Merb::Config[:environment]
|
15
|
+
Merb.root = Merb::Config[:merb_root]
|
16
|
+
|
17
|
+
Merb::BootLoader.run
|
18
|
+
|
19
|
+
run Merb::Rack::Application.new
|
@@ -1,34 +1,42 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Tasks provided by Merb are guarded with a rescue block as we need this file
|
2
|
+
# to work prior to installation of Merb.
|
3
3
|
|
4
|
-
|
4
|
+
begin
|
5
|
+
require 'merb-core'
|
6
|
+
require 'merb-core/tasks/merb'
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
include FileUtils
|
9
|
+
|
10
|
+
# Load the basic runtime dependencies; this will include
|
11
|
+
# any plugins and therefore plugin rake tasks.
|
12
|
+
init_env = ENV['MERB_ENV'] || 'rake'
|
13
|
+
Merb.load_dependencies(:environment => init_env)
|
10
14
|
|
11
|
-
# Get Merb plugins and dependencies
|
12
|
-
Merb::Plugins.rakefiles.each { |r| require r }
|
15
|
+
# Get Merb plugins and dependencies
|
16
|
+
Merb::Plugins.rakefiles.each { |r| require r }
|
13
17
|
|
14
|
-
# Load any app level custom rakefile extensions from lib/tasks
|
15
|
-
tasks_path = File.join(File.dirname(__FILE__), "lib", "tasks")
|
16
|
-
rake_files = Dir["#{tasks_path}/*.rake"]
|
17
|
-
rake_files.each{|rake_file| load rake_file }
|
18
|
+
# Load any app level custom rakefile extensions from lib/tasks
|
19
|
+
tasks_path = File.join(File.dirname(__FILE__), "lib", "tasks")
|
20
|
+
rake_files = Dir["#{tasks_path}/*.rake"]
|
21
|
+
rake_files.each{|rake_file| load rake_file }
|
18
22
|
|
19
|
-
require 'spec/rake/spectask'
|
20
|
-
require 'merb-core/test/tasks/spectasks'
|
23
|
+
require 'spec/rake/spectask'
|
24
|
+
require 'merb-core/test/tasks/spectasks'
|
25
|
+
rescue Exception
|
26
|
+
end
|
21
27
|
|
22
|
-
|
23
|
-
# ADD YOUR CUSTOM TASKS IN /lib/tasks
|
24
|
-
# NAME YOUR RAKE FILES file_name.rake
|
25
|
-
##############################################################################
|
28
|
+
# Task for loading gems needed by this template. Bootstrap to get installed...
|
26
29
|
|
27
|
-
namespace :
|
28
|
-
desc '
|
29
|
-
task :
|
30
|
-
puts '
|
31
|
-
`(
|
30
|
+
namespace :template do
|
31
|
+
desc 'Load missing gems to local gem repository'
|
32
|
+
task :gems do
|
33
|
+
puts 'Load missing gems to local gem repository'
|
34
|
+
`(sudo appcfg.rb gem install extlib merb-core) 1>&2`
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
38
|
+
# Add your own tasks...
|
39
|
+
|
40
|
+
namespace :merb do
|
41
|
+
end
|
42
|
+
|
@@ -20,7 +20,8 @@
|
|
20
20
|
</center>
|
21
21
|
</div>
|
22
22
|
<div id='footer'>
|
23
|
-
This tiny
|
23
|
+
This tiny app was generated by
|
24
24
|
<a href='http://github.com/ulbrich/jruby-enginize'>JRuby-Enginize</a>
|
25
|
+
to streamline Google AppEngine development.
|
25
26
|
</div>
|
26
27
|
</center>
|
data/templates/shared/README
CHANGED
@@ -3,18 +3,24 @@ README
|
|
3
3
|
This is a generic README generated by jruby-enginize. Please replace with
|
4
4
|
something more meaningful... ;-)
|
5
5
|
|
6
|
-
|
6
|
+
INSTALL MISSING GEMS
|
7
|
+
|
8
|
+
As a basic requirement, you have to install missing gems required by the
|
9
|
+
template (this task is implemented individually for each template):
|
10
|
+
|
11
|
+
sudo rake template:gems
|
7
12
|
|
8
|
-
!!Attention:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
!!Attention: Whenever you want to install additional gems, be sure to use
|
14
|
+
"appcfg.rb gem" provided by the Google AppEngine JRuby tools and not "jgem" as
|
15
|
+
Google maintains a local repository per project and bundles the files to
|
16
|
+
upload from that information. You will run into missing gems on the server if
|
17
|
+
you bypass this!
|
18
|
+
|
19
|
+
GOOGLE APPENGINE DEPLOYMENT
|
14
20
|
|
15
21
|
Deploy the application with
|
16
22
|
|
17
|
-
|
23
|
+
rake appengine:deploy
|
18
24
|
|
19
25
|
and open
|
20
26
|
|
@@ -22,9 +28,9 @@ and open
|
|
22
28
|
|
23
29
|
to have a first test.
|
24
30
|
|
25
|
-
Be sure to set the version number in
|
26
|
-
|
27
|
-
users getting exceptions.
|
31
|
+
Be sure to set the version number in the AppEngine::Rack.configure_app part
|
32
|
+
of "config.ru" to a new value, when you are experimenting with an unstable
|
33
|
+
version and don't want to risk your users getting exceptions.
|
28
34
|
|
29
35
|
You can try the new version by opening e.g.
|
30
36
|
|
@@ -38,3 +44,25 @@ opening
|
|
38
44
|
http://appengine.google.com/deployment?&app_id={{name}}
|
39
45
|
|
40
46
|
and setting a new default.
|
47
|
+
|
48
|
+
SOME MORE INFO
|
49
|
+
|
50
|
+
- Gems installed with "appcfg.rb gem" reside in directory ".gems". Again: Do
|
51
|
+
not use "jgem" at all!
|
52
|
+
|
53
|
+
- Some gems will throw exceptions during bundling: Have a look for paths
|
54
|
+
assembled using ".." to reach the parent directory and replace with
|
55
|
+
File.dirname(...). Retry and be a good citizen and send in the patch the
|
56
|
+
developer of that gem... ;-)
|
57
|
+
|
58
|
+
- Data uploaded to the server is gathered in directory "WEB-INF" as with any
|
59
|
+
Java project. The first time "rake appengine:run" or "rake appengine:deploy"
|
60
|
+
is called, this directory will be created and "jruby-rack-xx.jar" is
|
61
|
+
downloaded from its homepage.
|
62
|
+
|
63
|
+
The first call to "rake appengine:run" or "rake appengine:deploy" with
|
64
|
+
downloading the rack jar will fail. Just ignore and retry.
|
65
|
+
|
66
|
+
- "WEB-INF/lib/gems.jar" is only created or updated after a call to
|
67
|
+
"appcfg.rb gem". This is enforced by "rake appengine:deploy" but not by
|
68
|
+
"rake appengine:update".
|
data/templates/shared/Rakefile
CHANGED
@@ -28,82 +28,44 @@ end
|
|
28
28
|
|
29
29
|
desc 'Display some help and the README'
|
30
30
|
task :help do
|
31
|
-
puts 'Call "
|
31
|
+
puts 'Call "rake --tasks" to learn what tasks are available...'
|
32
32
|
puts
|
33
33
|
puts File.read('README')
|
34
34
|
end
|
35
35
|
|
36
36
|
task :default => [:help]
|
37
37
|
|
38
|
-
namespace :
|
39
|
-
desc '
|
40
|
-
task :
|
41
|
-
puts '
|
42
|
-
|
43
|
-
begin
|
44
|
-
baseurl = 'http://dist.codehaus.org/jruby/current'
|
45
|
-
directory = fetch(baseurl)
|
46
|
-
|
47
|
-
if directory.kind_of? Net::HTTPOK and
|
48
|
-
(match = directory.body.match(/.*"(jruby-complete-[^"]*\.jar)".*/)) and
|
49
|
-
match.length == 2
|
50
|
-
then
|
51
|
-
`(curl -o lib/jruby-complete.jar "#{baseurl}/#{match[1]}") 1>&2`
|
52
|
-
raise Errno::ENOENT if $? != 0
|
53
|
-
else
|
54
|
-
raise Errno::ENOENT
|
55
|
-
end
|
56
|
-
rescue Exception
|
57
|
-
puts '!!Could not download "jruby-complete.jar". Retry or download manually.'
|
58
|
-
exit(1)
|
59
|
-
end
|
38
|
+
namespace :appengine do
|
39
|
+
desc 'Start a local test server on port 8000'
|
40
|
+
task :run do
|
41
|
+
puts 'Start a local test server on port 8000'
|
42
|
+
`(dev_appserver.rb .) 1>&2`
|
60
43
|
end
|
61
44
|
|
62
|
-
desc '
|
63
|
-
task :
|
64
|
-
|
65
|
-
|
66
|
-
puts 'Run the jruby:download task if the JRuby JAR is missing.'
|
67
|
-
|
68
|
-
begin
|
69
|
-
File.stat(file)
|
70
|
-
|
71
|
-
`(unzip -l #{file}) 2>&1`
|
72
|
-
raise Errno::ENOENT if $? != 0
|
73
|
-
|
74
|
-
puts 'JRuby JAR already exists.'
|
75
|
-
rescue Errno::ENOENT
|
76
|
-
puts 'Need to download JRuby JAR. Downloading now...'
|
77
|
-
Rake::Task['jruby:download'].invoke
|
78
|
-
end
|
45
|
+
desc 'Force rebuilding "WEB-INF/lib/gems.jar"'
|
46
|
+
task :rebuildgems do
|
47
|
+
puts 'Force rebuilding "WEB-INF/lib/gems.jar"'
|
48
|
+
`(appcfg.rb gem help install) 2> /dev/null 1>&2`
|
79
49
|
end
|
80
|
-
end
|
81
50
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
`(jruby -S warble) 1>&2`
|
51
|
+
desc 'Build the application package'
|
52
|
+
task :bundle do
|
53
|
+
puts 'Build the application package.'
|
54
|
+
`(appcfg.rb --email={{email}} --enable_jar_splitting bundle .) 1>&2`
|
87
55
|
end
|
88
56
|
|
89
|
-
desc 'Upload the
|
90
|
-
task :
|
57
|
+
desc 'Upload the application code to the server'
|
58
|
+
task :update do
|
91
59
|
puts 'Upload the new application code (this may take a while).'
|
92
|
-
`(appcfg.
|
60
|
+
`(appcfg.rb --email={{email}} --enable_jar_splitting update .) 1>&2`
|
93
61
|
end
|
94
62
|
|
95
63
|
desc 'Roll back a blocked and halfway broken deploy'
|
96
64
|
task :rollback do
|
97
65
|
puts 'Roll back a blocked and halfway broken deploy.'
|
98
|
-
`(appcfg.
|
99
|
-
end
|
100
|
-
|
101
|
-
desc 'Remove temp stuff'
|
102
|
-
task :clean do
|
103
|
-
puts 'Remove temp stuff.'
|
104
|
-
`rm -rf tmp {{name}}.war`
|
66
|
+
`(appcfg.rb --email={{email}} rollback .) 1>&2`
|
105
67
|
end
|
106
68
|
|
107
|
-
desc 'Deploy the application (
|
108
|
-
task :deploy => [
|
69
|
+
desc 'Deploy the application (build package and upload application code)'
|
70
|
+
task :deploy => [:rebuildgems, :bundle, :update]
|
109
71
|
end
|
data/templates/sinatra/app.rb
CHANGED
@@ -5,10 +5,17 @@ require 'rubygems'
|
|
5
5
|
begin
|
6
6
|
require 'haml'
|
7
7
|
require 'sass'
|
8
|
+
|
8
9
|
require 'sinatra'
|
9
10
|
rescue LoadError => exception
|
10
|
-
|
11
|
-
|
11
|
+
end
|
12
|
+
|
13
|
+
# Helpers to include...
|
14
|
+
|
15
|
+
helpers do
|
16
|
+
include Rack::Utils
|
17
|
+
|
18
|
+
alias_method :h, :escape_html
|
12
19
|
end
|
13
20
|
|
14
21
|
# GET /
|
data/templates/sinatra/config.ru
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'appengine-rack'
|
3
|
+
|
2
4
|
require 'sinatra'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
disable :run
|
10
|
-
|
5
|
+
|
6
|
+
AppEngine::Rack.configure_app(
|
7
|
+
# :ssl_enabled => true,
|
8
|
+
:application => '{{name}}',
|
9
|
+
:version => 1)
|
10
|
+
|
11
11
|
require 'app'
|
12
12
|
|
13
13
|
run Sinatra::Application
|
@@ -1,7 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# Task for loading gems needed by this template. Bootstrap to get installed...
|
2
|
+
|
3
|
+
namespace :template do
|
4
|
+
desc 'Load missing gems to local gem repository'
|
5
|
+
task :gems do
|
6
|
+
puts 'Load missing gems to local gem repository'
|
7
|
+
`(sudo appcfg.rb gem install jruby-openssl haml sinatra) 1>&2`
|
8
|
+
puts 'Add patch for Haml 2.2.2 if needed'
|
9
|
+
`(sudo patch --batch --silent .gems/gems/haml-2.2.2/lib/haml/util.rb < lib/tasks/haml-2_2_2-util.patch) 2> /dev/null 1>&2`
|
6
10
|
end
|
7
11
|
end
|
12
|
+
|
13
|
+
# Add your own tasks...
|
14
|
+
|
15
|
+
namespace :sinatra do
|
16
|
+
end
|
@@ -14,5 +14,6 @@
|
|
14
14
|
%p
|
15
15
|
%img{ :src => '/images/sinatra_logo.png' }
|
16
16
|
%div{ :id => 'footer' }
|
17
|
-
This tiny
|
17
|
+
This tiny app was generated by
|
18
18
|
%a{ :href => 'http://github.com/ulbrich/jruby-enginize' } JRuby-Enginize
|
19
|
+
to streamline Google AppEngine development.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ulbrich-jruby-enginize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Ulbrich
|
@@ -30,8 +30,8 @@ files:
|
|
30
30
|
- templates/sinatra/views/index.haml
|
31
31
|
- templates/sinatra/public/images/sinatra_logo.png
|
32
32
|
- templates/sinatra/lib/tasks/sinatra.rake
|
33
|
+
- templates/sinatra/lib/tasks/haml-2_2_2-util.patch
|
33
34
|
- templates/sinatra/config.ru
|
34
|
-
- templates/sinatra/config/warble.rb
|
35
35
|
- templates/sinatra/app.rb
|
36
36
|
- templates/sinatra/.gitignore
|
37
37
|
- templates/shared/README
|
@@ -39,15 +39,13 @@ files:
|
|
39
39
|
- templates/shared/public/robots.txt
|
40
40
|
- templates/shared/public/images/appengine_logo.png
|
41
41
|
- templates/shared/public/favicon.ico
|
42
|
-
- templates/shared/lib/jruby-rack-0.9.4.jar
|
43
|
-
- templates/shared/appengine-web.xml
|
44
42
|
- templates/merb/views/layout.engine_app.html.erb
|
45
43
|
- templates/merb/views/index.html.erb
|
46
44
|
- templates/merb/spec/spec_helper.rb
|
47
45
|
- templates/merb/public/stylesheets/default.css
|
48
46
|
- templates/merb/public/images/merb_logo.png
|
49
47
|
- templates/merb/lib/tasks/merb.rake
|
50
|
-
- templates/merb/config
|
48
|
+
- templates/merb/config.ru
|
51
49
|
- templates/merb/config/init.rb
|
52
50
|
- templates/merb/config/framework.rb
|
53
51
|
- templates/merb/app.rb
|
@@ -55,6 +53,7 @@ files:
|
|
55
53
|
- README.rdoc
|
56
54
|
has_rdoc: true
|
57
55
|
homepage: http://github.com/ulbrich/jruby-enginize
|
56
|
+
licenses:
|
58
57
|
post_install_message:
|
59
58
|
rdoc_options:
|
60
59
|
- --exclude
|
@@ -83,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
82
|
requirements: []
|
84
83
|
|
85
84
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.3.5
|
87
86
|
signing_key:
|
88
87
|
specification_version: 2
|
89
88
|
summary: A package for generating Google AppEngine compliant JRuby projects.
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# Disable automatic framework detection by uncommenting/setting to false
|
2
|
-
# Warbler.framework_detection = false
|
3
|
-
|
4
|
-
# Warbler web application assembly configuration file
|
5
|
-
Warbler::Config.new do |config|
|
6
|
-
# Temporary directory where the application is staged
|
7
|
-
# config.staging_dir = "tmp/war"
|
8
|
-
|
9
|
-
# Application directories to be included in the webapp.
|
10
|
-
config.dirs = %w(lib public views config)
|
11
|
-
|
12
|
-
# Additional files/directories to include, above those in config.dirs
|
13
|
-
# config.includes = FileList["db"]
|
14
|
-
config.includes = FileList["appengine-web.xml", "app.rb"]
|
15
|
-
# Additional files/directories to exclude
|
16
|
-
# config.excludes = FileList["lib/tasks/*"]
|
17
|
-
|
18
|
-
# Additional Java .jar files to include. Note that if .jar files are placed
|
19
|
-
# in lib (and not otherwise excluded) then they need not be mentioned here.
|
20
|
-
# JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
|
21
|
-
# own versions if you directly set the value
|
22
|
-
# config.java_libs += FileList["lib/java/*.jar"]
|
23
|
-
|
24
|
-
# Loose Java classes and miscellaneous files to be placed in WEB-INF/classes.
|
25
|
-
# config.java_classes = FileList["target/classes/**.*"]
|
26
|
-
|
27
|
-
# One or more pathmaps defining how the java classes should be copied into
|
28
|
-
# WEB-INF/classes. The example pathmap below accompanies the java_classes
|
29
|
-
# configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
|
30
|
-
# for details of how to specify a pathmap.
|
31
|
-
# config.pathmaps.java_classes << "%{target/classes/,}p"
|
32
|
-
|
33
|
-
# Gems to be included. You need to tell Warbler which gems your application needs
|
34
|
-
# so that they can be packaged in the war file.
|
35
|
-
config.gems = ['merb-core', 'extlib']
|
36
|
-
|
37
|
-
# The most recent versions of gems are used.
|
38
|
-
# You can specify versions of gems by using a hash assignment:
|
39
|
-
# config.gems["foo"] = "2.0.2"
|
40
|
-
|
41
|
-
# You can also use regexps or Gem::Dependency objects for flexibility or
|
42
|
-
# fine-grained control.
|
43
|
-
# config.gems << /^merb-/
|
44
|
-
# config.gems << Gem::Dependency.new("merb-core", "= 0.9.3")
|
45
|
-
|
46
|
-
# Include gem dependencies not mentioned specifically
|
47
|
-
config.gem_dependencies = true
|
48
|
-
|
49
|
-
# Files to be included in the root of the webapp. Note that files in public
|
50
|
-
# will have the leading 'public/' part of the path stripped during staging.
|
51
|
-
# config.public_html = FileList["public/**/*", "doc/**/*"]
|
52
|
-
|
53
|
-
# Pathmaps for controlling how public HTML files are copied into the .war
|
54
|
-
# config.pathmaps.public_html = ["%{public/,}p"]
|
55
|
-
|
56
|
-
# Name of the war file (without the .war)
|
57
|
-
config.war_name = "{{name}}"
|
58
|
-
|
59
|
-
# Name of the MANIFEST.MF template for the war file. Defaults to the
|
60
|
-
# MANIFEST.MF normally generated by `jar cf`.
|
61
|
-
# config.manifest_file = "config/MANIFEST.MF"
|
62
|
-
|
63
|
-
# Value of environment variables
|
64
|
-
# config.webxml.foo.env = ENV['FOO_ENV']
|
65
|
-
|
66
|
-
# Application booter to use, one of :rack, :rails, or :merb
|
67
|
-
config.webxml.booter = :merb
|
68
|
-
|
69
|
-
# When using the :rack booter, "Rackup" script to use.
|
70
|
-
# The script is evaluated in a Rack::Builder to load the application.
|
71
|
-
# Examples:
|
72
|
-
# config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
|
73
|
-
# config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
|
74
|
-
|
75
|
-
# Control the pool of runtimes. Leaving unspecified means
|
76
|
-
# the pool will grow as needed to service requests. It is recommended
|
77
|
-
# that you fix these values when running a production server!
|
78
|
-
# config.webxml.jruby.min.runtimes = 2
|
79
|
-
# config.webxml.jruby.max.runtimes = 4
|
80
|
-
config.webxml.jruby.min.runtimes = 1
|
81
|
-
config.webxml.jruby.max.runtimes = 1
|
82
|
-
config.webxml.jruby.init.serial = true
|
83
|
-
|
84
|
-
config.java_libs = []
|
85
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
|
2
|
-
<application>{{name}}</application>
|
3
|
-
<version>1</version>
|
4
|
-
<static-files />
|
5
|
-
<resource-files />
|
6
|
-
<sessions-enabled>false</sessions-enabled>
|
7
|
-
<system-properties>
|
8
|
-
<property name="jruby.management.enabled" value="false" />
|
9
|
-
<property name="os.arch" value="" />
|
10
|
-
<property name="jruby.compile.mode" value="JIT"/> <!-- JIT|FORCE|OFF -->
|
11
|
-
<property name="jruby.compile.fastest" value="true"/>
|
12
|
-
<property name="jruby.compile.frameless" value="true"/>
|
13
|
-
<property name="jruby.compile.positionless" value="true"/>
|
14
|
-
<property name="jruby.compile.threadless" value="false"/>
|
15
|
-
<property name="jruby.compile.fastops" value="false"/>
|
16
|
-
<property name="jruby.compile.fastcase" value="false"/>
|
17
|
-
<property name="jruby.compile.chainsize" value="500"/>
|
18
|
-
<property name="jruby.compile.lazyHandles" value="false"/>
|
19
|
-
<property name="jruby.compile.peephole" value="true"/>
|
20
|
-
</system-properties>
|
21
|
-
</appengine-web-app>
|
Binary file
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# Disable automatic framework detection by uncommenting/setting to false
|
2
|
-
# Warbler.framework_detection = false
|
3
|
-
|
4
|
-
# Warbler web application assembly configuration file
|
5
|
-
Warbler::Config.new do |config|
|
6
|
-
# Temporary directory where the application is staged
|
7
|
-
# config.staging_dir = "tmp/war"
|
8
|
-
|
9
|
-
# Application directories to be included in the webapp.
|
10
|
-
config.dirs = %w(lib public views)
|
11
|
-
|
12
|
-
# Additional files/directories to include, above those in config.dirs
|
13
|
-
# config.includes = FileList["db"]
|
14
|
-
config.includes = FileList["appengine-web.xml", "app.rb", "config.ru"]
|
15
|
-
# Additional files/directories to exclude
|
16
|
-
# config.excludes = FileList["lib/tasks/*"]
|
17
|
-
|
18
|
-
# Additional Java .jar files to include. Note that if .jar files are placed
|
19
|
-
# in lib (and not otherwise excluded) then they need not be mentioned here.
|
20
|
-
# JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
|
21
|
-
# own versions if you directly set the value
|
22
|
-
# config.java_libs += FileList["lib/java/*.jar"]
|
23
|
-
|
24
|
-
# Loose Java classes and miscellaneous files to be placed in WEB-INF/classes.
|
25
|
-
# config.java_classes = FileList["target/classes/**.*"]
|
26
|
-
|
27
|
-
# One or more pathmaps defining how the java classes should be copied into
|
28
|
-
# WEB-INF/classes. The example pathmap below accompanies the java_classes
|
29
|
-
# configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
|
30
|
-
# for details of how to specify a pathmap.
|
31
|
-
# config.pathmaps.java_classes << "%{target/classes/,}p"
|
32
|
-
|
33
|
-
# Gems to be included. You need to tell Warbler which gems your application needs
|
34
|
-
# so that they can be packaged in the war file.
|
35
|
-
config.gems = ['sinatra', 'haml']
|
36
|
-
|
37
|
-
# The most recent versions of gems are used.
|
38
|
-
# You can specify versions of gems by using a hash assignment:
|
39
|
-
# config.gems["foo"] = "2.0.2"
|
40
|
-
|
41
|
-
# You can also use regexps or Gem::Dependency objects for flexibility or
|
42
|
-
# fine-grained control.
|
43
|
-
# config.gems << /^merb-/
|
44
|
-
# config.gems << Gem::Dependency.new("merb-core", "= 0.9.3")
|
45
|
-
|
46
|
-
# Include gem dependencies not mentioned specifically
|
47
|
-
config.gem_dependencies = true
|
48
|
-
|
49
|
-
# Files to be included in the root of the webapp. Note that files in public
|
50
|
-
# will have the leading 'public/' part of the path stripped during staging.
|
51
|
-
# config.public_html = FileList["public/**/*", "doc/**/*"]
|
52
|
-
|
53
|
-
# Pathmaps for controlling how public HTML files are copied into the .war
|
54
|
-
# config.pathmaps.public_html = ["%{public/,}p"]
|
55
|
-
|
56
|
-
# Name of the war file (without the .war)
|
57
|
-
config.war_name = "{{name}}"
|
58
|
-
|
59
|
-
# Name of the MANIFEST.MF template for the war file. Defaults to the
|
60
|
-
# MANIFEST.MF normally generated by `jar cf`.
|
61
|
-
# config.manifest_file = "config/MANIFEST.MF"
|
62
|
-
|
63
|
-
# Value of environment variables
|
64
|
-
# config.webxml.foo.env = ENV['FOO_ENV']
|
65
|
-
|
66
|
-
# Application booter to use, one of :rack, :rails, or :merb
|
67
|
-
config.webxml.booter = :rack
|
68
|
-
|
69
|
-
# When using the :rack booter, "Rackup" script to use.
|
70
|
-
# The script is evaluated in a Rack::Builder to load the application.
|
71
|
-
# Examples:
|
72
|
-
# config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
|
73
|
-
# config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
|
74
|
-
|
75
|
-
# Control the pool of runtimes. Leaving unspecified means
|
76
|
-
# the pool will grow as needed to service requests. It is recommended
|
77
|
-
# that you fix these values when running a production server!
|
78
|
-
# config.webxml.jruby.min.runtimes = 2
|
79
|
-
# config.webxml.jruby.max.runtimes = 4
|
80
|
-
config.webxml.jruby.min.runtimes = 1
|
81
|
-
config.webxml.jruby.max.runtimes = 1
|
82
|
-
config.webxml.jruby.init.serial = true
|
83
|
-
|
84
|
-
config.java_libs = []
|
85
|
-
end
|