fjc-warbler 0.9.12

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,91 @@
1
+ == 0.9.12
2
+
3
+ * Allow framework auto-detection to be disabled. Set
4
+ `Warbler.framework_detection = false` at the top of config/warble.rb
5
+ or uncomment the line from a newly generated config.
6
+ * Add configuration option to set manifest file (thanks Tommy McGuire)
7
+ * Mitigate RubyGems 1.3 compatibility issue (thanks Jens Norrgrann)
8
+ * Add experimental `war:exploded` task. This allows you to deploy your
9
+ application in an exploded mode, thus allowing continual development
10
+ without re-warring and re-deploying. Feedback is appreciated if you
11
+ try this feature; it may not work in all application servers and for
12
+ applications other than Rails.
13
+ * Upgrade to JRuby 1.1.5 and JRuby-Rack 0.9.3
14
+
15
+ == 0.9.11
16
+
17
+ * Auto-detect Rails and Merb and configure appropriately
18
+ - For Rails, set rails booter, determine max runtimes based on Rails.configuration.threadsafe!,
19
+ add Rails gem, detect Rails version, set gems to be packaged based on
20
+ Rails.configuration.gems if available
21
+ - Rails gems only added if Rails application detected
22
+ - For Merb, set merb booter automatically
23
+ * Auto-detect config.ru rackup script and pass it into config.webxml.rackup
24
+ * rails.env now commented by default in config/warble.rb and internally default
25
+ the value to 'production'
26
+ * Default directories in config.dirs to only those that are found to be present
27
+ * Allow config.gems array to contain regexps and Gem::Dependency objects as well
28
+ (assist from Jani Soila)
29
+ * Fix bug ensuring you can += and -= for config.gems
30
+ * Upgrade to JRuby 1.1.4 and JRuby-Rack 0.9.2
31
+ * add [] as a way to specify non-identifier keys, example: config.webxml['!@#$%^'] = 'haha'
32
+
33
+ == 0.9.10
34
+
35
+ * Upgraded to JRuby-Rack 0.9.1. Fixes JRUBY-2620, JRUBY-2594, JRUBY-2507.
36
+ * Now verified to work with Camping and Sinatra. See
37
+ http://github.com/nicksieger/jruby-rack/tree/master/examples for examples
38
+ of how to configure Warbler to package your Camping and Sinatra apps.
39
+ * Upgraded to JRuby 1.1.3.
40
+ * Log files are no longer packaged in the .war file.
41
+ * Fix #<Warbler::WebxmlOpenStruct ...> appearing in web.xml and document workarounds.
42
+ * Add config.autodeploy_dir that, when specified, will create the war there.
43
+
44
+ == 0.9.9
45
+
46
+ * Now shipping with JRuby-Rack 0.9!
47
+ * Upgrade to JRuby 1.1.1
48
+ * warble.rb and web.xml.erb have changed as a result of the change to JRuby-Rack -- we
49
+ recommend comparing the new base copies with any existing configuration you have to
50
+ make sure you pick up the differences.
51
+ * Config changes:
52
+ ** config.webxml.booter chooses what kind of application to use (:rails, :merb or plain :rack).
53
+ ** config.webxml.pool.* have been replaced by config.webxml.jruby.(min|max).runtimes
54
+ ** config.webxml.standalone and config.webxml.jruby_home no longer have any effect.
55
+
56
+ == 0.9.5
57
+
58
+ * Fix bug in plugin warbler.rake task file that would favor loading warbler from gems before the version
59
+ installed as a plugin
60
+ * Upgrade to JRuby 1.1 final and Goldspike 1.6.1
61
+
62
+ == 0.9.4
63
+
64
+ * Update bundled JRuby to 1.1RC3 and Goldspike to 1.6.
65
+ * Fix inclusion of gems with platform-specific bits (e.g., Hpricot)
66
+
67
+ == 0.9.3
68
+
69
+ * Update bundled JRuby to 1.1RC2, and Goldspike to 1.5.
70
+ * The bundled JRuby and Goldspike now require JDK 5 or greater. If you wish to use JDK 1.4, use Warbler 0.9.2.
71
+
72
+ == 0.9.2
73
+
74
+ * Update bundled JRuby to version 1.0.3 and Goldspike 1.4.
75
+ * Add config.java_classes to allow you to copy loose Java classes into WEB-INF/classes.
76
+ * Make jar command a single command string so that jar creation doesn't fail (works around bug in JRuby 1.0.2)
77
+ * Use File.join to form staging directory, should produce the proper jar-command path in Windows
78
+
79
+ == 0.9.1
80
+
81
+ * Add rake >= 0.7.3 as a dependency in the gem specification.
82
+ * Add debug tasks: war:debug, war:debug:gems, war:debug:public, war:debug:app, war:debug:includes,
83
+ war:debug:excludes, war:debug:java_libs gives you a breakdown of what Warbler expects to package.
84
+
85
+ == 0.9
86
+
87
+ * Birthday! Warbler is a gem to make a .war file out of a Rails project. The intent is to provide a
88
+ minimal, flexible, ruby-like way to bundle up all of your application files for deployment to a
89
+ Java application server.
90
+ * Bundled versions: goldspike-1.4-SNAPSHOT and jruby-complete-1.0.1
91
+ * Works as both a gem (rake application) or a plugin
data/LICENSES.txt ADDED
@@ -0,0 +1,37 @@
1
+ = Warbler
2
+
3
+ Warbler is provided under the terms of the MIT license.
4
+
5
+ (c) Copyright 2007-2008 Sun Microsystems, Inc.
6
+
7
+ Permission is hereby granted, free of charge, to any person
8
+ obtaining a copy of this software and associated documentation files
9
+ (the "Software"), to deal in the Software without restriction,
10
+ including without limitation the rights to use, copy, modify, merge,
11
+ publish, distribute, sublicense, and/or sell copies of the Software,
12
+ and to permit persons to whom the Software is furnished to do so,
13
+ subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ = Additional Bundled Software
28
+
29
+ JRuby-Rack (jruby-rack-*.jar) is distributed under the terms of the MIT license.
30
+ See http://svn.codehaus.org/jruby-contrib/trunk/rack/LICENSE.txt
31
+ for details.
32
+
33
+ JRuby (jruby-complete-*.jar) is distrubuted under the terms of the Common
34
+ Public License. See http://www.eclipse.org/legal/cpl-v10.html for details. At
35
+ your option, JRuby is also available under the GPL or LGPL licenses. See the
36
+ file COPYING in the JRuby distribution for details
37
+ (http://svn.codehaus.org/jruby/trunk/jruby/COPYING).
data/README.txt ADDED
@@ -0,0 +1,167 @@
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
+ Warbler bundles JRuby and the JRuby-Rack servlet adapter for dispatching
13
+ requests to your application inside the java application server, and assembles
14
+ all jar files in WARBLER_HOME/lib/*.jar into your application. No external
15
+ dependencies are downloaded.
16
+
17
+ == Getting Started
18
+
19
+ 1. Install the gem: <tt>gem install warbler</tt>.
20
+ 2. Run warbler in the top directory of your Rails application: <tt>warble</tt>.
21
+ 3. Deploy your railsapp.war file to your favorite Java application server.
22
+
23
+ == Usage
24
+
25
+ Warbler's +warble+ command is just a small wrapper around Rake with internally
26
+ defined tasks. (Notice "rake" still prints out in the message, but you should
27
+ substitute "warble" for "rake" on the command line when running this way.)
28
+
29
+ $ warble -T
30
+ rake config # Generate a configuration file to customize your war assembly
31
+ rake pluginize # Unpack warbler as a plugin in your Rails application
32
+ rake war # Create trunk.war
33
+ rake war:app # Copy all application files into the .war
34
+ rake war:clean # Clean up the .war file and the staging area
35
+ rake war:gems # Unpack all gems into WEB-INF/gems
36
+ rake war:jar # Run the jar command to create the .war
37
+ rake war:java_libs # Copy all java libraries into the .war
38
+ rake war:public # Copy all public HTML files to the root of the .war
39
+ rake war:webxml # Generate a web.xml file for the webapp
40
+
41
+ Warble makes heavy use of Rake's file and directory tasks, so only recently
42
+ updated files will be copied, making repeated assemblies much faster.
43
+
44
+ == Configuration
45
+
46
+ === Rails applications
47
+
48
+ Rails applications are detected automatically and configured appropriately.
49
+ The following items are set up for you:
50
+
51
+ * The Rails gem is packaged if you haven't vendored Rails.
52
+ * Other gems configured in Rails.configuration.gems are packaged (Rails 2.1 or
53
+ later)
54
+ * Multi-thread-safe execution (as introduced in Rails 2.2) is detected and
55
+ runtime pooling is disabled.
56
+
57
+ === Merb applications
58
+
59
+ Merb applications are detected automatically, and the merb-core gem and its
60
+ dependencies are packaged.
61
+
62
+ === Other Rack-based applications
63
+
64
+ If you have a 'config.ru' file in the top directory of your application, its
65
+ contents will be used as the rackup script for your Rack-based application.
66
+ You will probably need to specify framework and application gems in
67
+ config/warble.rb.
68
+
69
+ See http://github.com/nicksieger/jruby-rack/tree/master/examples for examples
70
+ of how to configure Warbler to package Camping and Sinatra apps.
71
+
72
+ === Configuration auto-detect notes
73
+
74
+ * If you don't have database access in the environment where you package your
75
+ application, you may wish to set `Warbler.framework_detection` to false at
76
+ the top of config.rb. In this case you may need to specify additional
77
+ details such as booter, gems and other settings.
78
+ * A more accurate way of detecting a Merb application's gems is needed. Until
79
+ then, you will have to specify them in config/warble.rb. See below.
80
+ * Is it possible to more generally detect what gems an application uses?
81
+ Gem.loaded_specs is available, but the application needs to be loaded first
82
+ before its contents are reliable.
83
+
84
+ === Custom configuration
85
+
86
+ The default configuration puts application files (+app+, +config+, +lib+,
87
+ +log+, +vendor+, +tmp+) under the .war file's WEB-INF directory, and files in
88
+ +public+ in the root of the .war file. Any Java .jar files stored in lib will
89
+ automatically be placed in WEB-INF/lib for placement on the web app's
90
+ classpath.
91
+
92
+ If the default settings are not appropriate for your application, you can
93
+ customize Warbler's behavior. To customize files, libraries, and gems included
94
+ in the .war file, you'll need a config/warble.rb file. There a two ways of
95
+ doing this. With the gem, simply run
96
+
97
+ warble config
98
+
99
+ If you have Warbler installed as a plugin, use the generator:
100
+
101
+ script/generate warble
102
+
103
+ Finally, edit the config/warble.rb to your taste. If you install the gem but
104
+ later decide you'd like to have it as a plugin, use the +pluginize+ command:
105
+
106
+ warble pluginize
107
+
108
+ If you wish to upgrade or switch one or more java libraries from what's
109
+ bundled in the Warbler gem, simply change the jars in WARBLER_HOME/lib, or
110
+ modify the +java_libs+ attribute of Warbler::Config to include the files you
111
+ need.
112
+
113
+ Once Warbler is installed as a plugin, you can use +rake+ to build the war
114
+ (with the same set of tasks as above).
115
+
116
+ The generated config/warble.rb file is fully-documented with the available
117
+ options and default values.
118
+
119
+ === Web.xml
120
+
121
+ Java web applications are configured mainly through this file, and Warbler
122
+ creates a suitable default file for you for use. However, if you need to
123
+ customize it in any way, you have two options.
124
+
125
+ 1. If you just want a static web.xml file whose contents you manually control,
126
+ you may copy the one generated for you in <tt>tmp/war/WEB-INF/web.xml</tt>
127
+ to <tt>config/web.xml</tt> and modify as needed. It will be copied into the
128
+ webapp for you.
129
+ 2. If you want to inject some dynamic information into the file, copy the
130
+ <tt>WARBLER_HOME/web.xml.erb</tt> to <tt>config/web.xml.erb</tt>. Its
131
+ contents will be evaluated for you and put in the webapp. Note that you can
132
+ also pass arbitrary properties to the ERb template by setting
133
+ <tt>config.webxml.customkey</tt> values in your <tt>config/warble.rb</tt>
134
+ file.
135
+
136
+ For more information on configuration, see Warbler::Config.
137
+
138
+ === Troubleshooting
139
+
140
+ If Warbler isn't packaging the files you were expecting, there are several
141
+ debug tasks available to give you more insight into what's going on.
142
+
143
+ * <tt>war:debug</tt> prints a YAML dump of the current configuration
144
+ * <tt>war:debug:X</tt> prints a list of files that Warbler will include during
145
+ that stage of assembly. Valid values of <tt>X</tt> are <tt>app, java_libs,
146
+ gems, public, includes, excludes</tt>.
147
+
148
+ == Source
149
+
150
+ You can get the Warbler source using Git, in any of the following ways:
151
+
152
+ git clone git://git.caldersphere.net/warbler.git
153
+ git clone http://git.caldersphere.net/warbler.git
154
+ git clone git://github.com/nicksieger/warbler.git
155
+
156
+ You can also download a tarball of Warbler source at
157
+ http://github.com/nicksieger/warbler/tree/master.
158
+
159
+ == License
160
+
161
+ Warbler is provided under the terms of the MIT license.
162
+
163
+ Warbler (c) 2007-08 Sun Microsystems, Inc.
164
+
165
+ Warbler also bundles several other pieces of software for convenience. Please
166
+ read the file LICENSES.txt to ensure that you agree with the terms of all the
167
+ components.
data/Rakefile ADDED
@@ -0,0 +1,58 @@
1
+ require 'spec/rake/spectask'
2
+ require 'spec/rake/verify_rcov'
3
+
4
+ MANIFEST = FileList["History.txt", "Manifest.txt", "README.txt", "LICENSES.txt", "Rakefile",
5
+ "*.erb", "bin/*", "generators/**/*", "lib/**/*", "spec/**/*.rb", "tasks/**/*.rake"]
6
+
7
+ begin
8
+ File.open("Manifest.txt", "w") {|f| MANIFEST.each {|n| f << "#{n}\n"} }
9
+ require 'hoe'
10
+ require File.dirname(__FILE__) + '/lib/warbler/version'
11
+ hoe = Hoe.new("warbler", Warbler::VERSION) do |p|
12
+ p.rubyforge_name = "caldersphere"
13
+ p.url = "http://caldersphere.rubyforge.org/warbler"
14
+ p.author = "Nick Sieger"
15
+ p.email = "nick@nicksieger.com"
16
+ p.summary = "Warbler chirpily constructs .war files of your Rails applications."
17
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
18
+ p.description = p.paragraphs_of('README.txt', 0...1).join("\n\n")
19
+ p.extra_deps << ['rake', '>= 0.7.3']
20
+ p.test_globs = ["spec/**/*_spec.rb"]
21
+ p.rdoc_pattern = /\.(rb|txt)/
22
+ end
23
+ hoe.spec.files = MANIFEST
24
+ hoe.spec.dependencies.delete_if { |dep| dep.name == "hoe" }
25
+
26
+ task :gemspec do
27
+ File.open("#{hoe.name}.gemspec", "w") {|f| f << hoe.spec.to_ruby }
28
+ end
29
+ task :package => :gemspec
30
+ rescue LoadError
31
+ puts "You really need Hoe installed to be able to package this gem"
32
+ end
33
+
34
+ # Hoe insists on setting task :default => :test
35
+ # !@#$ no easy way to empty the default list of prerequisites
36
+ Rake::Task['default'].send :instance_variable_set, "@prerequisites", FileList[]
37
+
38
+ task :default => :rcov
39
+
40
+ Spec::Rake::SpecTask.new do |t|
41
+ t.spec_opts ||= []
42
+ t.spec_opts << "--options" << "spec/spec.opts"
43
+ end
44
+
45
+ Spec::Rake::SpecTask.new("spec:rcov") do |t|
46
+ t.rcov = true
47
+ t.rcov_opts << '--exclude gems/*'
48
+ end
49
+
50
+ # so we don't confuse autotest
51
+ RCov::VerifyTask.new(:rcov) do |t|
52
+ t.threshold = 100
53
+ end
54
+
55
+ task "spec:rcov" do
56
+ rm_f "Manifest.txt"
57
+ end
58
+ task :rcov => "spec:rcov"
data/bin/warble ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ #--
4
+ # (c) Copyright 2007-2008 Sun Microsystems, Inc.
5
+ # See the file LICENSES.txt included with the distribution for
6
+ # software license details.
7
+ #++
8
+
9
+ require 'rubygems'
10
+ require 'rake'
11
+ require 'warbler'
12
+
13
+ application = Rake.application
14
+
15
+ # Load any application rakefiles to aid in autodetecting applications
16
+ Warbler.project_application = Rake::Application.new
17
+ Rake.application = Warbler.project_application
18
+ Rake::Application::DEFAULT_RAKEFILES.each do |rf|
19
+ if File.exist?(rf)
20
+ load rf
21
+ break
22
+ end
23
+ end
24
+
25
+ Rake.application = application
26
+ application.standard_exception_handling do
27
+ application.init
28
+
29
+ # Load the main warbler tasks
30
+ Warbler::Task.new
31
+
32
+ task :default => :war
33
+
34
+ desc "Generate a configuration file to customize your war assembly"
35
+ task :config do
36
+ if File.exists?(Warbler::Config::FILE) && ENV["FORCE"].nil?
37
+ puts "There's another bird sitting on my favorite branch"
38
+ puts "(file '#{Warbler::Config::FILE}' already exists. Pass argument FORCE=1 to override)"
39
+ elsif !File.directory?("config")
40
+ puts "I'm confused; my favorite branch is missing"
41
+ puts "(directory 'config' is missing)"
42
+ else
43
+ cp "#{Warbler::WARBLER_HOME}/generators/warble/templates/warble.rb", Warbler::Config::FILE
44
+ end
45
+ end
46
+
47
+ desc "Unpack warbler as a plugin in your Rails application"
48
+ task :pluginize do
49
+ if !Dir["vendor/plugins/warbler*"].empty?
50
+ puts "I found an old nest in vendor/plugins; please trash it so I can make a new one"
51
+ puts "(directory vendor/plugins/warbler* exists)"
52
+ elsif !File.directory?("vendor/plugins")
53
+ puts "I can't find a place to build my nest"
54
+ puts "(directory 'vendor/plugins' is missing)"
55
+ else
56
+ Dir.chdir("vendor/plugins") do
57
+ ruby "-S", "gem", "unpack", "warbler"
58
+ end
59
+ end
60
+ end
61
+
62
+ desc "Display version of warbler"
63
+ task :version do
64
+ puts "Warbler version #{Warbler::VERSION}"
65
+ end
66
+
67
+ application.top_level
68
+ end
@@ -0,0 +1,89 @@
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(app config lib log vendor tmp)
11
+
12
+ # Additional files/directories to include, above those in config.dirs
13
+ # config.includes = FileList["db"]
14
+
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
+ # The Rails gems are included by default unless the vendor/rails directory is present.
36
+ # config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
37
+ # config.gems << "tzinfo"
38
+
39
+ # Uncomment this if you don't want to package rails gem.
40
+ # config.gems -= ["rails"]
41
+
42
+ # The most recent versions of gems are used.
43
+ # You can specify versions of gems by using a hash assignment:
44
+ # config.gems["rails"] = "2.0.2"
45
+
46
+ # You can also use regexps or Gem::Dependency objects for flexibility or
47
+ # fine-grained control.
48
+ # config.gems << /^merb-/
49
+ # config.gems << Gem::Dependency.new("merb-core", "= 0.9.3")
50
+
51
+ # Include gem dependencies not mentioned specifically
52
+ config.gem_dependencies = true
53
+
54
+ # Files to be included in the root of the webapp. Note that files in public
55
+ # will have the leading 'public/' part of the path stripped during staging.
56
+ # config.public_html = FileList["public/**/*", "doc/**/*"]
57
+
58
+ # Pathmaps for controlling how public HTML files are copied into the .war
59
+ # config.pathmaps.public_html = ["%{public/,}p"]
60
+
61
+ # Name of the war file (without the .war) -- defaults to the basename
62
+ # of RAILS_ROOT
63
+ # config.war_name = "mywar"
64
+
65
+ # Name of the MANIFEST.MF template for the war file. Defaults to the
66
+ # MANIFEST.MF normally generated by `jar cf`.
67
+ # config.manifest_file = "config/MANIFEST.MF"
68
+
69
+ # Value of RAILS_ENV for the webapp -- default as shown below
70
+ # config.webxml.rails.env = ENV['RAILS_ENV'] || 'production'
71
+
72
+ # Application booter to use, one of :rack, :rails, or :merb. (Default :rails)
73
+ # config.webxml.booter = :rails
74
+
75
+ # When using the :rack booter, "Rackup" script to use.
76
+ # The script is evaluated in a Rack::Builder to load the application.
77
+ # Examples:
78
+ # config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
79
+ # config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
80
+
81
+ # Control the pool of Rails runtimes. Leaving unspecified means
82
+ # the pool will grow as needed to service requests. It is recommended
83
+ # that you fix these values when running a production server!
84
+ # config.webxml.jruby.min.runtimes = 2
85
+ # config.webxml.jruby.max.runtimes = 4
86
+
87
+ # JNDI data source name
88
+ # config.webxml.jndi = 'jdbc/rails'
89
+ end