lucidimagination-warbler 1.3.2.dev

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.
Files changed (75) hide show
  1. data/Gemfile +16 -0
  2. data/History.txt +217 -0
  3. data/LICENSE.txt +26 -0
  4. data/Manifest.txt +92 -0
  5. data/README.txt +255 -0
  6. data/Rakefile +103 -0
  7. data/bin/warble +11 -0
  8. data/ext/JarMain.java +148 -0
  9. data/ext/WarMain.java +112 -0
  10. data/ext/WarblerJar.java +182 -0
  11. data/ext/WarblerJarService.java +18 -0
  12. data/lib/warbler.rb +33 -0
  13. data/lib/warbler/application.rb +86 -0
  14. data/lib/warbler/config.rb +223 -0
  15. data/lib/warbler/gems.rb +37 -0
  16. data/lib/warbler/jar.rb +253 -0
  17. data/lib/warbler/task.rb +183 -0
  18. data/lib/warbler/templates/bundler.erb +3 -0
  19. data/lib/warbler/templates/config.erb +1 -0
  20. data/lib/warbler/templates/jar.erb +5 -0
  21. data/lib/warbler/templates/rack.erb +1 -0
  22. data/lib/warbler/templates/rails.erb +1 -0
  23. data/lib/warbler/templates/war.erb +1 -0
  24. data/lib/warbler/traits.rb +107 -0
  25. data/lib/warbler/traits/bundler.rb +104 -0
  26. data/lib/warbler/traits/gemspec.rb +59 -0
  27. data/lib/warbler/traits/jar.rb +56 -0
  28. data/lib/warbler/traits/merb.rb +35 -0
  29. data/lib/warbler/traits/nogemspec.rb +42 -0
  30. data/lib/warbler/traits/rack.rb +33 -0
  31. data/lib/warbler/traits/rails.rb +62 -0
  32. data/lib/warbler/traits/war.rb +197 -0
  33. data/lib/warbler/version.rb +10 -0
  34. data/lib/warbler/war.rb +8 -0
  35. data/lib/warbler_jar.jar +0 -0
  36. data/spec/drb_helper.rb +41 -0
  37. data/spec/sample_bundler/Gemfile.lock +10 -0
  38. data/spec/sample_bundler/config.ru +0 -0
  39. data/spec/sample_jar/History.txt +6 -0
  40. data/spec/sample_jar/Manifest.txt +8 -0
  41. data/spec/sample_jar/README.txt +30 -0
  42. data/spec/sample_jar/lib/sample_jar.rb +6 -0
  43. data/spec/sample_jar/sample_jar.gemspec +40 -0
  44. data/spec/sample_jar/test/test_sample_jar.rb +8 -0
  45. data/spec/sample_war/app/controllers/application.rb +15 -0
  46. data/spec/sample_war/app/helpers/application_helper.rb +3 -0
  47. data/spec/sample_war/config/boot.rb +109 -0
  48. data/spec/sample_war/config/database.yml +19 -0
  49. data/spec/sample_war/config/environment.rb +67 -0
  50. data/spec/sample_war/config/environments/development.rb +17 -0
  51. data/spec/sample_war/config/environments/production.rb +25 -0
  52. data/spec/sample_war/config/environments/test.rb +22 -0
  53. data/spec/sample_war/config/initializers/inflections.rb +10 -0
  54. data/spec/sample_war/config/initializers/mime_types.rb +5 -0
  55. data/spec/sample_war/config/initializers/new_rails_defaults.rb +15 -0
  56. data/spec/sample_war/config/routes.rb +41 -0
  57. data/spec/sample_war/lib/tasks/utils.rake +0 -0
  58. data/spec/sample_war/public/404.html +30 -0
  59. data/spec/sample_war/public/422.html +30 -0
  60. data/spec/sample_war/public/500.html +30 -0
  61. data/spec/sample_war/public/favicon.ico +0 -0
  62. data/spec/sample_war/public/index.html +274 -0
  63. data/spec/sample_war/public/robots.txt +5 -0
  64. data/spec/spec_helper.rb +112 -0
  65. data/spec/warbler/application_spec.rb +95 -0
  66. data/spec/warbler/bundler_spec.rb +136 -0
  67. data/spec/warbler/config_spec.rb +130 -0
  68. data/spec/warbler/gems_spec.rb +40 -0
  69. data/spec/warbler/jar_spec.rb +718 -0
  70. data/spec/warbler/task_spec.rb +170 -0
  71. data/spec/warbler/traits_spec.rb +17 -0
  72. data/spec/warbler/war_spec.rb +14 -0
  73. data/warble.rb +142 -0
  74. data/web.xml.erb +32 -0
  75. metadata +198 -0
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "http://rubygems.org/"
2
+
3
+ gem "rake", "~> 0.8.7"
4
+ gem "rubyzip"
5
+ gem "jruby-jars"
6
+ gem "jruby-rack"
7
+
8
+ group :development do
9
+ gem "jruby-openssl"
10
+ gem "rspec", "~> 1.3"
11
+ gem "diff-lcs"
12
+ gem "rcov", ">= 0.9.8"
13
+ gem "rubyforge"
14
+ gem "hoe", ">= 2.3.2"
15
+ gem "rdoc"
16
+ end
@@ -0,0 +1,217 @@
1
+ == 1.3.1
2
+
3
+ - Pin rake version to ~> 0.8.7 for now. Rake 0.9.0 compatibility will
4
+ follow in a future release.
5
+
6
+ == 1.3.0
7
+
8
+ - Warbler can now package regular Ruby projects as executable jar
9
+ files. See the README.txt file for details.
10
+ - WARBLER-18: Heed BUNDLE_GEMFILE in environment
11
+ - WARBLER-17: Allow config.excludes to work for files in public/
12
+ - GH#3, #12, #17: Properly bundle when BUNDLE_PATH is set or
13
+ --deployment flag is used
14
+ - JRUBY-5077, WARBLER-24: Gems from git repositories are now packaged
15
+ correctly
16
+ - GH#20: Ruby 1.9.2 support
17
+ - GH#8: Clean up compiled .class files after building war
18
+ - GH#15: Simplify detection of thread-safe Rails
19
+
20
+ == 1.2.1
21
+
22
+ - Add --directoryListings=false to Winstone launch by default. In some
23
+ cases (sinatra) Winstone's directory listing masks application
24
+ content. (Fletcher Nichol)
25
+ - Build and add META-INF/init.rb file into the war file. This is
26
+ recognized and loaded by JRuby-Rack 1.0.3 as a new way to do extra
27
+ environment initialization before the web framework is loaded. See
28
+ config.init_contents in Warbler::Config for details.
29
+
30
+ == 1.2.0
31
+
32
+ - Drop compatibility with earlier versions of Bundler -- Bundler has
33
+ changed a lot in a short period of time, so I'm expecting the number
34
+ of people depending on 0.8 or 0.9 to be small. Please use Warbler
35
+ 1.2.0 with applications that depend on Bundler 1.0 or higher.
36
+ - Support for Bundler groups. The 'development' and 'test' groups are
37
+ excluded by default.
38
+ - Add 'compiled' feature: With this feature added to config.features
39
+ Warbler will pre-compile all Ruby files and will not ship the
40
+ original Ruby source in your war file.
41
+ - warble.rb: Add config.bundle_without that controls Bundler groups to
42
+ be skipped, like 'Bundler.settings.without'.
43
+ - warble.rb: Add config.compiled_ruby_files to specify which Ruby
44
+ files to compile when using the "compiled" feature. Defaults to
45
+ compiling all Ruby files.
46
+ - warble.rb: Add config.gem_excludes which allows exclusion of some
47
+ gem files from the war. Default assumes no exclusions.
48
+ - Exclude 'tmp/war' directory so that people upgrading from 0.9 won't
49
+ accidentally include it in their war file.
50
+
51
+ == 1.1.0
52
+
53
+ - Add concept of "features" -- small Rake tasks that run before the
54
+ creation of the war file and make manipulations to the war file
55
+ structure.
56
+ - Add 'gemjar' feature: Bundle all gems into a gems.jar to reduce the
57
+ number of files in the archive (mostly useful for Google AppEngine).
58
+ Usage: run "warble gemjar war" or set config.features = %w(gemjar) in
59
+ warble.rb to use this feature.
60
+ - Add 'executable' feature: Bundle an embedded web server in the war
61
+ file so that the entire application can be run as
62
+ 'java -jar myapp.war'.
63
+ Usage: run "warble executable war" or set config.features = %w(executable)
64
+ in warble.rb to use this feature.
65
+ To see embedded webserver options, add '--help' to the 'java -jar'
66
+ command line.
67
+ - No longer embed config.ru in web.xml as 'rackup' parameter by
68
+ default. Instead, config.ru is included in the war file.
69
+ - Bump jruby-rack version requirement to 0.9.8.
70
+
71
+ == 1.0.3
72
+
73
+ - Tracking recent Bundler changes - handle locked Gemfiles differently
74
+ than unlocked ones
75
+ - Handle file-based symlinks, and warn about inoperational directory
76
+ symlinks under non-JRuby versions of Ruby.
77
+
78
+ == 1.0.2
79
+
80
+ - Add 'warble pluginize' task back. This task now just creates a
81
+ vendor/plugins/warbler/tasks/warbler.rake file. There's no need to
82
+ "vendor" all of Warbler into your application anymore.
83
+
84
+ == 1.0.1
85
+
86
+ - Fix careless bug where Warbler doesn't work with JRuby 1.4
87
+
88
+ == 1.0
89
+
90
+ - Warbler hits 1.0! There are enough structural changes in Warbler
91
+ that I feel it's time to roll the major version over to 1.0.
92
+ - Add support for Bundler. Detect Gemfiles, make sure gems are
93
+ included in the war file and rewrite .bundle/environment.rb inside
94
+ the war file.
95
+ - Warbler now uses RubyZip to create the war file in-place, without
96
+ copying files to a tmp/war staging area. When run in JRuby it uses a
97
+ Java ZipOutputStream for a modest performance boost.
98
+ - Add config option to allow override of gem_home (Daniel Harrington).
99
+ - Stop bundling jruby-rack, as promised.
100
+ - WARBLER-3: don't add from Rails config.gems if they are frozen
101
+ - WARBLER-7: Add config.webinf_files option with more support for
102
+ custom web.xml files
103
+
104
+ == 0.9.14
105
+
106
+ - So, jruby-rack is bundled for one more release. 1.0 will not contain
107
+ any jar files, I promise!
108
+ - Upgraded jruby-rack to 0.9.5.
109
+ - Unbundled jruby-complete jar in favor of new jruby-jars gem, which
110
+ can be upgraded separately.
111
+ - Skip gems which have no loaded_from attribute set
112
+ (this happened with the Authlogic gem on Edge Rails)
113
+ (thanks Laszlo Bacsi)
114
+
115
+ == 0.9.13
116
+
117
+ - RailsConf 2009 edition.
118
+ - Only bundled JRuby and JRuby-Rack upgrades. Bug fixes will have to come in 0.9.14.
119
+ - This should also be the last release with bundled JRuby and JRuby-Rack.
120
+ - Upgrade to JRuby 1.3.0RC1 and JRuby-Rack 0.9.4. The latter allows
121
+ Rails 2.3 to work with Warbler.
122
+
123
+ == 0.9.12
124
+
125
+ - Allow framework auto-detection to be disabled. Set
126
+ `Warbler.framework_detection = false' at the top of config/warble.rb
127
+ or uncomment the line from a newly generated config.
128
+ - Add configuration option to set manifest file (thanks Tommy McGuire)
129
+ - Mitigate RubyGems 1.3 compatibility issue (thanks Jens Norrgrann)
130
+ - Add experimental `war:exploded` task. This allows you to deploy your
131
+ application in an exploded mode, thus allowing continual development
132
+ without re-warring and re-deploying. Feedback is appreciated if you
133
+ try this feature; it may not work in all application servers and for
134
+ applications other than Rails.
135
+ - Handle Rails gem dependencies better (thanks Laszlo Bacsi)
136
+ - Auto-detect Merb dependencies (Merb >= 1.0 only). Please give
137
+ feedback if you try Warbler with a Merb 1.0 app.
138
+ - Ignore gem development dependencies
139
+ - Upgrade to JRuby 1.1.6 and JRuby-Rack 0.9.3
140
+
141
+ == 0.9.11
142
+
143
+ - Auto-detect Rails and Merb and configure appropriately
144
+ - For Rails, set rails booter, determine max runtimes based on Rails.configuration.threadsafe!,
145
+ add Rails gem, detect Rails version, set gems to be packaged based on
146
+ Rails.configuration.gems if available
147
+ - Rails gems only added if Rails application detected
148
+ - For Merb, set merb booter automatically
149
+ - Auto-detect config.ru rackup script and pass it into config.webxml.rackup
150
+ - rails.env now commented by default in config/warble.rb and internally default
151
+ the value to 'production'
152
+ - Default directories in config.dirs to only those that are found to be present
153
+ - Allow config.gems array to contain regexps and Gem::Dependency objects as well
154
+ (assist from Jani Soila)
155
+ - Fix bug ensuring you can += and -= for config.gems
156
+ - Upgrade to JRuby 1.1.4 and JRuby-Rack 0.9.2
157
+ - add [] as a way to specify non-identifier keys, example: config.webxml['!@#$%^'] = 'haha'
158
+
159
+ == 0.9.10
160
+
161
+ - Upgraded to JRuby-Rack 0.9.1. Fixes JRUBY-2620, JRUBY-2594, JRUBY-2507.
162
+ - Now verified to work with Camping and Sinatra. See
163
+ http://github.com/nicksieger/jruby-rack/tree/master/examples for examples
164
+ of how to configure Warbler to package your Camping and Sinatra apps.
165
+ - Upgraded to JRuby 1.1.3.
166
+ - Log files are no longer packaged in the .war file.
167
+ - Fix #<Warbler::WebxmlOpenStruct ...> appearing in web.xml and document workarounds.
168
+ - Add config.autodeploy_dir that, when specified, will create the war there.
169
+
170
+ == 0.9.9
171
+
172
+ - Now shipping with JRuby-Rack 0.9!
173
+ - Upgrade to JRuby 1.1.1
174
+ - warble.rb and web.xml.erb have changed as a result of the change to JRuby-Rack -- we
175
+ recommend comparing the new base copies with any existing configuration you have to
176
+ make sure you pick up the differences.
177
+ - Config changes:
178
+ -- config.webxml.booter chooses what kind of application to use (:rails, :merb or plain :rack).
179
+ -- config.webxml.pool.* have been replaced by config.webxml.jruby.(min|max).runtimes
180
+ -- config.webxml.standalone and config.webxml.jruby_home no longer have any effect.
181
+
182
+ == 0.9.5
183
+
184
+ - Fix bug in plugin warbler.rake task file that would favor loading warbler from gems before the version
185
+ installed as a plugin
186
+ - Upgrade to JRuby 1.1 final and Goldspike 1.6.1
187
+
188
+ == 0.9.4
189
+
190
+ - Update bundled JRuby to 1.1RC3 and Goldspike to 1.6.
191
+ - Fix inclusion of gems with platform-specific bits (e.g., Hpricot)
192
+
193
+ == 0.9.3
194
+
195
+ - Update bundled JRuby to 1.1RC2, and Goldspike to 1.5.
196
+ - The bundled JRuby and Goldspike now require JDK 5 or greater. If you wish to use JDK 1.4, use Warbler 0.9.2.
197
+
198
+ == 0.9.2
199
+
200
+ - Update bundled JRuby to version 1.0.3 and Goldspike 1.4.
201
+ - Add config.java_classes to allow you to copy loose Java classes into WEB-INF/classes.
202
+ - Make jar command a single command string so that jar creation doesn't fail (works around bug in JRuby 1.0.2)
203
+ - Use File.join to form staging directory, should produce the proper jar-command path in Windows
204
+
205
+ == 0.9.1
206
+
207
+ - Add rake >= 0.7.3 as a dependency in the gem specification.
208
+ - Add debug tasks: war:debug, war:debug:gems, war:debug:public, war:debug:app, war:debug:includes,
209
+ war:debug:excludes, war:debug:java_libs gives you a breakdown of what Warbler expects to package.
210
+
211
+ == 0.9
212
+
213
+ - Birthday! Warbler is a gem to make a .war file out of a Rails project. The intent is to provide a
214
+ minimal, flexible, ruby-like way to bundle up all of your application files for deployment to a
215
+ Java application server.
216
+ - Bundled versions: goldspike-1.4-SNAPSHOT and jruby-complete-1.0.1
217
+ - 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-2011 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,92 @@
1
+ Gemfile
2
+ History.txt
3
+ LICENSE.txt
4
+ Manifest.txt
5
+ README.txt
6
+ Rakefile
7
+ bin/warble
8
+ ext/JarMain.java
9
+ ext/WarMain.java
10
+ ext/WarblerJar.java
11
+ ext/WarblerJarService.java
12
+ lib/warbler
13
+ lib/warbler.rb
14
+ lib/warbler/application.rb
15
+ lib/warbler/config.rb
16
+ lib/warbler/gems.rb
17
+ lib/warbler/jar.rb
18
+ lib/warbler/task.rb
19
+ lib/warbler/templates
20
+ lib/warbler/templates/bundler.erb
21
+ lib/warbler/templates/config.erb
22
+ lib/warbler/templates/jar.erb
23
+ lib/warbler/templates/rack.erb
24
+ lib/warbler/templates/rails.erb
25
+ lib/warbler/templates/war.erb
26
+ lib/warbler/traits
27
+ lib/warbler/traits.rb
28
+ lib/warbler/traits/bundler.rb
29
+ lib/warbler/traits/gemspec.rb
30
+ lib/warbler/traits/jar.rb
31
+ lib/warbler/traits/merb.rb
32
+ lib/warbler/traits/nogemspec.rb
33
+ lib/warbler/traits/rack.rb
34
+ lib/warbler/traits/rails.rb
35
+ lib/warbler/traits/war.rb
36
+ lib/warbler/version.rb
37
+ lib/warbler/war.rb
38
+ lib/warbler_jar.jar
39
+ spec/drb_helper.rb
40
+ spec/sample_bundler/Gemfile.lock
41
+ spec/sample_bundler/config.ru
42
+ spec/sample_bundler/vendor/bundle/jruby/1.8
43
+ spec/sample_bundler/vendor/bundle/jruby/1.8/cache/rake-0.8.7.gem
44
+ spec/sample_bundler/vendor/bundle/jruby/1.8/gems/rake-0.8.7
45
+ spec/sample_bundler/vendor/bundle/jruby/1.8/gems/rake-0.8.7/lib/rake.rb
46
+ spec/sample_bundler/vendor/bundle/jruby/1.8/specifications/rake-0.8.7.gemspec
47
+ spec/sample_bundler/vendor/bundle/ruby/1.8
48
+ spec/sample_bundler/vendor/bundle/ruby/1.8/cache/rake-0.8.7.gem
49
+ spec/sample_bundler/vendor/bundle/ruby/1.8/gems/rake-0.8.7
50
+ spec/sample_bundler/vendor/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb
51
+ spec/sample_bundler/vendor/bundle/ruby/1.8/specifications/rake-0.8.7.gemspec
52
+ spec/sample_bundler/vendor/bundle/ruby/1.9.1
53
+ spec/sample_bundler/vendor/bundle/ruby/1.9.1/cache/rake-0.8.7.gem
54
+ spec/sample_bundler/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7
55
+ spec/sample_bundler/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb
56
+ spec/sample_bundler/vendor/bundle/ruby/1.9.1/specifications/rake-0.8.7.gemspec
57
+ spec/sample_jar/History.txt
58
+ spec/sample_jar/Manifest.txt
59
+ spec/sample_jar/README.txt
60
+ spec/sample_jar/lib/sample_jar.rb
61
+ spec/sample_jar/sample_jar.gemspec
62
+ spec/sample_jar/test/test_sample_jar.rb
63
+ spec/sample_war/app/controllers/application.rb
64
+ spec/sample_war/app/helpers/application_helper.rb
65
+ spec/sample_war/config/boot.rb
66
+ spec/sample_war/config/database.yml
67
+ spec/sample_war/config/environment.rb
68
+ spec/sample_war/config/environments/development.rb
69
+ spec/sample_war/config/environments/production.rb
70
+ spec/sample_war/config/environments/test.rb
71
+ spec/sample_war/config/initializers/inflections.rb
72
+ spec/sample_war/config/initializers/mime_types.rb
73
+ spec/sample_war/config/initializers/new_rails_defaults.rb
74
+ spec/sample_war/config/routes.rb
75
+ spec/sample_war/lib/tasks/utils.rake
76
+ spec/sample_war/public/404.html
77
+ spec/sample_war/public/422.html
78
+ spec/sample_war/public/500.html
79
+ spec/sample_war/public/favicon.ico
80
+ spec/sample_war/public/index.html
81
+ spec/sample_war/public/robots.txt
82
+ spec/spec_helper.rb
83
+ spec/warbler/application_spec.rb
84
+ spec/warbler/bundler_spec.rb
85
+ spec/warbler/config_spec.rb
86
+ spec/warbler/gems_spec.rb
87
+ spec/warbler/jar_spec.rb
88
+ spec/warbler/task_spec.rb
89
+ spec/warbler/traits_spec.rb
90
+ spec/warbler/war_spec.rb
91
+ warble.rb
92
+ web.xml.erb
@@ -0,0 +1,255 @@
1
+ = Warbler
2
+
3
+ Warbler is a gem to make a Java jar or war file out of any Ruby,
4
+ Rails, Merb, or Rack application. Warbler provides a minimal,
5
+ flexible, Ruby-like way to bundle up all of your application files for
6
+ deployment to a Java environment.
7
+
8
+ Warbler provides a sane set of out-of-the box defaults that should allow most
9
+ Ruby applications to assemble and Just Work.
10
+
11
+ == Getting Started
12
+
13
+ 1. Install the gem: <tt>gem install warbler</tt>.
14
+ 2. Run warbler in the top directory of your application: <tt>warble</tt>.
15
+ 3a. For a web project, deploy your myapp.war file to your favorite Java
16
+ application server.
17
+ 3b. For a standalone applications, just run it: <tt>java -jar myapp.jar</tt>.
18
+
19
+ == Usage
20
+
21
+ Warbler's +warble+ command is just a small wrapper around Rake with internally
22
+ defined tasks.
23
+
24
+ $ warble -T
25
+ warble compiled # Feature: precompile all Ruby files
26
+ warble config # Generate a configuration file to customize your archive
27
+ warble executable # Feature: make an executable archive
28
+ warble gemjar # Feature: package gem repository inside a war
29
+ warble pluginize # Install Warbler tasks in your Rails application
30
+ warble version # Display version of Warbler
31
+ warble war # Create the project war file
32
+ warble war:clean # Remove the project war file
33
+ warble war:debug # Dump diagnostic information
34
+
35
+ Type <tt>warble</tt> to create the jar or war file.
36
+
37
+ == Features
38
+
39
+ Warbler "features" are small Rake tasks that run before the creation
40
+ of the war file and make manipulations to the archive structure. For
41
+ instance, the +executable+ feature makes your war file capable of
42
+ running on its own, without a servlet container:
43
+
44
+ warble executable war
45
+
46
+ You can either add features to the warbler command line:
47
+
48
+ warble FEATURE war
49
+
50
+ or configure them in config/warble.rb to always be used.
51
+
52
+ config.features = %w(FEATURE)
53
+
54
+ Currently, three features are available.
55
+
56
+ * +gemjar+: This bundles all gems into a single gem file to reduce the
57
+ number of files in the .war. This is mostly useful for Google
58
+ AppEngine where the number of files per application has a limit.
59
+ (Note: not applicable for jar-based applications.)
60
+ * +executable+: This bundles an embedded web server into the .war so
61
+ that it can either be deployed into a traditional java web server or
62
+ run as a standalone application using <tt>java -jar myapp.war</tt>.
63
+ (Note: jar-based applications are executable by default.)
64
+ * +compiled+: This uses +jrubyc+ to precompile all .rb files in your
65
+ application to .class files and includes those in the .war instead
66
+ of the Ruby sources.
67
+
68
+ Features may form the basis for a third-party plugin system in the
69
+ future if there is demand.
70
+
71
+ == War or Jar?
72
+
73
+ War-based projects are for Rails, Merb, or Rack-based web
74
+ applications. They usually contain a <tt>config/environment.rb</tt>
75
+ file, a <tt>config/init.rb</tt> file, or a <tt>config.ru</tt> file.
76
+ The presence of these files are used to determine if the project
77
+ is a web application, and thus a Java EE compatible war file is built
78
+ for the project.
79
+
80
+ Jar-based projects are for standalone Ruby applications. Usually a
81
+ Ruby application has a launcher script in the <tt>bin</tt> directory
82
+ and Ruby code in the <tt>lib</tt> directory. Warbler packages the
83
+ application so that <tt>java -jar myapp.jar</tt> runs the launcher
84
+ script.
85
+
86
+ == Jar Files
87
+
88
+ === Gem Specification (gemspec) Files
89
+
90
+ If your project has a <tt>.gemspec</tt> file in the top directory, it
91
+ will be used to configure the project's dependencies, launcher script,
92
+ require paths, and the files to be included in the archive. For best
93
+ results make sure your gemspec specifies all of the following
94
+ attributes:
95
+
96
+ * +executables+
97
+ * +require_paths+
98
+ * runtime dependencies added with +add_dependency+
99
+
100
+ If your project do not have a <tt>.gemspec</tt>, Warbler will attempt
101
+ to guess the launcher from the contents of the <tt>bin</tt> directory
102
+ and use the <tt>lib</tt> directory as the lone require path. All files
103
+ in the project will be included in the archive.
104
+
105
+ === Bundler
106
+
107
+ Applications that use Bundler[http://gembundler.com/], detected via
108
+ presence of a +Gemfile+, will have the gems packaged up into the
109
+ archive along with the Gemfile. The Bundler groups named
110
+ +:development+ and +:test+ will be excluded by default, unless you
111
+ specify with +config.bundle_without+ in +config/warble.rb+.
112
+
113
+ Warbler supports Bundler for gems and git repositories, but not for
114
+ plain path components. Warbler will warn when a +:path+ component is
115
+ found in the +Gemfile+ and will refuse to include it in the archive.
116
+
117
+ == War Files
118
+
119
+ === Rails applications
120
+
121
+ Rails applications are detected automatically and configured appropriately.
122
+ The following items are set up for you:
123
+
124
+ * Your application runs in the +production+ environment by default.
125
+ Change it in <tt>config/warble.rb</tt> (see below).
126
+ * The Rails gem is packaged if you haven't vendored Rails (Rails <= 2.x).
127
+ * Other gems configured in Rails.configuration.gems are packaged
128
+ (Rails 2.1 - 2.3)
129
+ * Multi-thread-safe execution (as introduced in Rails 2.2) is detected
130
+ and runtime pooling is disabled.
131
+
132
+ === Merb applications
133
+
134
+ Merb applications are detected automatically, and the merb-core gem and its
135
+ dependencies are packaged.
136
+
137
+ === Other Rack-based applications
138
+
139
+ If you have a +config.ru+ file in the top directory or one of the
140
+ immediate subdirectories of your application, it will be included and
141
+ used as the rackup script for your Rack-based application. You will
142
+ probably need to specify framework and application gems in
143
+ config/warble.rb unless you're using Bundler to manage your gems.
144
+ <tt>ENV['RACK_ENV']</tt> will be set to +production+.
145
+
146
+ See {the examples in the jruby-rack project}[http://github.com/nicksieger/jruby-rack/tree/master/examples/]
147
+ of how to configure Warbler to package Camping and Sinatra apps.
148
+
149
+ === Configuration auto-detect notes
150
+
151
+ * Warbler will load the +environment+ Rake task in a Rails application
152
+ to try to detect some configuration. If you don't have database
153
+ access in the environment where you package your application, you
154
+ may wish to set +Warbler.framework_detection+ to false at the top of
155
+ config.rb. In this case you may need to specify additional details
156
+ such as booter, gems and other settings that would normally be
157
+ gleaned from the application configuration.
158
+ * A more accurate way of detecting a Merb application's gems is
159
+ needed. Until then, you will have to specify them in
160
+ +config/warble.rb+. See below.
161
+ * Is it possible to more generally detect what gems an application
162
+ uses? Gem.loaded_specs is available, but the application needs to be
163
+ loaded first before its contents are reliable.
164
+
165
+ == Custom configuration
166
+
167
+ If the default settings are not appropriate for your application, you can
168
+ customize Warbler's behavior. To customize files, libraries, and gems included
169
+ in the .war file, you'll need a config/warble.rb file. There a two ways of
170
+ doing this. With the gem, simply run
171
+
172
+ warble config
173
+
174
+ Finally, edit the config/warble.rb to your taste. The generated
175
+ config/warble.rb file is fully-documented with the available options
176
+ and default values.
177
+
178
+ === War layout
179
+
180
+ The default configuration puts application files (+app+, +config+, +lib+,
181
+ +log+, +vendor+, +tmp+) under the .war file's WEB-INF directory, and files in
182
+ +public+ in the root of the .war file. Any Java .jar files stored in lib will
183
+ automatically be placed in WEB-INF/lib for placement on the web app's
184
+ classpath.
185
+
186
+ === Web.xml
187
+
188
+ Java web applications are configured mainly through this file, and Warbler
189
+ creates a suitable default file for you for use. However, if you need to
190
+ customize it in any way, you have two options.
191
+
192
+ 1. If you just want a static web.xml file whose contents you manually
193
+ control, you may unzip the one generated for you in
194
+ <tt>yourapp.war:WEB-INF/web.xml</tt> to <tt>config/web.xml</tt> and
195
+ modify as needed. It will be copied into subsequent copies of the
196
+ war file for you.
197
+ 2. If you want to inject some dynamic information into the file, copy
198
+ the <tt>WARBLER_HOME/web.xml.erb</tt> to
199
+ <tt>config/web.xml.erb</tt>. Its contents will be evaluated for you
200
+ and put in the webapp. Note that you can also pass arbitrary
201
+ properties to the ERb template by setting
202
+ <tt>config.webxml.customkey</tt> values in your
203
+ <tt>config/warble.rb</tt> file.
204
+
205
+ For more information on configuration, see Warbler::Config.
206
+
207
+ == Rakefile integration
208
+
209
+ If you'd like to control Warbler from your own project's Rakefile,
210
+ simply add the following code somewhere in the Rakefile:
211
+
212
+ require 'warbler'
213
+ Warbler::Task.new
214
+
215
+ If you're using Bundler, you'll want to add Warbler to your Gemfile:
216
+
217
+ group :development do
218
+ gem "warbler"
219
+ end
220
+
221
+ Now you should be able to invoke "rake war" to create your war file.
222
+
223
+ == Troubleshooting
224
+
225
+ If Warbler isn't packaging the files you were expecting, use the
226
+ +war:debug+ task to give you more insight into what's going on.
227
+
228
+ If you think you found a bug, please file one at
229
+ http://kenai.com/jira/browse/WARBLER.
230
+
231
+ == Source
232
+
233
+ You can get the Warbler source using Git, in any of the following ways:
234
+
235
+ git clone git://git.caldersphere.net/warbler.git
236
+ git clone git://github.com/nicksieger/warbler.git
237
+ git clone git://kenai.com/warbler~main
238
+
239
+ You can also download a tarball of Warbler source at
240
+ http://github.com/nicksieger/warbler/tree/master.
241
+
242
+ == Development
243
+
244
+ You can develop Warbler with any implementation of Ruby. To write
245
+ Warbler code and run specs, you need to have Bundler installed
246
+ and run "bundle install" once.
247
+
248
+ After that, simply run "rake".
249
+
250
+ == License
251
+
252
+ Warbler is provided under the terms of the MIT license.
253
+
254
+ Warbler (c) 2010-2011 Engine Yard, Inc.
255
+ Warbler (c) 2007-2009 Sun Microsystems, Inc.