warbler 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,14 @@
1
+ == 0.9.10
2
+
3
+ * Upgraded to JRuby-Rack 0.9.1. Fixes JRUBY-2620, JRUBY-2594, JRUBY-2507.
4
+ * Now verified to work with Camping and Sinatra. See
5
+ http://github.com/nicksieger/jruby-rack/tree/master/examples for examples
6
+ of how to configure Warbler to package your Camping and Sinatra apps.
7
+ * Upgraded to JRuby 1.1.3.
8
+ * Log files are no longer packaged in the .war file.
9
+ * Fix #<Warbler::WebxmlOpenStruct ...> appearing in web.xml and document workarounds.
10
+ * Add config.autodeploy_dir that, when specified, will create the war there.
11
+
1
12
  == 0.9.9
2
13
 
3
14
  * Now shipping with JRuby-Rack 0.9!
@@ -9,8 +9,8 @@ generators/warble
9
9
  generators/warble/templates
10
10
  generators/warble/templates/warble.rb
11
11
  generators/warble/warble_generator.rb
12
- lib/jruby-complete-1.1.1.jar
13
- lib/jruby-rack-0.9.jar
12
+ lib/jruby-complete-1.1.3.jar
13
+ lib/jruby-rack-0.9.1.jar
14
14
  lib/warbler
15
15
  lib/warbler/config.rb
16
16
  lib/warbler/gems.rb
data/Rakefile CHANGED
@@ -22,6 +22,11 @@ begin
22
22
  end
23
23
  hoe.spec.files = MANIFEST
24
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
25
30
  rescue LoadError
26
31
  puts "You really need Hoe installed to be able to package this gem"
27
32
  end
@@ -25,14 +25,20 @@ Warbler::Config.new do |config|
25
25
  # WEB-INF/classes. The example pathmap below accompanies the java_classes
26
26
  # configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
27
27
  # for details of how to specify a pathmap.
28
- # config.pathmaps.java_classes << "%{target/classes/,}"
28
+ # config.pathmaps.java_classes << "%{target/classes/,}p"
29
29
 
30
- # Gems to be packaged in the webapp. Note that Rails gems are added to this
31
- # list if vendor/rails is not present, so be sure to include rails if you
32
- # overwrite the value
33
- # config.gems = ["activerecord-jdbc-adapter", "jruby-openssl"]
30
+ # Gems to be included. You need to tell Warbler which gems your application needs
31
+ # so that they can be packaged in the war file.
32
+ # The Rails gems are included by default unless the vendor/rails directory is present.
33
+ # config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
34
34
  # config.gems << "tzinfo"
35
- # config.gems["rails"] = "1.2.3"
35
+
36
+ # Uncomment this if you don't want to package rails gem.
37
+ # config.gems -= ["rails"]
38
+
39
+ # The most recent versions of gems are used.
40
+ # You can specify versions of gems by using a hash assignment:
41
+ # config.gems["rails"] = "2.0.2"
36
42
 
37
43
  # Include gem dependencies not mentioned specifically
38
44
  config.gem_dependencies = true
@@ -54,6 +60,12 @@ Warbler::Config.new do |config|
54
60
  # Application booter to use, one of :rack, :rails, or :merb. (Default :rails)
55
61
  # config.webxml.booter = :rails
56
62
 
63
+ # When using the :rack booter, "Rackup" script to use.
64
+ # The script is evaluated in a Rack::Builder to load the application.
65
+ # Examples:
66
+ # config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
67
+ # config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
68
+
57
69
  # Control the pool of Rails runtimes. Leaving unspecified means
58
70
  # the pool will grow as needed to service requests. It is recommended
59
71
  # that you fix these values when running a production server!
@@ -16,6 +16,11 @@ module Warbler
16
16
  # Directory where files will be staged, defaults to tmp/war
17
17
  attr_accessor :staging_dir
18
18
 
19
+ # Directory where the war file will be written. Can be used to direct
20
+ # Warbler to place your war file directly in your application server's
21
+ # autodeploy directory. Defaults to the root of the Rails directory.
22
+ attr_accessor :autodeploy_dir
23
+
19
24
  # Top-level directories to be copied into WEB-INF. Defaults to
20
25
  # names in TOP_DIRS
21
26
  attr_accessor :dirs
@@ -39,6 +44,9 @@ module Warbler
39
44
  # Whether to include dependent gems (default true)
40
45
  attr_accessor :gem_dependencies
41
46
 
47
+ # Whether to exclude **/*.log files (default is true)
48
+ attr_accessor :exclude_logs
49
+
42
50
  # Public HTML directory file list, to be copied into the root of the war
43
51
  attr_accessor :public_html
44
52
 
@@ -70,6 +78,12 @@ module Warbler
70
78
  # keep around during idle time
71
79
  # * <tt>webxml.jruby.max.runtimes</tt> -- maximum number of pooled Rails
72
80
  # application runtimes
81
+ #
82
+ # Note that if you attempt to access webxml configuration keys in a conditional,
83
+ # you might not obtain the result you want. For example:
84
+ # <%= webxml.maybe.present.key || 'default' %>
85
+ # doesn't yield the right result. Instead, you need to generate the context parameters:
86
+ # <%= webxml.context_params['maybe.present.key'] || 'default' %>
73
87
  attr_accessor :webxml
74
88
 
75
89
  def initialize(warbler_home = WARBLER_HOME)
@@ -81,6 +95,7 @@ module Warbler
81
95
  @java_classes = FileList[]
82
96
  @gems = default_gems
83
97
  @gem_dependencies = true
98
+ @exclude_logs = true
84
99
  @public_html = FileList["public/**/*"]
85
100
  @pathmaps = default_pathmaps
86
101
  @webxml = default_webxml_config
@@ -88,6 +103,7 @@ module Warbler
88
103
  @war_name = File.basename(@rails_root)
89
104
  yield self if block_given?
90
105
  @excludes += warbler_vendor_excludes(warbler_home)
106
+ @excludes += FileList["**/*.log"] if @exclude_logs
91
107
  @excludes << @staging_dir
92
108
  end
93
109
 
@@ -138,8 +154,9 @@ module Warbler
138
154
  end
139
155
 
140
156
  class WebxmlOpenStruct < OpenStruct
141
- def initialize
142
- @table = Hash.new {|h,k| h[k] = WebxmlOpenStruct.new }
157
+ def initialize(key = 'webxml')
158
+ @key = key
159
+ @table = Hash.new {|h,k| h[k] = WebxmlOpenStruct.new(k) }
143
160
  end
144
161
 
145
162
  def servlet_context_listener
@@ -169,5 +186,9 @@ module Warbler
169
186
  params.delete_if {|k,v| ['ignored', *ignored].include?(k.to_s) }
170
187
  params
171
188
  end
189
+
190
+ def to_s
191
+ "No value for '#@key' found"
192
+ end
172
193
  end
173
194
  end
@@ -162,7 +162,9 @@ module Warbler
162
162
  with_namespace_and_config do |name, config|
163
163
  desc "Run the jar command to create the .war"
164
164
  task "jar" do
165
- sh "jar cf #{config.war_name}.war -C #{config.staging_dir} ."
165
+ war_path = "#{config.war_name}.war"
166
+ war_path = File.join(config.autodeploy_dir, war_path) if config.autodeploy_dir
167
+ sh "jar cf #{war_path} -C #{config.staging_dir} ."
166
168
  end
167
169
  end
168
170
  end
@@ -187,10 +189,13 @@ module Warbler
187
189
  end
188
190
 
189
191
  def define_webinf_file_tasks
192
+ target_files = @config.dirs.map do |d|
193
+ define_file_task(d, "#{@config.staging_dir}/#{apply_pathmaps(d, :application)}")
194
+ end
190
195
  files = FileList[*(@config.dirs.map{|d| "#{d}/**/*"})]
191
196
  files.include *(@config.includes.to_a)
192
197
  files.exclude *(@config.excludes.to_a)
193
- target_files = files.map do |f|
198
+ target_files += files.map do |f|
194
199
  define_file_task(f,
195
200
  "#{@config.staging_dir}/#{apply_pathmaps(f, :application)}")
196
201
  end
@@ -5,5 +5,5 @@
5
5
  #++
6
6
 
7
7
  module Warbler
8
- VERSION = "0.9.9"
8
+ VERSION = "0.9.10"
9
9
  end
@@ -41,6 +41,22 @@ describe Warbler::Config do
41
41
  config.gems.should be_empty
42
42
  end
43
43
 
44
+ it "should exclude log files by default" do
45
+ mkdir_p "vendor"
46
+ touch "vendor/test.log"
47
+ config = Warbler::Config.new
48
+ config.exclude_logs.should == true
49
+ config.excludes.include?("vendor/test.log").should == true
50
+ end
51
+
52
+ it "should include log files if exclude_logs is false" do
53
+ mkdir_p "vendor"
54
+ touch "vendor/test.log"
55
+ config = Warbler::Config.new {|c| c.exclude_logs = false }
56
+ config.exclude_logs.should == false
57
+ config.excludes.include?("vendor/test.log").should == false
58
+ end
59
+
44
60
  it "should exclude Warbler itself when run as a plugin" do
45
61
  config = Warbler::Config.new
46
62
  config.excludes.include?("vendor/plugins/warbler").should == false
@@ -82,6 +98,10 @@ describe Warbler::Config do
82
98
  Warbler::Config.new.webxml.context_params.should_not have_key('booter')
83
99
  end
84
100
 
101
+ it "should have a helpful string representation for an empty key" do
102
+ Warbler::Config.new.webxml.missing_key.to_s.should =~ /No value for 'missing_key' found/
103
+ end
104
+
85
105
  #it "should automatically gems used by the web application" do
86
106
  # gem "actionpack"
87
107
  # config = Warbler::Config.new
@@ -11,12 +11,14 @@ describe Warbler::Task do
11
11
  @rake = Rake::Application.new
12
12
  Rake.application = @rake
13
13
  mkdir_p "public"
14
+ mkdir_p "log"
14
15
  touch "public/index.html"
16
+ touch "log/test.log"
15
17
  @config = Warbler::Config.new do |config|
16
18
  config.staging_dir = "pkg/tmp/war"
17
19
  config.war_name = "warbler"
18
20
  config.gems = ["rake"]
19
- config.dirs = %w(bin generators lib)
21
+ config.dirs = %w(bin generators log lib)
20
22
  config.public_html = FileList["public/**/*", "tasks/**/*"]
21
23
  config.webxml.jruby.max.runtimes = 5
22
24
  end
@@ -28,6 +30,7 @@ describe Warbler::Task do
28
30
  Rake::Task["warble:clean"].invoke
29
31
  rm_rf "public"
30
32
  rm_rf "config"
33
+ rm_rf "log"
31
34
  end
32
35
 
33
36
  def define_tasks(*tasks)
@@ -68,6 +71,13 @@ describe Warbler::Task do
68
71
  file_list(%r{WEB-INF/gems/specifications/rake.*\.gemspec}).should_not be_empty
69
72
  end
70
73
 
74
+ it "should define a app task for copying application files" do
75
+ define_tasks "app", "gems"
76
+ Rake::Task["warble:app"].invoke
77
+ file_list(%r{WEB-INF/log}).should_not be_empty
78
+ file_list(%r{WEB-INF/log/*.log}).should be_empty
79
+ end
80
+
71
81
  def expand_webxml
72
82
  define_tasks "webxml"
73
83
  Rake::Task["warble:webxml"].invoke
@@ -179,6 +189,16 @@ describe Warbler::Task do
179
189
  File.exist?("warbler.war").should == true
180
190
  end
181
191
 
192
+ it "should accept an autodeploy directory where the war should be created" do
193
+ define_tasks "jar"
194
+ require 'tempfile'
195
+ @config.autodeploy_dir = Dir::tmpdir
196
+ mkdir_p @config.staging_dir
197
+ touch "#{@config.staging_dir}/file.txt"
198
+ Rake::Task["warble:jar"].invoke
199
+ File.exist?(File.join("#{Dir::tmpdir}","warbler.war")).should == true
200
+ end
201
+
182
202
  it "should define a war task for bundling up everything" do
183
203
  app_ran = false; task "warble:app" do; app_ran = true; end
184
204
  public_ran = false; task "warble:public" do; public_ran = true; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sieger
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-08 00:00:00 -07:00
12
+ date: 2008-07-26 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -44,8 +45,8 @@ files:
44
45
  - generators/warble/templates
45
46
  - generators/warble/templates/warble.rb
46
47
  - generators/warble/warble_generator.rb
47
- - lib/jruby-complete-1.1.1.jar
48
- - lib/jruby-rack-0.9.jar
48
+ - lib/jruby-complete-1.1.3.jar
49
+ - lib/jruby-rack-0.9.1.jar
49
50
  - lib/warbler
50
51
  - lib/warbler/config.rb
51
52
  - lib/warbler/gems.rb
@@ -80,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
81
  requirements: []
81
82
 
82
83
  rubyforge_project: caldersphere
83
- rubygems_version: 1.0.1
84
+ rubygems_version: 1.2.0
84
85
  signing_key:
85
86
  specification_version: 2
86
87
  summary: Warbler chirpily constructs .war files of your Rails applications.