warbler 1.3.2 → 1.3.4
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.
- data/.gitignore +4 -0
- data/.travis.yml +7 -0
- data/Gemfile +2 -3
- data/Gemfile.lock +35 -0
- data/History.txt +21 -1
- data/LICENSE.txt +1 -1
- data/{README.txt → README.rdoc} +27 -13
- data/Rakefile +31 -38
- data/lib/warbler/application.rb +1 -1
- data/lib/warbler/config.rb +1 -1
- data/lib/warbler/gems.rb +1 -1
- data/lib/warbler/jar.rb +4 -11
- data/lib/warbler/pathmap_helper.rb +20 -0
- data/lib/warbler/rake_helper.rb +1 -1
- data/lib/warbler/task.rb +1 -1
- data/lib/warbler/templates/bundler.erb +0 -1
- data/lib/warbler/templates/jar.erb +3 -0
- data/lib/warbler/templates/war.erb +5 -0
- data/lib/warbler/traits/bundler.rb +46 -17
- data/lib/warbler/traits/gemspec.rb +5 -4
- data/lib/warbler/traits/jar.rb +1 -1
- data/lib/warbler/traits/merb.rb +1 -1
- data/lib/warbler/traits/nogemspec.rb +3 -2
- data/lib/warbler/traits/rack.rb +1 -1
- data/lib/warbler/traits/rails.rb +3 -2
- data/lib/warbler/traits/war.rb +31 -6
- data/lib/warbler/traits.rb +1 -1
- data/lib/warbler/version.rb +2 -2
- data/lib/warbler/war.rb +1 -1
- data/lib/warbler.rb +2 -1
- data/lib/warbler_jar.jar +0 -0
- data/spec/drb_helper.rb +12 -2
- data/spec/sample_bundler/.bundle/config +5 -0
- data/spec/sample_bundler/Gemfile +3 -0
- data/spec/sample_bundler/vendor/bundle/jruby/1.8/bin/rake +19 -0
- data/spec/sample_bundler/vendor/bundle/jruby/1.8/gems/rake-0.8.7/bin/rake +31 -0
- data/spec/sample_bundler/vendor/bundle/ruby/1.8/bin/rake +19 -0
- data/spec/sample_bundler/vendor/bundle/ruby/1.8/gems/rake-0.8.7/bin/rake +31 -0
- data/spec/sample_bundler/vendor/bundle/ruby/1.9.1/bin/rake +19 -0
- data/spec/sample_bundler/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/bin/rake +31 -0
- data/spec/sample_jar/Rakefile +23 -0
- data/spec/sample_jar/bin/sample_jar +5 -0
- data/spec/sample_jar/sample_jar.gemspec +8 -18
- data/spec/sample_war/README +256 -0
- data/spec/sample_war/Rakefile +11 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +27 -10
- data/spec/warbler/application_spec.rb +4 -5
- data/spec/warbler/bundler_spec.rb +29 -7
- data/spec/warbler/config_spec.rb +1 -1
- data/spec/warbler/gems_spec.rb +1 -1
- data/spec/warbler/jar_spec.rb +29 -6
- data/spec/warbler/task_spec.rb +16 -7
- data/spec/warbler/traits_spec.rb +1 -1
- data/spec/warbler/war_spec.rb +1 -1
- data/warble.rb +2 -0
- data/warbler.gemspec +31 -0
- metadata +85 -39
- data/Manifest.txt +0 -93
- data/spec/sample_jar/Manifest.txt +0 -8
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
|
@@ -6,11 +6,10 @@ gem "jruby-jars"
|
|
|
6
6
|
gem "jruby-rack"
|
|
7
7
|
|
|
8
8
|
group :development do
|
|
9
|
-
gem "jruby-openssl"
|
|
9
|
+
gem "jruby-openssl", :platform => :jruby
|
|
10
10
|
gem "rspec", "~> 1.3"
|
|
11
11
|
gem "diff-lcs"
|
|
12
12
|
gem "rcov", ">= 0.9.8"
|
|
13
|
-
gem "rubyforge"
|
|
14
|
-
gem "hoe", ">= 2.3.2"
|
|
15
13
|
gem "rdoc"
|
|
14
|
+
gem "childprocess"
|
|
16
15
|
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: http://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
bouncy-castle-java (1.5.0146.1)
|
|
5
|
+
childprocess (0.2.2)
|
|
6
|
+
ffi (~> 1.0.6)
|
|
7
|
+
diff-lcs (1.1.2)
|
|
8
|
+
ffi (1.0.11)
|
|
9
|
+
ffi (1.0.11-java)
|
|
10
|
+
jruby-jars (1.6.3)
|
|
11
|
+
jruby-openssl (0.7.4)
|
|
12
|
+
bouncy-castle-java
|
|
13
|
+
jruby-rack (1.0.9)
|
|
14
|
+
rake (0.9.2.2)
|
|
15
|
+
rcov (0.9.10)
|
|
16
|
+
rcov (0.9.10-java)
|
|
17
|
+
rdoc (3.9.2)
|
|
18
|
+
rspec (1.3.2)
|
|
19
|
+
rubyzip (0.9.4)
|
|
20
|
+
|
|
21
|
+
PLATFORMS
|
|
22
|
+
java
|
|
23
|
+
ruby
|
|
24
|
+
|
|
25
|
+
DEPENDENCIES
|
|
26
|
+
childprocess
|
|
27
|
+
diff-lcs
|
|
28
|
+
jruby-jars
|
|
29
|
+
jruby-openssl
|
|
30
|
+
jruby-rack
|
|
31
|
+
rake
|
|
32
|
+
rcov (>= 0.9.8)
|
|
33
|
+
rdoc
|
|
34
|
+
rspec (~> 1.3)
|
|
35
|
+
rubyzip
|
data/History.txt
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
== 1.3.4
|
|
2
|
+
|
|
3
|
+
- #77, #78: Handle the case when multiple gems exists in a git path
|
|
4
|
+
(Patrick Cheng)
|
|
5
|
+
- #66: On Windows, File#unlink does not delete the file like it does
|
|
6
|
+
on POSIX (Greg Mefford)
|
|
7
|
+
- Check config/environment.rb in addition to production.rb for
|
|
8
|
+
threadsafe (Joe Kutner)
|
|
9
|
+
- #37, #64: Fix issues with Bundler and recent Rubygems/Rails
|
|
10
|
+
|
|
11
|
+
== 1.3.3
|
|
12
|
+
|
|
13
|
+
- Note: 1.3.3 was YANKED due to #62
|
|
14
|
+
- Move all jars to WEB-INF/lib, and leave an empty jar in the original
|
|
15
|
+
place
|
|
16
|
+
- Deal with private Kernel#gem method in recent RubyGems
|
|
17
|
+
- Deal with Gem::Specification#full_gem_path changes in RG 1.8.x
|
|
18
|
+
- GH #42: Tricks to allow Bundler to find git repo gems even when they
|
|
19
|
+
are excluded form production
|
|
20
|
+
|
|
1
21
|
== 1.3.2
|
|
2
22
|
|
|
3
23
|
- Compatibility with rake 0.9.x, avoid deprecation warnings and deal
|
|
@@ -12,7 +32,7 @@
|
|
|
12
32
|
== 1.3.0
|
|
13
33
|
|
|
14
34
|
- Warbler can now package regular Ruby projects as executable jar
|
|
15
|
-
files. See the README.
|
|
35
|
+
files. See the README.rdoc file for details.
|
|
16
36
|
- WARBLER-18: Heed BUNDLE_GEMFILE in environment
|
|
17
37
|
- WARBLER-17: Allow config.excludes to work for files in public/
|
|
18
38
|
- GH#3, #12, #17: Properly bundle when BUNDLE_PATH is set or
|
data/LICENSE.txt
CHANGED
data/{README.txt → README.rdoc}
RENAMED
|
@@ -11,9 +11,11 @@ Ruby applications to assemble and Just Work.
|
|
|
11
11
|
== Getting Started
|
|
12
12
|
|
|
13
13
|
1. Install the gem: <tt>gem install warbler</tt>.
|
|
14
|
+
|
|
14
15
|
2. Run warbler in the top directory of your application: <tt>warble</tt>.
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
3a. For a web project, deploy your myapp.war file to your favorite Java application server.
|
|
18
|
+
|
|
17
19
|
3b. For a standalone applications, just run it: <tt>java -jar myapp.jar</tt>.
|
|
18
20
|
|
|
19
21
|
== Usage
|
|
@@ -47,7 +49,7 @@ You can either add features to the warbler command line:
|
|
|
47
49
|
|
|
48
50
|
warble FEATURE war
|
|
49
51
|
|
|
50
|
-
or configure them in config/warble.rb to always be used.
|
|
52
|
+
or configure them in <tt>config/warble.rb</tt> to always be used.
|
|
51
53
|
|
|
52
54
|
config.features = %w(FEATURE)
|
|
53
55
|
|
|
@@ -63,11 +65,26 @@ Currently, three features are available.
|
|
|
63
65
|
(Note: jar-based applications are executable by default.)
|
|
64
66
|
* +compiled+: This uses +jrubyc+ to precompile all .rb files in your
|
|
65
67
|
application to .class files and includes those in the .war instead
|
|
66
|
-
of the Ruby sources.
|
|
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')
|
|
67
72
|
|
|
68
73
|
Features may form the basis for a third-party plugin system in the
|
|
69
74
|
future if there is demand.
|
|
70
75
|
|
|
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
|
|
82
|
+
|
|
83
|
+
warble compiled war
|
|
84
|
+
|
|
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>.
|
|
87
|
+
|
|
71
88
|
== War or Jar?
|
|
72
89
|
|
|
73
90
|
War-based projects are for Rails, Merb, or Rack-based web
|
|
@@ -121,13 +138,10 @@ found in the +Gemfile+ and will refuse to include it in the archive.
|
|
|
121
138
|
Rails applications are detected automatically and configured appropriately.
|
|
122
139
|
The following items are set up for you:
|
|
123
140
|
|
|
124
|
-
* Your application runs in the +production+ environment by default.
|
|
125
|
-
Change it in <tt>config/warble.rb</tt> (see below).
|
|
141
|
+
* Your application runs in the +production+ environment by default. Change it in <tt>config/warble.rb</tt> (see below).
|
|
126
142
|
* 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.
|
|
129
|
-
* Multi-thread-safe execution (as introduced in Rails 2.2) is detected
|
|
130
|
-
and runtime pooling is disabled.
|
|
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.
|
|
131
145
|
|
|
132
146
|
=== Merb applications
|
|
133
147
|
|
|
@@ -143,7 +157,7 @@ probably need to specify framework and application gems in
|
|
|
143
157
|
config/warble.rb unless you're using Bundler to manage your gems.
|
|
144
158
|
<tt>ENV['RACK_ENV']</tt> will be set to +production+.
|
|
145
159
|
|
|
146
|
-
See {the examples in the jruby-rack project}[http://github.com/
|
|
160
|
+
See {the examples in the jruby-rack project}[http://github.com/jruby/jruby-rack/tree/master/examples/]
|
|
147
161
|
of how to configure Warbler to package Camping and Sinatra apps.
|
|
148
162
|
|
|
149
163
|
=== Configuration auto-detect notes
|
|
@@ -233,11 +247,11 @@ http://kenai.com/jira/browse/WARBLER.
|
|
|
233
247
|
You can get the Warbler source using Git, in any of the following ways:
|
|
234
248
|
|
|
235
249
|
git clone git://git.caldersphere.net/warbler.git
|
|
236
|
-
git clone git://github.com/
|
|
250
|
+
git clone git://github.com/jruby/warbler.git
|
|
237
251
|
git clone git://kenai.com/warbler~main
|
|
238
252
|
|
|
239
253
|
You can also download a tarball of Warbler source at
|
|
240
|
-
|
|
254
|
+
https://github.com/jruby/warbler/tarball/master.
|
|
241
255
|
|
|
242
256
|
== Development
|
|
243
257
|
|
data/Rakefile
CHANGED
|
@@ -1,54 +1,27 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c) 2010-
|
|
2
|
+
# Copyright (c) 2010-2012 Engine Yard, Inc.
|
|
3
3
|
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
|
|
4
4
|
# This source code is available under the MIT license.
|
|
5
5
|
# See the file LICENSE.txt for details.
|
|
6
6
|
#++
|
|
7
7
|
|
|
8
8
|
begin
|
|
9
|
+
require 'bundler'
|
|
10
|
+
gem_helper = Bundler::GemHelper.new(Dir.pwd)
|
|
11
|
+
gem_helper.install
|
|
12
|
+
gemspec = gem_helper.gemspec
|
|
9
13
|
require 'bundler/setup'
|
|
10
14
|
rescue LoadError
|
|
15
|
+
puts $!
|
|
11
16
|
puts "Please install Bundler and run 'bundle install' to ensure you have all dependencies"
|
|
12
17
|
end
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"LICENSE.txt", "Rakefile", "*.erb", "*.rb", "bin/*",
|
|
17
|
-
"ext/**/*", "lib/**/*", "spec/**/*.rb", "spec/sample*/**/*.*"
|
|
18
|
-
].to_a.reject{|f| f=~%r{spec/sample/(MANIFEST|link|web.xml)}}.sort.uniq
|
|
19
|
-
|
|
20
|
-
begin
|
|
21
|
-
File.open("Manifest.txt", "wb") {|f| MANIFEST.each {|n| f << "#{n}\n"} }
|
|
22
|
-
require 'hoe'
|
|
23
|
-
require File.dirname(__FILE__) + '/lib/warbler/version'
|
|
24
|
-
Hoe.plugin :rubyforge
|
|
25
|
-
hoe = Hoe.spec("warbler") do |p|
|
|
26
|
-
p.version = Warbler::VERSION
|
|
27
|
-
p.rubyforge_name = "caldersphere"
|
|
28
|
-
p.url = "http://caldersphere.rubyforge.org/warbler"
|
|
29
|
-
p.author = "Nick Sieger"
|
|
30
|
-
p.email = "nick@nicksieger.com"
|
|
31
|
-
p.summary = "Warbler chirpily constructs .war files of your Rails applications."
|
|
32
|
-
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
|
33
|
-
p.description = p.paragraphs_of('README.txt', 1...2).join("\n\n")
|
|
34
|
-
p.extra_deps += [['rake', '>= 0.8.7'], ['jruby-jars', '>= 1.4.0'], ['jruby-rack', '>= 1.0.0'], ['rubyzip', '>= 0.9.4']]
|
|
35
|
-
p.clean_globs += %w(MANIFEST web.xml init.rb).map{|f| "spec/sample*/#{f}*" }
|
|
36
|
-
end
|
|
37
|
-
hoe.spec.files = MANIFEST
|
|
38
|
-
hoe.spec.rdoc_options += ["-SHN", "-f", "darkfish"]
|
|
39
|
-
|
|
40
|
-
task :gemspec do
|
|
41
|
-
File.open("#{hoe.name}.gemspec", "w") {|f| f << hoe.spec.to_ruby }
|
|
42
|
-
end
|
|
43
|
-
task :package => :gemspec
|
|
44
|
-
rescue LoadError
|
|
45
|
-
puts "You really need Hoe installed to be able to package this gem"
|
|
46
|
-
end
|
|
19
|
+
require 'rake/clean'
|
|
20
|
+
CLEAN << "pkg" << "doc"
|
|
47
21
|
|
|
48
22
|
require 'spec/rake/spectask'
|
|
49
|
-
require 'spec/rake/verify_rcov'
|
|
50
23
|
|
|
51
|
-
Spec::Rake::SpecTask.new
|
|
24
|
+
Spec::Rake::SpecTask.new do |t|
|
|
52
25
|
t.spec_opts ||= []
|
|
53
26
|
t.spec_opts << "--options" << "spec/spec.opts"
|
|
54
27
|
end
|
|
@@ -61,6 +34,8 @@ Spec::Rake::SpecTask.new("spec:rcov") do |t|
|
|
|
61
34
|
t.rcov = true
|
|
62
35
|
end
|
|
63
36
|
|
|
37
|
+
require 'spec/rake/verify_rcov'
|
|
38
|
+
|
|
64
39
|
RCov::VerifyTask.new(:rcov => "spec:rcov") do |t|
|
|
65
40
|
t.threshold = 100
|
|
66
41
|
end
|
|
@@ -88,11 +63,29 @@ rescue LoadError
|
|
|
88
63
|
end
|
|
89
64
|
|
|
90
65
|
# Make sure jar gets compiled before the gem is built
|
|
91
|
-
task Rake::Task['
|
|
66
|
+
task Rake::Task['build'].prerequisites.first => :jar
|
|
92
67
|
|
|
93
68
|
task :warbler_jar => 'pkg' do
|
|
94
69
|
ruby "-rubygems", "-Ilib", "-S", "bin/warble"
|
|
95
70
|
mv "warbler.jar", "pkg/warbler-#{Warbler::VERSION}.jar"
|
|
96
71
|
end
|
|
97
72
|
|
|
98
|
-
task :
|
|
73
|
+
task :build => :warbler_jar
|
|
74
|
+
|
|
75
|
+
require 'rdoc/task'
|
|
76
|
+
RDoc::Task.new(:docs) do |rd|
|
|
77
|
+
rd.rdoc_dir = "doc"
|
|
78
|
+
rd.rdoc_files.include("README.rdoc", "History.txt", "LICENSE.txt")
|
|
79
|
+
rd.rdoc_files += gemspec.require_paths
|
|
80
|
+
rd.options << '--title' << "#{gemspec.name}-#{gemspec.version} Documentation"
|
|
81
|
+
rd.options += gemspec.rdoc_options
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
task :release => :docs do
|
|
85
|
+
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml"))) rescue nil
|
|
86
|
+
if config
|
|
87
|
+
dir = "/var/www/gforge-projects/#{gemspec.rubyforge_project}/#{gemspec.name}"
|
|
88
|
+
dest "#{config["username"]}@rubyforge.org:#{dir}"
|
|
89
|
+
sh %{rsync -av --delete doc/ #{dest}}
|
|
90
|
+
end
|
|
91
|
+
end
|
data/lib/warbler/application.rb
CHANGED
data/lib/warbler/config.rb
CHANGED
data/lib/warbler/gems.rb
CHANGED
data/lib/warbler/jar.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c) 2010-
|
|
2
|
+
# Copyright (c) 2010-2012 Engine Yard, Inc.
|
|
3
3
|
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
|
|
4
4
|
# This source code is available under the MIT license.
|
|
5
5
|
# See the file LICENSE.txt for details.
|
|
@@ -17,6 +17,7 @@ module Warbler
|
|
|
17
17
|
# * Any object responding to +read+ representing an in-memory blob
|
|
18
18
|
# * A String filename pointing to a file on disk
|
|
19
19
|
class Jar
|
|
20
|
+
include PathmapHelper
|
|
20
21
|
include RakeHelper
|
|
21
22
|
|
|
22
23
|
DEFAULT_MANIFEST = %{Manifest-Version: 1.0\nCreated-By: Warbler #{Warbler::VERSION}\n\n}
|
|
@@ -129,7 +130,8 @@ module Warbler
|
|
|
129
130
|
# skip development dependencies
|
|
130
131
|
return if gem.respond_to?(:type) and gem.type != :runtime
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
# Deal with deprecated Gem.source_index and #search
|
|
134
|
+
matched = gem.respond_to?(:to_spec) ? [gem.to_spec] : Gem.source_index.search(gem)
|
|
133
135
|
fail "gem '#{gem}' not installed" if matched.empty?
|
|
134
136
|
spec = matched.last
|
|
135
137
|
end
|
|
@@ -196,15 +198,6 @@ module Warbler
|
|
|
196
198
|
binding
|
|
197
199
|
end
|
|
198
200
|
|
|
199
|
-
def apply_pathmaps(config, file, pathmaps)
|
|
200
|
-
file = file[2..-1] if file =~ /^\.\//
|
|
201
|
-
pathmaps = config.pathmaps.send(pathmaps)
|
|
202
|
-
pathmaps.each do |p|
|
|
203
|
-
file = file.pathmap(p)
|
|
204
|
-
end if pathmaps
|
|
205
|
-
file
|
|
206
|
-
end
|
|
207
|
-
|
|
208
201
|
def ensure_directory_entries
|
|
209
202
|
files.select {|k,v| !v.nil? }.each do |k,v|
|
|
210
203
|
dir = File.dirname(k)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright (c) 2010-2012 Engine Yard, Inc.
|
|
3
|
+
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
|
|
4
|
+
# This source code is available under the MIT license.
|
|
5
|
+
# See the file LICENSE.txt for details.
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
module Warbler
|
|
9
|
+
module PathmapHelper
|
|
10
|
+
def apply_pathmaps(config, file, pathmaps)
|
|
11
|
+
file = file.to_s
|
|
12
|
+
file = file[2..-1] if file =~ /^\.\//
|
|
13
|
+
pathmaps = config.pathmaps.send(pathmaps)
|
|
14
|
+
pathmaps.each do |p|
|
|
15
|
+
file = file.pathmap(p)
|
|
16
|
+
end if pathmaps
|
|
17
|
+
file
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/warbler/rake_helper.rb
CHANGED
data/lib/warbler/task.rb
CHANGED
|
@@ -3,3 +3,6 @@ ENV['GEM_HOME'] ||= File.expand_path('../..', __FILE__)
|
|
|
3
3
|
<% else %>
|
|
4
4
|
ENV['GEM_HOME'] ||= File.expand_path('../../<%= config.relative_gem_path %>', __FILE__)
|
|
5
5
|
<% end %>
|
|
6
|
+
<% if config.bundler && config.bundler[:gemfile_path] %>
|
|
7
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../<%= config.bundler[:gemfile_path] %>', __FILE__)
|
|
8
|
+
<% end %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c) 2010-
|
|
2
|
+
# Copyright (c) 2010-2012 Engine Yard, Inc.
|
|
3
3
|
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
|
|
4
4
|
# This source code is available under the MIT license.
|
|
5
5
|
# See the file LICENSE.txt for details.
|
|
@@ -11,6 +11,7 @@ module Warbler
|
|
|
11
11
|
# be added to the project.
|
|
12
12
|
class Bundler
|
|
13
13
|
include Trait
|
|
14
|
+
include PathmapHelper
|
|
14
15
|
|
|
15
16
|
def self.detect?
|
|
16
17
|
File.exist?(ENV['BUNDLE_GEMFILE'] || "Gemfile")
|
|
@@ -42,7 +43,10 @@ module Warbler
|
|
|
42
43
|
full_gem_path = Pathname.new(spec.full_gem_path)
|
|
43
44
|
tries = 2
|
|
44
45
|
(full_gem_path = full_gem_path.dirname; tries -= 1) while tries > 0 && !full_gem_path.join('bundler.gemspec').exist?
|
|
45
|
-
spec.loaded_from = full_gem_path.to_s
|
|
46
|
+
spec.loaded_from = full_gem_path.join('bundler.gemspec').to_s
|
|
47
|
+
# RubyGems 1.8.x: @full_gem_path is cached, so we have to set it
|
|
48
|
+
def spec.full_gem_path=(p); @full_gem_path = p; end
|
|
49
|
+
spec.full_gem_path = full_gem_path.to_s
|
|
46
50
|
end
|
|
47
51
|
|
|
48
52
|
case spec.source
|
|
@@ -58,6 +62,7 @@ module Warbler
|
|
|
58
62
|
end
|
|
59
63
|
end
|
|
60
64
|
config.bundler[:gemfile] = ::Bundler.default_gemfile
|
|
65
|
+
config.bundler[:gemfile_path] = apply_pathmaps(config, relative_from_pwd(::Bundler.default_gemfile), :application)
|
|
61
66
|
config.bundler[:lockfile] = ::Bundler.default_lockfile
|
|
62
67
|
config.bundler[:frozen] = ::Bundler.settings[:frozen]
|
|
63
68
|
path = ::Bundler.settings[:path]
|
|
@@ -71,12 +76,11 @@ module Warbler
|
|
|
71
76
|
|
|
72
77
|
# Add Bundler Gemfiles and git repositories to the archive.
|
|
73
78
|
def add_bundler_files(jar)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
jar.files[jar.apply_pathmaps(config, gemfile, :application)] = config.bundler[:gemfile].to_s
|
|
79
|
+
gemfile = relative_from_pwd(config.bundler[:gemfile])
|
|
80
|
+
lockfile = relative_from_pwd(config.bundler[:lockfile])
|
|
81
|
+
jar.files[apply_pathmaps(config, gemfile, :application)] = config.bundler[:gemfile].to_s
|
|
78
82
|
if File.exist?(lockfile)
|
|
79
|
-
jar.files[
|
|
83
|
+
jar.files[apply_pathmaps(config, lockfile, :application)] = config.bundler[:lockfile].to_s
|
|
80
84
|
end
|
|
81
85
|
if config.bundler[:git_specs]
|
|
82
86
|
pathmap = "#{config.relative_gem_path}/bundler/gems/%p"
|
|
@@ -84,25 +88,50 @@ module Warbler
|
|
|
84
88
|
config.pathmaps.git = [pathmap]
|
|
85
89
|
config.bundler[:git_specs].each do |spec|
|
|
86
90
|
full_gem_path = Pathname.new(spec.full_gem_path)
|
|
87
|
-
|
|
91
|
+
|
|
92
|
+
gem_relative_path = full_gem_path.relative_path_from(::Bundler.install_path)
|
|
93
|
+
filenames = []
|
|
94
|
+
gem_relative_path.each_filename { |f| filenames << f }
|
|
95
|
+
|
|
96
|
+
exclude_gems = true
|
|
97
|
+
unless filenames.empty?
|
|
98
|
+
full_gem_path = Pathname.new(::Bundler.install_path) + filenames.first
|
|
99
|
+
exclude_gems = false
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if spec.groups.include?(:warbler_excluded)
|
|
103
|
+
pattern = "#{full_gem_path.to_s}/**/#{spec.name}.gemspec" # #42: gemspec only to avert Bundler error
|
|
104
|
+
else
|
|
105
|
+
pattern = "#{full_gem_path.to_s}/**/*"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
FileList[pattern].each do |src|
|
|
88
109
|
f = Pathname.new(src).relative_path_from(full_gem_path).to_s
|
|
89
|
-
next if config.gem_excludes && config.gem_excludes.any? {|rx| f =~ rx }
|
|
90
|
-
jar.files[
|
|
110
|
+
next if exclude_gems && config.gem_excludes && config.gem_excludes.any? {|rx| f =~ rx }
|
|
111
|
+
jar.files[apply_pathmaps(config, File.join(full_gem_path.basename, f), :git)] = src
|
|
91
112
|
end
|
|
92
113
|
end
|
|
93
114
|
end
|
|
94
115
|
end
|
|
95
116
|
|
|
117
|
+
def relative_from_pwd(path)
|
|
118
|
+
if path.relative?
|
|
119
|
+
path
|
|
120
|
+
else
|
|
121
|
+
path.relative_path_from(Pathname.new(Dir.pwd)).to_s
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
96
125
|
private
|
|
97
126
|
|
|
98
127
|
def bundler_specs
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
128
|
+
bundle_without = config.bundle_without.map {|s| s.to_sym}
|
|
129
|
+
definition = ::Bundler.definition
|
|
130
|
+
all = definition.specs.to_a
|
|
131
|
+
requested = definition.specs_for(definition.groups - bundle_without).to_a
|
|
132
|
+
excluded_git_specs = (all - requested).select {|spec| ::Bundler::Source::Git === spec.source }
|
|
133
|
+
excluded_git_specs.each {|spec| spec.groups << :warbler_excluded }
|
|
134
|
+
requested + excluded_git_specs
|
|
106
135
|
end
|
|
107
136
|
end
|
|
108
137
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c) 2010-
|
|
2
|
+
# Copyright (c) 2010-2012 Engine Yard, Inc.
|
|
3
3
|
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
|
|
4
4
|
# This source code is available under the MIT license.
|
|
5
5
|
# See the file LICENSE.txt for details.
|
|
@@ -11,6 +11,7 @@ module Warbler
|
|
|
11
11
|
# executables, require paths, and dependencies for a project.
|
|
12
12
|
class Gemspec
|
|
13
13
|
include Trait
|
|
14
|
+
include PathmapHelper
|
|
14
15
|
|
|
15
16
|
def self.detect?
|
|
16
17
|
!Dir['*.gemspec'].empty?
|
|
@@ -33,14 +34,14 @@ module Warbler
|
|
|
33
34
|
|
|
34
35
|
def update_archive(jar)
|
|
35
36
|
(Dir['**/*'] - config.compiled_ruby_files).each do |f|
|
|
36
|
-
jar.files[
|
|
37
|
+
jar.files[apply_pathmaps(config, f, :application)] = f
|
|
37
38
|
end
|
|
38
39
|
config.compiled_ruby_files.each do |f|
|
|
39
40
|
f = f.sub(/\.rb$/, '.class')
|
|
40
41
|
next unless File.exist?(f)
|
|
41
|
-
jar.files[
|
|
42
|
+
jar.files[apply_pathmaps(config, f, :application)] = f
|
|
42
43
|
end
|
|
43
|
-
bin_path =
|
|
44
|
+
bin_path = apply_pathmaps(config, default_executable, :application)
|
|
44
45
|
add_main_rb(jar, bin_path)
|
|
45
46
|
end
|
|
46
47
|
|
data/lib/warbler/traits/jar.rb
CHANGED
data/lib/warbler/traits/merb.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c) 2010-
|
|
2
|
+
# Copyright (c) 2010-2012 Engine Yard, Inc.
|
|
3
3
|
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
|
|
4
4
|
# This source code is available under the MIT license.
|
|
5
5
|
# See the file LICENSE.txt for details.
|
|
@@ -12,6 +12,7 @@ module Warbler
|
|
|
12
12
|
# +lib+ directories.
|
|
13
13
|
class NoGemspec
|
|
14
14
|
include Trait
|
|
15
|
+
include PathmapHelper
|
|
15
16
|
|
|
16
17
|
def self.detect?
|
|
17
18
|
Jar.detect? && !Gemspec.detect?
|
|
@@ -28,7 +29,7 @@ module Warbler
|
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
def update_archive(jar)
|
|
31
|
-
add_main_rb(jar,
|
|
32
|
+
add_main_rb(jar, apply_pathmaps(config, default_executable, :application))
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
def default_executable
|
data/lib/warbler/traits/rack.rb
CHANGED
data/lib/warbler/traits/rails.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c) 2010-
|
|
2
|
+
# Copyright (c) 2010-2012 Engine Yard, Inc.
|
|
3
3
|
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
|
|
4
4
|
# This source code is available under the MIT license.
|
|
5
5
|
# See the file LICENSE.txt for details.
|
|
@@ -45,7 +45,8 @@ module Warbler
|
|
|
45
45
|
config.init_contents << "#{config.warbler_templates}/rails.erb"
|
|
46
46
|
begin
|
|
47
47
|
rails_env = config.webxml.rails.env
|
|
48
|
-
unless IO.readlines("config/environments/#{rails_env}.rb").grep(/^\s*config\.threadsafe!/).empty?
|
|
48
|
+
unless IO.readlines("config/environments/#{rails_env}.rb").grep(/^\s*config\.threadsafe!/).empty? &&
|
|
49
|
+
IO.readlines("config/environment.rb").grep(/^\s*config\.threadsafe!/).empty?
|
|
49
50
|
config.webxml.jruby.min.runtimes = 1 unless Integer === config.webxml.jruby.min.runtimes
|
|
50
51
|
config.webxml.jruby.max.runtimes = 1 unless Integer === config.webxml.jruby.max.runtimes
|
|
51
52
|
end
|