warbler 0.9 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.9.1
2
+
3
+ * Bundle Bouncy Castle JCE provider so that Digests work properly. See LICENSES.txt for details of
4
+ the distribution.
5
+ * Add rake >= 0.7.3 as a dependency in the gem specification.
6
+ * Add debug tasks: war:debug, war:debug:gems, war:debug:public, war:debug:app, war:debug:includes,
7
+ war:debug:excludes, war:debug:java_libs gives you a breakdown of what Warbler expects to package.
8
+
1
9
  == 0.9
2
10
 
3
11
  * Birthday! Warbler is a gem to make a .war file out of a Rails project. The intent is to provide a
data/README.txt CHANGED
@@ -62,9 +62,25 @@ If you wish to upgrade or switch one or more java libraries from what's bundled
62
62
 
63
63
  Once Warbler is installed as a plugin, you can use +rake+ to build the war (with the same set of tasks as above).
64
64
 
65
+ === Web.xml
66
+
67
+ Java web applications are configured mainly through this file, and Warbler creates a suitable default file for you for use with the bundled Goldspike bits. However, if you need to customize it in any way, you have two options.
68
+
69
+ 1. If you just want a static web.xml file whose contents you manually control, you may copy the one generated for you in <tt>tmp/war/WEB-INF/web.xml</tt> to <tt>config/web.xml</tt>. It will be copied into the webapp for you.
70
+ 2. If you want to inject some dynamic information into the file, copy the <tt>WARBLER_HOME/web.xml.erb</tt> to <tt>config/web.xml.erb</tt>. Its contents will be evaluated for you and put in the webapp. Note that you can also pass arbitrary properties to the ERb template by setting <tt>config.webxml.customkey</tt> values in your <tt>config/warble.rb</tt> file.
71
+
65
72
  For more information on configuration, see Warbler::Config.
66
73
 
67
- === Caveats
74
+ === Troubleshooting
75
+
76
+ If Warbler isn't packaging the files you were expecting, there are several debug tasks available to give you more insight into what's going on.
77
+
78
+ * <tt>war:debug</tt> prints a YAML dump of the current configuration
79
+ * <tt>war:debug:X</tt> prints a list of files that Warbler will include during that stage of
80
+ assembly. Valid values of <tt>X</tt> are <tt>app, java_libs, gems, public, includes,
81
+ excludes</tt>.
82
+
83
+ == Caveats
68
84
 
69
85
  Warbler requires that RAILS_ROOT will effectively be set to /WEB-INF when running inside the war, while the application public files will be in the root directory. The purpose is to make the application structure match the Java webapp archive structure, where WEB-INF is a protected directory not visible to the web server. Because of this change, features of Rails that expect the public assets directory to live in RAILS_ROOT/public may not function properly. However, we feel that the added security of conforming to the webapp structure is worth these minor inconveniences.
70
86
 
@@ -74,11 +90,17 @@ For Rails 1.2.3, the items that may need your attention are:
74
90
  * Asset tag timestamp calculation (e.g., <tt>javascripts/prototype.js?1188482864</tt>) will not happen. The workaround is to control this manually by setting the RAILS_ASSET_ID environment variable.
75
91
  * Automatic inclusion of <tt>application.js</tt> through <tt>javascript_include_tag :defaults</tt> will not work. The workaround is to include it yourself with <tt>javascript_include_tag "application"</tt>.
76
92
 
93
+ == Source
94
+
95
+ Warbler source is not currently located in Rubyforge's SVN. To get the source:
96
+
97
+ svn co http://svn.caldersphere.net/svn/main/rubyforge/warbler/trunk warbler
98
+
77
99
  == License
78
100
 
79
101
  Warbler is provided under the terms of the MIT license.
80
102
 
81
- Warbler (c) 2007 Nick Sieger <nicksieger@gmail.com>.
103
+ Warbler (c) 2007 Nick Sieger <nicksieger@gmail.com>
82
104
 
83
105
  Warbler also bundles several other pieces of software. Please read the file LICENSES.txt to ensure
84
106
  that you agree with the terms of all the components.
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ begin
15
15
  p.summary = "Warbler chirpily constructs .war files of your Rails applications."
16
16
  p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
17
17
  p.description = p.paragraphs_of('README.txt', 0...1).join("\n\n")
18
- p.extra_deps.reject!{|d| d.first == "hoe"}
18
+ p.extra_deps << ['rake', '>= 0.7.3']
19
19
  p.test_globs = ["spec/**/*_spec.rb"]
20
20
  p.rdoc_pattern = /\.(rb|txt)/
21
21
  end
data/bin/warble CHANGED
@@ -21,7 +21,11 @@ application.standard_exception_handling do
21
21
  desc "Generate a configuration file to customize your war assembly"
22
22
  task :config do
23
23
  if File.exists?(Warbler::Config::FILE) && ENV["FORCE"].nil?
24
- warn "#{Warbler::Config::FILE}: file already exists. Use FORCE=1 to override"
24
+ warn "There's another bird sitting on my favorite branch"
25
+ warn "(file '#{Warbler::Config::FILE}' already exists. Pass argument FORCE=1 to override)"
26
+ elsif !File.directory?("config")
27
+ warn "I'm confused; my favorite branch is missing"
28
+ warn "(directory 'config' is missing)"
25
29
  else
26
30
  cp "#{Warbler::WARBLER_HOME}/generators/warble/templates/warble.rb", Warbler::Config::FILE
27
31
  end
@@ -29,8 +33,12 @@ application.standard_exception_handling do
29
33
 
30
34
  desc "Unpack warbler as a plugin in your Rails application"
31
35
  task :pluginize do
32
- unless Dir["vendor/plugins/warbler*"].empty?
33
- warn "warbler is already installed as a plugin; please remove before re-installing"
36
+ if !Dir["vendor/plugins/warbler*"].empty?
37
+ warn "I found an old nest in vendor/plugins; please trash it so I can make a new one"
38
+ warn "(directory vendor/plugins/warbler* exists)"
39
+ elsif !File.directory?("vendor/plugins")
40
+ warn "I can't find a place to build my nest"
41
+ warn "(directory 'vendor/plugins' is missing)"
34
42
  else
35
43
  Dir.chdir("vendor/plugins") do
36
44
  ruby "-S", "gem", "unpack", "warbler"
@@ -38,5 +46,10 @@ application.standard_exception_handling do
38
46
  end
39
47
  end
40
48
 
49
+ desc "Display version of warbler"
50
+ task :version do
51
+ puts "Warbler version #{Warbler::VERSION}"
52
+ end
53
+
41
54
  application.top_level
42
55
  end
@@ -14,17 +14,21 @@ Warbler::Config.new do |config|
14
14
 
15
15
  # Additional Java .jar files to include. Note that if .jar files are placed
16
16
  # in lib (and not otherwise excluded) then they need not be mentioned here
17
- # config.java_libs = FileList["lib/java/*.jar"]
18
- # config.java_libs << "lib/java/*.jar"
17
+ # JRuby and Goldspike are pre-loaded in this list. Be sure to include your
18
+ # own versions if you directly set the value
19
+ # config.java_libs += FileList["lib/java/*.jar"]
19
20
 
20
- # External gems to be packaged in the webapp.
21
+ # Gems to be packaged in the webapp. Note that Rails gems are added to this
22
+ # list if vendor/rails is not present, so be sure to include rails if you
23
+ # overwrite the value
21
24
  # config.gems = ["ActiveRecord-JDBC", "jruby-openssl"]
22
25
  # config.gems << "tzinfo"
23
26
 
24
27
  # Include gem dependencies not mentioned specifically
25
28
  config.gem_dependencies = true
26
29
 
27
- # Files to be included in the root of the webapp
30
+ # Files to be included in the root of the webapp. Note that files in public
31
+ # will have the leading 'public/' part of the path stripped during staging.
28
32
  # config.public_html = FileList["public/**/*", "doc/**/*"]
29
33
 
30
34
  # Name of the war file (without the .war) -- defaults to the basename
@@ -77,18 +77,16 @@ module Warbler
77
77
  @staging_dir = "tmp/war"
78
78
  @dirs = TOP_DIRS
79
79
  @includes = FileList[]
80
- @excludes = FileList["#{WARBLER_HOME}/**/*"]
80
+ @excludes = FileList[]
81
81
  @java_libs = FileList["#{WARBLER_HOME}/lib/*.jar"]
82
82
  @gems = default_gems
83
83
  @gem_dependencies = true
84
84
  @public_html = FileList["public/**/*"]
85
85
  @webxml = default_webxml_config
86
- @war_name = if defined?(RAILS_ROOT)
87
- File.basename(File.expand_path(RAILS_ROOT))
88
- else
89
- File.basename(File.expand_path(Dir.getwd))
90
- end
86
+ @rails_root = File.expand_path(defined?(RAILS_ROOT) ? RAILS_ROOT : Dir.getwd)
87
+ @war_name = File.basename(@rails_root)
91
88
  yield self if block_given?
89
+ @excludes += warbler_vendor_excludes
92
90
  @excludes << @staging_dir
93
91
  end
94
92
 
@@ -97,6 +95,15 @@ module Warbler
97
95
  end
98
96
 
99
97
  private
98
+ def warbler_vendor_excludes
99
+ warbler = File.expand_path(WARBLER_HOME)
100
+ if warbler =~ %r{^#{@rails_root}/(.*)}
101
+ FileList["#{$1}"]
102
+ else
103
+ []
104
+ end
105
+ end
106
+
100
107
  def default_webxml_config
101
108
  c = OpenStruct.new
102
109
  c.standalone = true
data/lib/warbler/task.rb CHANGED
@@ -71,6 +71,10 @@ module Warbler
71
71
  with_namespace_and_config do
72
72
  desc "Copy all public HTML files to the root of the .war"
73
73
  task "public" => public_target_files
74
+ task "debug:public" do
75
+ puts "", "public files:"
76
+ puts *public_target_files
77
+ end
74
78
  end
75
79
  end
76
80
 
@@ -80,6 +84,10 @@ module Warbler
80
84
  with_namespace_and_config do
81
85
  desc "Unpack all gems into WEB-INF/gems"
82
86
  task "gems" => targets
87
+ task "debug:gems" do
88
+ puts "", "gems files:"
89
+ puts *targets
90
+ end
83
91
  end
84
92
  end
85
93
 
@@ -114,6 +122,10 @@ module Warbler
114
122
  with_namespace_and_config do |name, config|
115
123
  desc "Copy all java libraries into the .war"
116
124
  task "java_libs" => target_files
125
+ task "debug:java_libs" do
126
+ puts "", "java_libs files:"
127
+ puts *target_files
128
+ end
117
129
  end
118
130
  target_files
119
131
  end
@@ -123,6 +135,10 @@ module Warbler
123
135
  with_namespace_and_config do |name, config|
124
136
  desc "Copy all application files into the .war"
125
137
  task "app" => ["#{name}:gems", *webinf_target_files]
138
+ task "debug:app" do
139
+ puts "", "app files:"
140
+ puts *webinf_target_files
141
+ end
126
142
  end
127
143
  end
128
144
 
@@ -130,7 +146,7 @@ module Warbler
130
146
  with_namespace_and_config do |name, config|
131
147
  desc "Run the jar command to create the .war"
132
148
  task "jar" do
133
- sh "jar", "cf", "#{config.war_name}.war", "-C", config.staging_dir, "."
149
+ sh "jar cf #{config.war_name}.war -C #{config.staging_dir} ."
134
150
  end
135
151
  end
136
152
  end
@@ -138,9 +154,13 @@ module Warbler
138
154
  def define_debug_task
139
155
  with_namespace_and_config do |name, config|
140
156
  task "debug" do
141
- require 'pp'
142
- pp config
157
+ require 'yaml'
158
+ puts YAML::dump(config)
143
159
  end
160
+ all_debug_tasks = %w(: app java_libs gems public includes excludes).map do |n|
161
+ n.sub(/^:?/, "#{name}:debug:").sub(/:$/, '')
162
+ end
163
+ task "debug:all" => all_debug_tasks
144
164
  end
145
165
  end
146
166
 
@@ -151,13 +171,21 @@ module Warbler
151
171
  end
152
172
 
153
173
  def define_webinf_file_tasks
154
- files = FileList[*@config.dirs.map{|d| "#{d}/**/*"}]
155
- files.include(*@config.includes.to_a)
156
- files.exclude(*@config.excludes.to_a)
174
+ files = FileList[*(@config.dirs.map{|d| "#{d}/**/*"})]
175
+ files.include *(@config.includes.to_a)
176
+ files.exclude *(@config.excludes.to_a)
157
177
  target_files = files.map do |f|
158
178
  define_file_task(f, "#{@config.staging_dir}/WEB-INF/#{f}")
159
179
  end
160
180
  target_files += define_java_libs_task
181
+ task "#@name:debug:includes" do
182
+ puts "", "included files:"
183
+ puts *files.include
184
+ end
185
+ task "#@name:debug:excludes" do
186
+ puts "", "excluded files:"
187
+ puts *files.exclude
188
+ end
161
189
  target_files
162
190
  end
163
191
 
@@ -5,5 +5,5 @@
5
5
  #++
6
6
 
7
7
  module Warbler
8
- VERSION = "0.9"
8
+ VERSION = "0.9.1"
9
9
  end
@@ -33,8 +33,8 @@ describe Warbler::Task do
33
33
  end
34
34
  end
35
35
 
36
- def files_should_contain(regex)
37
- FileList["#{@config.staging_dir}/**/*"].detect {|f| f =~ regex }.should_not be_nil
36
+ def file_list(regex)
37
+ FileList["#{@config.staging_dir}/**/*"].select {|f| f =~ regex }
38
38
  end
39
39
 
40
40
  after(:each) do
@@ -53,20 +53,20 @@ describe Warbler::Task do
53
53
  it "should define a public task for copying the public files" do
54
54
  define_tasks "public"
55
55
  Rake::Task["warble:public"].invoke
56
- files_should_contain %r{tasks/warbler\.rake}
56
+ file_list(%r{tasks/warbler\.rake}).should_not be_nil
57
57
  end
58
58
 
59
59
  it "should define a gems task for unpacking gems" do
60
60
  define_tasks "gems"
61
61
  Rake::Task["warble:gems"].invoke
62
- files_should_contain %r{WEB-INF/gems/gems/rake.*/lib/rake.rb}
63
- files_should_contain %r{WEB-INF/gems/specifications/rake.*\.gemspec}
62
+ file_list(%r{WEB-INF/gems/gems/rake.*/lib/rake.rb}).should_not be_empty
63
+ file_list(%r{WEB-INF/gems/specifications/rake.*\.gemspec}).should_not be_empty
64
64
  end
65
65
 
66
66
  it "should define a webxml task for creating web.xml" do
67
67
  define_tasks "webxml"
68
68
  Rake::Task["warble:webxml"].invoke
69
- files_should_contain %r{WEB-INF/web.xml$}
69
+ file_list(%r{WEB-INF/web.xml$}).should_not be_empty
70
70
  require 'rexml/document'
71
71
 
72
72
  elements = File.open("#{@config.staging_dir}/WEB-INF/web.xml") do |f|
@@ -83,7 +83,7 @@ describe Warbler::Task do
83
83
  it "should define a java_libs task for copying java libraries" do
84
84
  define_tasks "java_libs"
85
85
  Rake::Task["warble:java_libs"].invoke
86
- files_should_contain %r{WEB-INF/lib/jruby-complete.*\.jar$}
86
+ file_list(%r{WEB-INF/lib/jruby-complete.*\.jar$}).should_not be_empty
87
87
  end
88
88
 
89
89
  it "should define an app task for copying application files" do
@@ -93,9 +93,9 @@ describe Warbler::Task do
93
93
  end
94
94
  define_tasks "app"
95
95
  Rake::Task["warble:app"].invoke
96
- files_should_contain %r{WEB-INF/bin/warble$}
97
- files_should_contain %r{WEB-INF/generators/warble/warble_generator\.rb$}
98
- files_should_contain %r{WEB-INF/lib/warbler\.rb$}
96
+ file_list(%r{WEB-INF/bin/warble$}).should_not be_empty
97
+ file_list(%r{WEB-INF/generators/warble/warble_generator\.rb$}).should_not be_empty
98
+ file_list(%r{WEB-INF/lib/warbler\.rb$}).should_not be_empty
99
99
  gems_ran.should == true
100
100
  end
101
101
 
@@ -120,6 +120,15 @@ describe Warbler::Task do
120
120
  webxml_ran.should == true
121
121
  end
122
122
 
123
+ it "should be able to exclude files from the .war" do
124
+ @config.dirs << "spec"
125
+ @config.excludes += FileList['spec/spec_helper.rb']
126
+ task "warble:gems" do; end
127
+ define_tasks "app"
128
+ Rake::Task["warble:app"].invoke
129
+ file_list(%r{spec/spec_helper.rb}).should be_empty
130
+ end
131
+
123
132
  it "should be able to define all tasks successfully" do
124
133
  Warbler::Task.new "warble", @config
125
134
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: warbler
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.9"
7
- date: 2007-08-30 00:00:00 -05:00
6
+ version: 0.9.1
7
+ date: 2007-12-13 00:00:00 -08:00
8
8
  summary: Warbler chirpily constructs .war files of your Rails applications.
9
9
  require_paths:
10
10
  - lib
@@ -70,5 +70,13 @@ extensions: []
70
70
 
71
71
  requirements: []
72
72
 
73
- dependencies: []
74
-
73
+ dependencies:
74
+ - !ruby/object:Gem::Dependency
75
+ name: rake
76
+ version_requirement:
77
+ version_requirements: !ruby/object:Gem::Version::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 0.7.3
82
+ version: