rdmopensource-warbler 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/Gemfile +11 -0
  2. data/History.txt +167 -0
  3. data/LICENSE.txt +26 -0
  4. data/Manifest.txt +48 -0
  5. data/README.txt +194 -0
  6. data/Rakefile +92 -0
  7. data/bin/warble +11 -0
  8. data/ext/Main.java +110 -0
  9. data/ext/WarblerWar.java +115 -0
  10. data/ext/WarblerWarService.java +17 -0
  11. data/lib/warbler.rb +37 -0
  12. data/lib/warbler/application.rb +67 -0
  13. data/lib/warbler/config.rb +349 -0
  14. data/lib/warbler/gems.rb +37 -0
  15. data/lib/warbler/runtime.rb +44 -0
  16. data/lib/warbler/task.rb +224 -0
  17. data/lib/warbler/version.rb +10 -0
  18. data/lib/warbler/war.rb +226 -0
  19. data/lib/warbler_war.jar +0 -0
  20. data/spec/sample/app/controllers/application.rb +15 -0
  21. data/spec/sample/app/helpers/application_helper.rb +3 -0
  22. data/spec/sample/config/boot.rb +109 -0
  23. data/spec/sample/config/database.yml +19 -0
  24. data/spec/sample/config/environment.rb +67 -0
  25. data/spec/sample/config/environments/development.rb +17 -0
  26. data/spec/sample/config/environments/production.rb +22 -0
  27. data/spec/sample/config/environments/test.rb +22 -0
  28. data/spec/sample/config/initializers/inflections.rb +10 -0
  29. data/spec/sample/config/initializers/mime_types.rb +5 -0
  30. data/spec/sample/config/initializers/new_rails_defaults.rb +15 -0
  31. data/spec/sample/config/routes.rb +41 -0
  32. data/spec/sample/lib/tasks/utils.rake +0 -0
  33. data/spec/sample/public/404.html +30 -0
  34. data/spec/sample/public/422.html +30 -0
  35. data/spec/sample/public/500.html +30 -0
  36. data/spec/sample/public/favicon.ico +0 -0
  37. data/spec/sample/public/index.html +274 -0
  38. data/spec/sample/public/robots.txt +5 -0
  39. data/spec/spec_helper.rb +44 -0
  40. data/spec/warbler/application_spec.rb +93 -0
  41. data/spec/warbler/config_spec.rb +112 -0
  42. data/spec/warbler/gems_spec.rb +40 -0
  43. data/spec/warbler/task_spec.rb +146 -0
  44. data/spec/warbler/war_spec.rb +441 -0
  45. data/warble.rb +121 -0
  46. data/web.xml.erb +32 -0
  47. metadata +202 -0
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org/"
2
+
3
+ gem "rake", ">= 0.8.7"
4
+ gem "rdoc"
5
+ gem "rubyzip"
6
+ gem "jruby-jars"
7
+ gem "jruby-rack"
8
+ gem "rspec"
9
+ gem "diff-lcs"
10
+ gem "rcov", ">= 0.9.8"
11
+ gem "hoe", ">= 2.3.2"
@@ -0,0 +1,167 @@
1
+ == 1.1.0
2
+
3
+ - Add concept of "features" -- small Rake tasks that run before the
4
+ creation of the war file and make manipulations to the war file
5
+ structure.
6
+ - Add 'gemjar' feature: Bundle all gems into a gems.jar to reduce the
7
+ number of files in the archive (mostly useful for Google AppEngine).
8
+ Usage: run "warble gemjar war" or set config.features = %w(gemjar) in
9
+ warble.rb to use this feature.
10
+ - Add 'executable' feature: Bundle an embedded web server in the war
11
+ file so that the entire application can be run as
12
+ 'java -jar myapp.war'.
13
+ Usage: run "warble executable war" or set config.features = %w(executable)
14
+ in warble.rb to use this feature.
15
+ To see embedded webserver options, add '--help' to the 'java -jar'
16
+ command line.
17
+ - No longer embed config.ru in web.xml as 'rackup' parameter by
18
+ default. Instead, config.ru is included in the war file.
19
+ - Bump jruby-rack version requirement to 0.9.8.
20
+
21
+ == 1.0.3
22
+
23
+ - Tracking recent Bundler changes - handle locked Gemfiles differently
24
+ than unlocked ones
25
+ - Handle file-based symlinks, and warn about inoperational directory
26
+ symlinks under non-JRuby versions of Ruby.
27
+
28
+ == 1.0.2
29
+
30
+ - Add 'warble pluginize' task back. This task now just creates a
31
+ vendor/plugins/warbler/tasks/warbler.rake file. There's no need to
32
+ "vendor" all of Warbler into your application anymore.
33
+
34
+ == 1.0.1
35
+
36
+ - Fix careless bug where Warbler doesn't work with JRuby 1.4
37
+
38
+ == 1.0
39
+
40
+ - Warbler hits 1.0! There are enough structural changes in Warbler
41
+ that I feel it's time to roll the major version over to 1.0.
42
+ - Add support for Bundler. Detect Gemfiles, make sure gems are
43
+ included in the war file and rewrite .bundle/environment.rb inside
44
+ the war file.
45
+ - Warbler now uses RubyZip to create the war file in-place, without
46
+ copying files to a tmp/war staging area. When run in JRuby it uses a
47
+ Java ZipOutputStream for a modest performance boost.
48
+ - Add config option to allow override of gem_home (Daniel Harrington).
49
+ - Stop bundling jruby-rack, as promised.
50
+ - WARBLER-3: don't add from Rails config.gems if they are frozen
51
+ - WARBLER-7: Add config.webinf_files option with more support for
52
+ custom web.xml files
53
+
54
+ == 0.9.14
55
+
56
+ - So, jruby-rack is bundled for one more release. 1.0 will not contain
57
+ any jar files, I promise!
58
+ - Upgraded jruby-rack to 0.9.5.
59
+ - Unbundled jruby-complete jar in favor of new jruby-jars gem, which
60
+ can be upgraded separately.
61
+ - Skip gems which have no loaded_from attribute set
62
+ (this happened with the Authlogic gem on Edge Rails)
63
+ (thanks Laszlo Bacsi)
64
+
65
+ == 0.9.13
66
+
67
+ - RailsConf 2009 edition.
68
+ - Only bundled JRuby and JRuby-Rack upgrades. Bug fixes will have to come in 0.9.14.
69
+ - This should also be the last release with bundled JRuby and JRuby-Rack.
70
+ - Upgrade to JRuby 1.3.0RC1 and JRuby-Rack 0.9.4. The latter allows
71
+ Rails 2.3 to work with Warbler.
72
+
73
+ == 0.9.12
74
+
75
+ - Allow framework auto-detection to be disabled. Set
76
+ `Warbler.framework_detection = false' at the top of config/warble.rb
77
+ or uncomment the line from a newly generated config.
78
+ - Add configuration option to set manifest file (thanks Tommy McGuire)
79
+ - Mitigate RubyGems 1.3 compatibility issue (thanks Jens Norrgrann)
80
+ - Add experimental `war:exploded` task. This allows you to deploy your
81
+ application in an exploded mode, thus allowing continual development
82
+ without re-warring and re-deploying. Feedback is appreciated if you
83
+ try this feature; it may not work in all application servers and for
84
+ applications other than Rails.
85
+ - Handle Rails gem dependencies better (thanks Laszlo Bacsi)
86
+ - Auto-detect Merb dependencies (Merb >= 1.0 only). Please give
87
+ feedback if you try Warbler with a Merb 1.0 app.
88
+ - Ignore gem development dependencies
89
+ - Upgrade to JRuby 1.1.6 and JRuby-Rack 0.9.3
90
+
91
+ == 0.9.11
92
+
93
+ - Auto-detect Rails and Merb and configure appropriately
94
+ - For Rails, set rails booter, determine max runtimes based on Rails.configuration.threadsafe!,
95
+ add Rails gem, detect Rails version, set gems to be packaged based on
96
+ Rails.configuration.gems if available
97
+ - Rails gems only added if Rails application detected
98
+ - For Merb, set merb booter automatically
99
+ - Auto-detect config.ru rackup script and pass it into config.webxml.rackup
100
+ - rails.env now commented by default in config/warble.rb and internally default
101
+ the value to 'production'
102
+ - Default directories in config.dirs to only those that are found to be present
103
+ - Allow config.gems array to contain regexps and Gem::Dependency objects as well
104
+ (assist from Jani Soila)
105
+ - Fix bug ensuring you can += and -= for config.gems
106
+ - Upgrade to JRuby 1.1.4 and JRuby-Rack 0.9.2
107
+ - add [] as a way to specify non-identifier keys, example: config.webxml['!@#$%^'] = 'haha'
108
+
109
+ == 0.9.10
110
+
111
+ - Upgraded to JRuby-Rack 0.9.1. Fixes JRUBY-2620, JRUBY-2594, JRUBY-2507.
112
+ - Now verified to work with Camping and Sinatra. See
113
+ http://github.com/nicksieger/jruby-rack/tree/master/examples for examples
114
+ of how to configure Warbler to package your Camping and Sinatra apps.
115
+ - Upgraded to JRuby 1.1.3.
116
+ - Log files are no longer packaged in the .war file.
117
+ - Fix #<Warbler::WebxmlOpenStruct ...> appearing in web.xml and document workarounds.
118
+ - Add config.autodeploy_dir that, when specified, will create the war there.
119
+
120
+ == 0.9.9
121
+
122
+ - Now shipping with JRuby-Rack 0.9!
123
+ - Upgrade to JRuby 1.1.1
124
+ - warble.rb and web.xml.erb have changed as a result of the change to JRuby-Rack -- we
125
+ recommend comparing the new base copies with any existing configuration you have to
126
+ make sure you pick up the differences.
127
+ - Config changes:
128
+ -- config.webxml.booter chooses what kind of application to use (:rails, :merb or plain :rack).
129
+ -- config.webxml.pool.* have been replaced by config.webxml.jruby.(min|max).runtimes
130
+ -- config.webxml.standalone and config.webxml.jruby_home no longer have any effect.
131
+
132
+ == 0.9.5
133
+
134
+ - Fix bug in plugin warbler.rake task file that would favor loading warbler from gems before the version
135
+ installed as a plugin
136
+ - Upgrade to JRuby 1.1 final and Goldspike 1.6.1
137
+
138
+ == 0.9.4
139
+
140
+ - Update bundled JRuby to 1.1RC3 and Goldspike to 1.6.
141
+ - Fix inclusion of gems with platform-specific bits (e.g., Hpricot)
142
+
143
+ == 0.9.3
144
+
145
+ - Update bundled JRuby to 1.1RC2, and Goldspike to 1.5.
146
+ - The bundled JRuby and Goldspike now require JDK 5 or greater. If you wish to use JDK 1.4, use Warbler 0.9.2.
147
+
148
+ == 0.9.2
149
+
150
+ - Update bundled JRuby to version 1.0.3 and Goldspike 1.4.
151
+ - Add config.java_classes to allow you to copy loose Java classes into WEB-INF/classes.
152
+ - Make jar command a single command string so that jar creation doesn't fail (works around bug in JRuby 1.0.2)
153
+ - Use File.join to form staging directory, should produce the proper jar-command path in Windows
154
+
155
+ == 0.9.1
156
+
157
+ - Add rake >= 0.7.3 as a dependency in the gem specification.
158
+ - Add debug tasks: war:debug, war:debug:gems, war:debug:public, war:debug:app, war:debug:includes,
159
+ war:debug:excludes, war:debug:java_libs gives you a breakdown of what Warbler expects to package.
160
+
161
+ == 0.9
162
+
163
+ - Birthday! Warbler is a gem to make a .war file out of a Rails project. The intent is to provide a
164
+ minimal, flexible, ruby-like way to bundle up all of your application files for deployment to a
165
+ Java application server.
166
+ - Bundled versions: goldspike-1.4-SNAPSHOT and jruby-complete-1.0.1
167
+ - Works as both a gem (rake application) or a plugin
@@ -0,0 +1,26 @@
1
+ = Warbler
2
+
3
+ Warbler is provided under the terms of the MIT license.
4
+
5
+ Warbler (c) 2010 Engine Yard, Inc.
6
+ Warbler (c) 2007-2009 Sun Microsystems, Inc.
7
+
8
+ Permission is hereby granted, free of charge, to any person
9
+ obtaining a copy of this software and associated documentation files
10
+ (the "Software"), to deal in the Software without restriction,
11
+ including without limitation the rights to use, copy, modify, merge,
12
+ publish, distribute, sublicense, and/or sell copies of the Software,
13
+ and to permit persons to whom the Software is furnished to do so,
14
+ subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be
17
+ included in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
23
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
@@ -0,0 +1,48 @@
1
+ Gemfile
2
+ History.txt
3
+ LICENSE.txt
4
+ Manifest.txt
5
+ README.txt
6
+ Rakefile
7
+ bin/warble
8
+ ext/Main.java
9
+ ext/WarblerWar.java
10
+ ext/WarblerWarService.java
11
+ lib/warbler
12
+ lib/warbler.rb
13
+ lib/warbler/application.rb
14
+ lib/warbler/config.rb
15
+ lib/warbler/gems.rb
16
+ lib/warbler/runtime.rb
17
+ lib/warbler/task.rb
18
+ lib/warbler/version.rb
19
+ lib/warbler/war.rb
20
+ lib/warbler_war.jar
21
+ spec/sample/app/controllers/application.rb
22
+ spec/sample/app/helpers/application_helper.class
23
+ spec/sample/app/helpers/application_helper.rb
24
+ spec/sample/config/boot.rb
25
+ spec/sample/config/database.yml
26
+ spec/sample/config/environment.rb
27
+ spec/sample/config/environments/development.rb
28
+ spec/sample/config/environments/production.rb
29
+ spec/sample/config/environments/test.rb
30
+ spec/sample/config/initializers/inflections.rb
31
+ spec/sample/config/initializers/mime_types.rb
32
+ spec/sample/config/initializers/new_rails_defaults.rb
33
+ spec/sample/config/routes.rb
34
+ spec/sample/lib/tasks/utils.rake
35
+ spec/sample/public/404.html
36
+ spec/sample/public/422.html
37
+ spec/sample/public/500.html
38
+ spec/sample/public/favicon.ico
39
+ spec/sample/public/index.html
40
+ spec/sample/public/robots.txt
41
+ spec/spec_helper.rb
42
+ spec/warbler/application_spec.rb
43
+ spec/warbler/config_spec.rb
44
+ spec/warbler/gems_spec.rb
45
+ spec/warbler/task_spec.rb
46
+ spec/warbler/war_spec.rb
47
+ warble.rb
48
+ web.xml.erb
@@ -0,0 +1,194 @@
1
+ = Warbler
2
+
3
+ Warbler is a gem to make a .war file out of a Rails, Merb, or Rack-based
4
+ application. The intent is to provide a minimal, flexible, ruby-like way to
5
+ bundle up all of your application files for deployment to a Java application
6
+ server.
7
+
8
+ Warbler provides a sane set of out-of-the box defaults that should allow most
9
+ Rails applications without external gem dependencies (aside from Rails itself)
10
+ to assemble and Just Work.
11
+
12
+ == RDM Opensource Modifications
13
+
14
+ Added configuration option to allow some ruby files to be compiled to .class
15
+ files in the deployment.
16
+
17
+ config.compiled_ruby_files = FileList["app/**/*.rb", "lib/*.rb"]
18
+
19
+ == Getting Started
20
+
21
+ 1. Install the gem: <tt>gem install warbler</tt>.
22
+ 2. Run warbler in the top directory of your Rails application: <tt>warble</tt>.
23
+ 3. Deploy your myapp.war file to your favorite Java application server.
24
+
25
+ == Usage
26
+
27
+ Warbler's +warble+ command is just a small wrapper around Rake with internally
28
+ defined tasks.
29
+
30
+ $ warble -T
31
+ warble config # Generate a configuration file to customize your war
32
+ warble executable # Feature: make an executable archive
33
+ warble gemjar # Feature: package gem repository inside a jar
34
+ warble pluginize # Install Warbler tasks in your Rails application
35
+ warble version # Display version of Warbler
36
+ warble war # Create the project .war file
37
+ warble war:clean # Remove the .war file
38
+ warble war:debug # Dump diagnostic information
39
+
40
+ If you'd like to control Warbler from your own project's Rakefile,
41
+ simply add the following code somewhere in the Rakefile:
42
+
43
+ require 'warbler'
44
+ Warbler::Task.new
45
+
46
+ Now you should be able to invoke "rake war" to create your war file.
47
+
48
+ == Features
49
+
50
+ Warbler "features" are small Rake tasks that run before the creation
51
+ of the war file and make manipulations to the war file structure.
52
+
53
+ You can either add features to the warbler command line:
54
+
55
+ warble FEATURE war
56
+
57
+ or configure them in config/warble.rb to always be used.
58
+
59
+ config.features = %w(FEATURE)
60
+
61
+ Currently, two features are available.
62
+
63
+ * +gemjar+: This bundles all gems into a single gem file to reduce the
64
+ number of files in the .war. This is mostly useful for Google
65
+ AppEngine where the number of files per application has a limit.
66
+ * +executable+: This bundles an embedded web server into the .war so
67
+ that it can either be deployed into a traditional java web server or
68
+ run as a standalone application using 'java -jar myapp.war'.
69
+
70
+ Features may form the basis for a third-party plugin system in the
71
+ future if there is demand.
72
+
73
+ == Configuration
74
+
75
+ === Bundler
76
+
77
+ Applications that use Bundler[http://gembundler.com/], detected via
78
+ presence of a +Gemfile+, will have the gems packaged up into the war
79
+ file. The .bundle/environment.rb file will be included for you, and
80
+ rewritten to use the paths to the gems inside the war.
81
+
82
+ === Rails applications
83
+
84
+ Rails applications are detected automatically and configured appropriately.
85
+ The following items are set up for you:
86
+
87
+ * The Rails gem is packaged if you haven't vendored Rails.
88
+ * Other gems configured in Rails.configuration.gems are packaged
89
+ (Rails 2.1 - 2.3)
90
+ * Multi-thread-safe execution (as introduced in Rails 2.2) is detected
91
+ and runtime pooling is disabled.
92
+
93
+ === Merb applications
94
+
95
+ Merb applications are detected automatically, and the merb-core gem and its
96
+ dependencies are packaged.
97
+
98
+ === Other Rack-based applications
99
+
100
+ If you have a 'config.ru' file in the top directory or one of the
101
+ immediate subdirectories of your application, it will be included and
102
+ used as the rackup script for your Rack-based application. You will
103
+ probably need to specify framework and application gems in
104
+ config/warble.rb unless you're using Bundler to manage your gems.
105
+
106
+ See {the examples in the jruby-rack project}[http://github.com/nicksieger/jruby-rack/tree/master/examples/]
107
+ of how to configure Warbler to package Camping and Sinatra apps.
108
+
109
+ === Configuration auto-detect notes
110
+
111
+ * Warbler will load the "environment" Rake task in a Rails application
112
+ to try to detect some configuration. If you don't have database
113
+ access in the environment where you package your application, you
114
+ may wish to set `Warbler.framework_detection` to false at the top of
115
+ config.rb. In this case you may need to specify additional details
116
+ such as booter, gems and other settings that would normally be
117
+ gleaned from the application configuration.
118
+ * A more accurate way of detecting a Merb application's gems is
119
+ needed. Until then, you will have to specify them in
120
+ config/warble.rb. See below.
121
+ * Is it possible to more generally detect what gems an application
122
+ uses? Gem.loaded_specs is available, but the application needs to be
123
+ loaded first before its contents are reliable.
124
+
125
+ === Custom configuration
126
+
127
+ The default configuration puts application files (+app+, +config+, +lib+,
128
+ +log+, +vendor+, +tmp+) under the .war file's WEB-INF directory, and files in
129
+ +public+ in the root of the .war file. Any Java .jar files stored in lib will
130
+ automatically be placed in WEB-INF/lib for placement on the web app's
131
+ classpath.
132
+
133
+ If the default settings are not appropriate for your application, you can
134
+ customize Warbler's behavior. To customize files, libraries, and gems included
135
+ in the .war file, you'll need a config/warble.rb file. There a two ways of
136
+ doing this. With the gem, simply run
137
+
138
+ warble config
139
+
140
+ Finally, edit the config/warble.rb to your taste. The generated
141
+ config/warble.rb file is fully-documented with the available options
142
+ and default values.
143
+
144
+ === Web.xml
145
+
146
+ Java web applications are configured mainly through this file, and Warbler
147
+ creates a suitable default file for you for use. However, if you need to
148
+ customize it in any way, you have two options.
149
+
150
+ 1. If you just want a static web.xml file whose contents you manually
151
+ control, you may unzip the one generated for you in
152
+ <tt>yourapp.war:WEB-INF/web.xml</tt> to <tt>config/web.xml</tt> and
153
+ modify as needed. It will be copied into subsequent copies of the
154
+ war file for you.
155
+ 2. If you want to inject some dynamic information into the file, copy
156
+ the <tt>WARBLER_HOME/web.xml.erb</tt> to
157
+ <tt>config/web.xml.erb</tt>. Its contents will be evaluated for you
158
+ and put in the webapp. Note that you can also pass arbitrary
159
+ properties to the ERb template by setting
160
+ <tt>config.webxml.customkey</tt> values in your
161
+ <tt>config/warble.rb</tt> file.
162
+
163
+ For more information on configuration, see Warbler::Config.
164
+
165
+ === Troubleshooting
166
+
167
+ If Warbler isn't packaging the files you were expecting, use the
168
+ war:debug task to give you more insight into what's going on.
169
+
170
+ == Source
171
+
172
+ You can get the Warbler source using Git, in any of the following ways:
173
+
174
+ git clone git://kenai.com/warbler~main
175
+ git clone git://git.caldersphere.net/warbler.git
176
+ git clone git://github.com/nicksieger/warbler.git
177
+
178
+ You can also download a tarball of Warbler source at
179
+ http://github.com/nicksieger/warbler/tree/master.
180
+
181
+ == Development
182
+
183
+ You can develop Warbler with any implementation of Ruby. To write
184
+ Warbler code and run specs, you need to have Bundler installed
185
+ and run "bundle install" once.
186
+
187
+ After that, simply run "rake".
188
+
189
+ == License
190
+
191
+ Warbler is provided under the terms of the MIT license.
192
+
193
+ Warbler (c) 2010 Engine Yard, Inc.
194
+ Warbler (c) 2007-2009 Sun Microsystems, Inc.