Skip to content

Commit 387bfc4

Browse files
committed
Merge pull request #138 from kares/readme
README review
2 parents 9eb1f90 + c1c6950 commit 387bfc4

File tree

1 file changed

+95
-104
lines changed

1 file changed

+95
-104
lines changed

README.rdoc

Lines changed: 95 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
= Warbler {<img src="https://travis-ci.org/jruby/warbler.png" />}[https://travis-ci.org/jruby/warbler]
22

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.
3+
Warbler is a gem to make a Java jar or war file out of any Ruby, Rails or Rack
4+
application. Warbler provides a minimal, flexible, Ruby-like way to bundle up
5+
all of your application files for deployment to a Java environment.
76

87
Warbler provides a sane set of out-of-the box defaults that should allow most
98
Ruby applications to assemble and Just Work.
@@ -14,7 +13,8 @@ Ruby applications to assemble and Just Work.
1413

1514
2. Run warbler in the top directory of your application: <tt>warble</tt>.
1615

17-
3a. For a web project, deploy your myapp.war file to your favorite Java application server.
16+
3a. For a web project, deploy your +myapp.war+ file to your favorite Java
17+
application server.
1818

1919
3b. For a standalone applications, just run it: <tt>java -jar myapp.jar</tt>.
2020

@@ -26,22 +26,24 @@ defined tasks.
2626
$ warble -T
2727
warble compiled # Feature: precompile all Ruby files
2828
warble config # Generate a configuration file to customize your archive
29-
warble executable # Feature: make an executable archive
30-
warble gemjar # Feature: package gem repository inside a war
29+
warble executable # Feature: make an executable archive (runnable + an emb...
30+
warble gemjar # Feature: package gem repository inside a jar
3131
warble pluginize # Install Warbler tasks in your Rails application
32+
warble runnable # Feature: make a runnable archive (e.g. java -jar rails...
3233
warble version # Display version of Warbler
3334
warble war # Create the project war file
3435
warble war:clean # Remove the project war file
3536
warble war:debug # Dump diagnostic information
3637

38+
3739
Type <tt>warble</tt> to create the jar or war file.
3840

3941
== Features
4042

41-
Warbler "features" are small Rake tasks that run before the creation
42-
of the war file and make manipulations to the archive structure. For
43-
instance, the +executable+ feature makes your war file capable of
44-
running on its own, without a servlet container:
43+
Warbler "features" are small Rake tasks that run before the creation of the war
44+
file and make manipulations to the archive structure. For instance, the
45+
+executable+ feature makes your war file capable of running on its own,
46+
without a servlet container (using an embedded web server) :
4547

4648
warble executable war
4749

@@ -53,83 +55,81 @@ or configure them in <tt>config/warble.rb</tt> to always be used.
5355

5456
config.features = %w(FEATURE)
5557

56-
Currently, three features are available.
58+
Currently, the following features are available :
5759

5860
* +gemjar+: This bundles all gems into a single gem file to reduce the
5961
number of files in the .war. This is mostly useful for Google
6062
AppEngine where the number of files per application has a limit.
6163
(Note: not applicable for jar-based applications.)
62-
* +executable+: This bundles an embedded web server into the .war so
63-
that it can either be deployed into a traditional java web server or
64-
run as a standalone application using <tt>java -jar myapp.war</tt>.
64+
* +runnable+: This makes a (standard Java) runnable .war archive thus you can
65+
execute binary bundled (gem) commands e.g. "rake". You should use the -S
66+
switch to specify the binary followed by any arguments in takes e.g.
67+
<tt>java -jar myrailsapp.war -S rake db:migrate</tt>.
68+
* +executable+: This bundles an embedded web server into the .war so that it
69+
can either be deployed into a traditional java web server or run as a
70+
standalone application using <tt>java -jar myapp.war</tt>.
6571
(Note: jar-based applications are executable by default.)
66-
* +compiled+: This uses +jrubyc+ to precompile all .rb files in your
67-
application to .class files and includes those in the .war instead
68-
of the Ruby sources. NOTE: The war file will still contain .rb
69-
files, but they will be short stubs containing the following code:
70-
71-
require __FILE__.sub(/\.rb$/, '.class')
72+
* +compiled+: This uses +jrubyc+ to precompile all .rb files in your application
73+
to .class files and includes those in the .war instead of the Ruby sources.
74+
NOTE: The war file will still contain .rb files, but they will be short stubs
75+
containing the following code : <tt>load __FILE__.sub(/\.rb$/, '.class')</tt>
7276

73-
Features may form the basis for a third-party plugin system in the
74-
future if there is demand.
77+
Features may form the basis for a third-party plugin system (in the future)
78+
if there is demand.
7579

76-
NOTE: Feature tasks must be included in the same command invocation
77-
and inserted before the +war+ task in order to take effect. For
78-
example, <tt>warble compiled; warble war</tt> does not compile and
79-
obfuscate +.rb+ sources because the second invocation of +warble+ does
80-
not run the +compiled+ feature and creates a basic war with the
81-
sources included. Always make sure you run
80+
NOTE: Feature tasks must be included in the same command invocation and
81+
inserted before the +war+ task in order to take effect. For example,
82+
<tt>warble compiled; warble war</tt> does not compile and obfuscate +.rb+
83+
sources because the second invocation of +warble+ does not run the +compiled+
84+
feature and creates a basic war with the sources included, make sure you run :
8285

8386
warble compiled war
8487

85-
or, if it's important that the war always be compiled, use the option
86-
above to put the feature in your <tt>config/warble.rb</tt>.
88+
or, if it's important that the war always be compiled, use the option above to
89+
put the feature in your <tt>config/warble.rb</tt>.
8790

8891
== War or Jar?
8992

90-
War-based projects are for Rails, Merb, or Rack-based web
91-
applications. They usually contain a <tt>config/environment.rb</tt>
92-
file, a <tt>config/init.rb</tt> file, or a <tt>config.ru</tt> file.
93-
The presence of these files are used to determine if the project
94-
is a web application, and thus a Java EE compatible war file is built
95-
for the project.
93+
War-based projects are for Rails, Merb, or Rack-based web applications.
94+
They usually contain a +config/environment.rb+ file, a +config/init.rb+ file,
95+
or a +config.ru+ file.
96+
The presence of these files are used to determine if the project is a web
97+
application, and thus a Java EE compatible war file is built for the project.
9698

97-
Jar-based projects are for standalone Ruby applications. Usually a
98-
Ruby application has a launcher script in the <tt>bin</tt> directory
99-
and Ruby code in the <tt>lib</tt> directory. Warbler packages the
100-
application so that <tt>java -jar myapp.jar</tt> runs the launcher
101-
script.
99+
Jar-based projects are for standalone Ruby applications. Usually a Ruby
100+
application has a launcher script in the +bin+ directory and Ruby code
101+
in the <tt>lib</tt> directory. Warbler packages the application so that
102+
<tt>java -jar myapp.jar</tt> runs the launcher script.
102103

103104
== Jar Files
104105

105106
=== Gem Specification (gemspec) Files
106107

107-
If your project has a <tt>.gemspec</tt> file in the top directory, it
108-
will be used to configure the project's dependencies, launcher script,
109-
require paths, and the files to be included in the archive. For best
110-
results make sure your gemspec specifies all of the following
111-
attributes:
108+
If your project has a <tt>.gemspec</tt> file in the top directory, it will be
109+
used to configure the project's dependencies, launcher script, require paths,
110+
and the files to be included in the archive. For best results make sure your
111+
gemspec specifies all of the following attributes:
112112

113113
* +executables+
114114
* +require_paths+
115115
* runtime dependencies added with +add_dependency+
116116

117-
If your project do not have a <tt>.gemspec</tt>, Warbler will attempt
118-
to guess the launcher from the contents of the <tt>bin</tt> directory
119-
and use the <tt>lib</tt> directory as the lone require path. All files
120-
in the project will be included in the archive.
117+
If your project do not have a <tt>.gemspec</tt>, Warbler will attempt to guess
118+
the launcher from the contents of the <tt>bin</tt> directory and use the
119+
<tt>lib</tt> directory as the lone require path. All files in the project
120+
will be included in the archive.
121121

122122
=== Bundler
123123

124-
Applications that use Bundler[http://gembundler.com/], detected via
125-
presence of a +Gemfile+, will have the gems packaged up into the
126-
archive along with the Gemfile. The Bundler groups named
127-
+:development+ +:test+ and +:assets+ will be excluded by default, unless
128-
you specify with +config.bundle_without+ in +config/warble.rb+.
124+
Applications that use Bundler[http://gembundler.com/], detected via presence of
125+
a +Gemfile+, will have the gems packaged up into the archive along with the
126+
Gemfile. The Bundler groups named ":development", ":test" and ":assets" will be
127+
excluded by default, unless you specify with <tt>config.bundle_without</tt> in
128+
+config/warble.rb+.
129129

130-
Warbler supports Bundler for gems and git repositories, but not for
131-
plain path components. Warbler will warn when a +:path+ component is
132-
found in the +Gemfile+ and will refuse to include it in the archive.
130+
Warbler supports Bundler for gems and git repositories, but not for plain path
131+
components. Warbler will warn when a +:path+ component is found in the +Gemfile+
132+
and will refuse to include it in the archive.
133133

134134
== War Files
135135

@@ -138,42 +138,34 @@ found in the +Gemfile+ and will refuse to include it in the archive.
138138
Rails applications are detected automatically and configured appropriately.
139139
The following items are set up for you:
140140

141-
* Your application runs in the +production+ environment by default. Change it in <tt>config/warble.rb</tt> (see below).
141+
* Your application runs in the +production+ environment by default.
142+
Change it in +config/warble.rb+ (see below).
142143
* The Rails gem is packaged if you haven't vendored Rails (Rails <= 2.x).
143-
* Other gems configured in Rails.configuration.gems are packaged (Rails 2.1 - 2.3)
144-
* Multi-thread-safe execution (as introduced in Rails 2.2) is detected and runtime pooling is disabled.
145-
146-
=== Merb applications
147-
148-
Merb applications are detected automatically, and the merb-core gem and its
149-
dependencies are packaged.
144+
* Other gems configured in Rails.configuration.gems are packaged (2.1 - 2.3)
145+
* Multi-thread-safe execution (as introduced in Rails 2.2) is detected and
146+
runtime pooling is disabled.
150147

151148
=== Other Rack-based applications
152149

153-
If you have a +config.ru+ file in the top directory or one of the
154-
immediate subdirectories of your application, it will be included and
155-
used as the rackup script for your Rack-based application. You will
156-
probably need to specify framework and application gems in
157-
config/warble.rb unless you're using Bundler to manage your gems.
158-
<tt>ENV['RACK_ENV']</tt> will be set to +production+.
150+
If you have a +config.ru+ file in the top directory or one of the immediate
151+
subdirectories of your application, it will be included and used as the rackup
152+
script for your Rack-based application. You will probably need to specify
153+
framework and application gems in +config/warble.rb+ unless you're using Bundler
154+
to manage your gems. <tt>ENV['RACK_ENV']</tt> will be set to +production+.
159155

160156
See {the examples in the jruby-rack project}[https://github.com/jruby/jruby-rack/tree/master/examples/]
161157
of how to configure Warbler to package Camping and Sinatra apps.
162158

163159
=== Configuration auto-detect notes
164160

165-
* Warbler will load the +environment+ Rake task in a Rails application
166-
to try to detect some configuration. If you don't have database
167-
access in the environment where you package your application, you
168-
may wish to set +Warbler.framework_detection+ to false at the top of
169-
config.rb. In this case you may need to specify additional details
170-
such as booter, gems and other settings that would normally be
171-
gleaned from the application configuration.
172-
* A more accurate way of detecting a Merb application's gems is
173-
needed. Until then, you will have to specify them in
174-
+config/warble.rb+. See below.
175-
* Is it possible to more generally detect what gems an application
176-
uses? Gem.loaded_specs is available, but the application needs to be
161+
* Warbler will load the +environment+ Rake task in a Rails application to try
162+
to detect some configuration. If you don't have database access in the
163+
environment where you package your application, you may wish to set
164+
<tt>Warbler.framework_detection = false</tt> at the top of +config.rb+.
165+
In this case you may need to specify additional details such as booter, gems
166+
and other settings that would normally be gleaned from the app configuration.
167+
* Is it possible to more generally detect what gems an application uses?
168+
<tt>Gem.loaded_specs</tt> is available, but the application needs to be
177169
loaded first before its contents are reliable.
178170

179171
== Custom configuration
@@ -185,17 +177,16 @@ doing this. With the gem, simply run
185177

186178
warble config
187179

188-
Finally, edit the config/warble.rb to your taste. The generated
189-
config/warble.rb file is fully-documented with the available options
190-
and default values.
180+
Finally, edit the +config/warble.rb+ to your taste. The generated file is
181+
fully-documented with the available options and default values.
191182

192183
=== War layout
193184

194185
The default configuration puts application files (+app+, +config+, +lib+,
195-
+log+, +vendor+, +tmp+) under the .war file's WEB-INF directory, and files in
186+
+log+, +vendor+, +tmp+) under the .war file's +WEB-INF+ directory, and files in
196187
+public+ in the root of the .war file. Any Java .jar files stored in lib will
197-
automatically be placed in WEB-INF/lib for placement on the web app's
198-
classpath.
188+
automatically be placed in +WEB-INF/lib+ for placement on the web app's
189+
class-path.
199190

200191
=== Web.xml
201192

@@ -220,48 +211,48 @@ For more information on configuration, see Warbler::Config.
220211

221212
== Rakefile integration
222213

223-
If you'd like to control Warbler from your own project's Rakefile,
224-
simply add the following code somewhere in the Rakefile:
214+
If you'd like to control Warbler from your own project's +Rakefile+,
215+
simply add the following code somewhere in the +Rakefile+ :
225216

226217
require 'warbler'
227218
Warbler::Task.new
228219

229-
If you're using Bundler, you'll want to add Warbler to your Gemfile:
220+
If you're using Bundler, you'll want to add Warbler to your +Gemfile+ :
230221

231222
group :development do
232223
gem "warbler"
233224
end
234225

235-
Now you should be able to invoke "rake war" to create your war file.
226+
Now you should be able to invoke <tt>rake war</tt> to create your war file.
236227

237228
== Troubleshooting
238229

239-
If Warbler isn't packaging the files you were expecting, use the
240-
+war:debug+ task to give you more insight into what's going on.
230+
If Warbler isn't packaging the files you were expecting, use the +war:debug+
231+
task to give you more insight into what's going on.
241232

242233
If you think you found a bug, please file one at
243234
https://github.com/jruby/warbler/issues.
244235

245236
== Source
246237

247-
You can get the Warbler source using Git:
238+
You can get the Warbler source using Git, in any of the following ways:
248239

240+
git clone git://git.caldersphere.net/warbler.git
249241
git clone git://github.com/jruby/warbler.git
250242

251243
You can also download a tarball of Warbler source at
252-
https://github.com/jruby/warbler/archive/master.tar.gz
244+
https://github.com/jruby/warbler/tarball/master.
253245

254246
== Development
255247

256-
You can develop Warbler with any implementation of Ruby. To write
257-
Warbler code and run specs, you need to have Bundler installed
258-
and run "bundle install" once.
248+
You can develop Warbler with any implementation of Ruby. To write Warbler code
249+
and run specs, you need to have Bundler installed and run <tt>bundle</tt> once.
259250

260-
After that, simply run "rake".
251+
After that, simply run <tt>rake</tt>.
261252

262253
== License
263254

264255
Warbler is provided under the terms of the MIT license.
265256

266-
Warbler (c) 2010-2013 Engine Yard, Inc.
257+
Warbler (c) 2010-2012 Engine Yard, Inc.
267258
Warbler (c) 2007-2009 Sun Microsystems, Inc.

0 commit comments

Comments
 (0)