warbler 2.0.0.rc2 → 2.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/Gemfile +2 -0
- data/Rakefile +6 -0
- data/ext/JarMain.java +2 -2
- data/ext/WarMain.java +2 -4
- data/ext/WarblerJar.java +4 -4
- data/lib/warbler/config.rb +6 -11
- data/lib/warbler/jar.rb +35 -20
- data/lib/warbler/rake_helper.rb +10 -9
- data/lib/warbler/task.rb +2 -2
- data/lib/warbler/traits/bundler.rb +4 -4
- data/lib/warbler/traits/rails.rb +13 -7
- data/lib/warbler/traits/war.rb +36 -13
- data/lib/warbler/version.rb +1 -1
- data/spec/rails4_stub/Gemfile +6 -0
- data/spec/spec_helper.rb +4 -2
- data/spec/warbler/bundler_spec.rb +1 -1
- data/spec/warbler/jar_spec.rb +24 -12
- data/warble.rb +2 -5
- data/warbler.gemspec +2 -2
- data/web.xml.erb +6 -5
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11eb3cb9e82388ec1b70b5ea6a5706449ea71b43
|
4
|
+
data.tar.gz: 3812f3bf1751fad830d4b918fad26505816700a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b60b3bba36944c31cee619754322afa44eebfc708fee0016d1ca0170eee28972b69ad570bdb6c4540ece320a9a814c0ee7852419171538cbdbc3f05c2bb5776
|
7
|
+
data.tar.gz: 5057d8bbf554d78bfb9ce2bd13ee7e50903a7cacd3caf9e2475c8a81933ff65801853a6bf9d2ec093ae29a04a9822b9c6dad63d4d42d558656c6a08ef309b543
|
data/.travis.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
rvm:
|
2
|
-
- jruby-9.0.
|
2
|
+
- jruby-9.0.5.0
|
3
3
|
branches:
|
4
4
|
only:
|
5
5
|
- master
|
@@ -23,4 +23,4 @@ notifications:
|
|
23
23
|
before_install:
|
24
24
|
- sudo apt-get update && sudo apt-get install git
|
25
25
|
- git fetch --unshallow
|
26
|
-
- gem install bundler
|
26
|
+
- gem install bundler
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -18,6 +18,12 @@ end
|
|
18
18
|
require 'rake/clean'
|
19
19
|
CLEAN << "pkg" << "doc" << Dir['integration/**/target']
|
20
20
|
|
21
|
+
unless Rake::Application.method_defined? :last_comment
|
22
|
+
Rake::Application.module_eval do
|
23
|
+
alias_method :last_comment, :last_description
|
24
|
+
end
|
25
|
+
end # Rake 11 compatibility (due rspec/core/rake_task < 3.0)
|
26
|
+
|
21
27
|
require 'rspec/core/rake_task'
|
22
28
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
23
29
|
t.rspec_opts = ['--color', "--format documentation"]
|
data/ext/JarMain.java
CHANGED
@@ -26,7 +26,7 @@ import java.util.jar.JarFile;
|
|
26
26
|
|
27
27
|
public class JarMain implements Runnable {
|
28
28
|
|
29
|
-
static final String MAIN =
|
29
|
+
static final String MAIN = '/' + JarMain.class.getName().replace('.', '/') + ".class";
|
30
30
|
|
31
31
|
protected final String[] args;
|
32
32
|
protected final String archive;
|
@@ -78,7 +78,7 @@ public class JarMain implements Runnable {
|
|
78
78
|
protected String getExtractEntryPath(final JarEntry entry) {
|
79
79
|
final String name = entry.getName();
|
80
80
|
if ( name.startsWith("META-INF/lib") && name.endsWith(".jar") ) {
|
81
|
-
return name.substring(name.lastIndexOf(
|
81
|
+
return name.substring(name.lastIndexOf('/') + 1);
|
82
82
|
}
|
83
83
|
return null; // do not extract entry
|
84
84
|
}
|
data/ext/WarMain.java
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import java.lang.reflect.Method;
|
9
|
-
import java.lang.reflect.Constructor;
|
10
9
|
import java.io.InputStream;
|
11
10
|
import java.io.ByteArrayInputStream;
|
12
11
|
import java.io.SequenceInputStream;
|
@@ -21,7 +20,6 @@ import java.util.List;
|
|
21
20
|
import java.util.Properties;
|
22
21
|
import java.util.Map;
|
23
22
|
import java.util.jar.JarEntry;
|
24
|
-
import java.util.Set;
|
25
23
|
|
26
24
|
/**
|
27
25
|
* Used as a Main-Class in the manifest for a .war file, so that you can run
|
@@ -65,7 +63,7 @@ import java.util.Set;
|
|
65
63
|
*/
|
66
64
|
public class WarMain extends JarMain {
|
67
65
|
|
68
|
-
static final String MAIN =
|
66
|
+
static final String MAIN = '/' + WarMain.class.getName().replace('.', '/') + ".class";
|
69
67
|
static final String WEBSERVER_PROPERTIES = "/WEB-INF/webserver.properties";
|
70
68
|
static final String WEBSERVER_JAR = "/WEB-INF/webserver.jar";
|
71
69
|
static final String WEBSERVER_CONFIG = "/WEB-INF/webserver.xml";
|
@@ -219,7 +217,7 @@ public class WarMain extends JarMain {
|
|
219
217
|
// 404.html -> public/404.html
|
220
218
|
return "/public/" + name;
|
221
219
|
}
|
222
|
-
return
|
220
|
+
return '/' + name;
|
223
221
|
}
|
224
222
|
|
225
223
|
@Override
|
data/ext/WarblerJar.java
CHANGED
@@ -74,13 +74,13 @@ public class WarblerJar {
|
|
74
74
|
entry.convertToString().getUnicodeValue());
|
75
75
|
try {
|
76
76
|
byte[] buf = new byte[16384];
|
77
|
-
ByteList
|
78
|
-
int bytesRead
|
77
|
+
ByteList bytes = new ByteList();
|
78
|
+
int bytesRead;
|
79
79
|
while ((bytesRead = entryStream.read(buf)) != -1) {
|
80
|
-
|
80
|
+
bytes.append(buf, 0, bytesRead);
|
81
81
|
}
|
82
82
|
IRubyObject stringio = runtime.getModule("StringIO");
|
83
|
-
return stringio.callMethod(context, "new", runtime.newString(
|
83
|
+
return stringio.callMethod(context, "new", runtime.newString(bytes));
|
84
84
|
} finally {
|
85
85
|
close(entryStream);
|
86
86
|
}
|
data/lib/warbler/config.rb
CHANGED
@@ -120,6 +120,10 @@ module Warbler
|
|
120
120
|
# Ignored unless compile feature is used.
|
121
121
|
attr_accessor :compile_gems
|
122
122
|
|
123
|
+
# Desired options passed to JRuby compiler if compiling to class files.
|
124
|
+
# Ignored unless compile feature is used.
|
125
|
+
attr_accessor :jrubyc_options
|
126
|
+
|
123
127
|
# Warbler writes an "init" file into the war at this location. JRuby-Rack and possibly other
|
124
128
|
# launchers may use this to initialize the Ruby environment.
|
125
129
|
attr_accessor :init_filename
|
@@ -240,17 +244,8 @@ module Warbler
|
|
240
244
|
end
|
241
245
|
end
|
242
246
|
|
243
|
-
|
244
|
-
|
245
|
-
$stderr.puts "config.war_name deprecated; replace with config.jar_name" #:nocov:
|
246
|
-
jar_name #:nocov:
|
247
|
-
end
|
248
|
-
|
249
|
-
# Deprecated
|
250
|
-
def war_name=(w)
|
251
|
-
$stderr.puts "config.war_name deprecated; replace with config.jar_name" #:nocov:
|
252
|
-
self.jar_name = w #:nocov:
|
253
|
-
end
|
247
|
+
alias_method :war_name, :jar_name
|
248
|
+
alias_method :war_name=, :jar_name=
|
254
249
|
|
255
250
|
private
|
256
251
|
def warbler_vendor_excludes(warbler_home)
|
data/lib/warbler/jar.rb
CHANGED
@@ -43,34 +43,49 @@ module Warbler
|
|
43
43
|
|
44
44
|
if config.compile_gems
|
45
45
|
ruby_files = gather_all_rb_files(config)
|
46
|
-
|
46
|
+
run_jrubyc(config, ruby_files.values)
|
47
47
|
replace_compiled_ruby_files_and_gems(config, ruby_files)
|
48
48
|
else
|
49
49
|
compiled_ruby_files = config.compiled_ruby_files - config.excludes.to_a
|
50
|
-
|
50
|
+
run_jrubyc(config, compiled_ruby_files)
|
51
51
|
replace_compiled_ruby_files(config, compiled_ruby_files)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
if config.webxml && config.webxml.context_params.has_key?('jruby.compat.version')
|
57
|
-
compat_version = "--#{config.webxml.jruby.compat.version}"
|
58
|
-
else
|
59
|
-
compat_version = ''
|
60
|
-
end
|
55
|
+
DEFAULT_COMPILED_FILES_SLICE = 2500
|
61
56
|
|
62
|
-
|
57
|
+
def run_jrubyc(config, compiled_ruby_files)
|
58
|
+
slice_size = (ENV['WARBLER_COMPILED_FILES_SLICE'] || 0).to_i
|
59
|
+
slice_size = DEFAULT_COMPILED_FILES_SLICE if slice_size <= 0
|
60
|
+
compiled_ruby_files.each_slice(slice_size) do |files|
|
61
|
+
files = "\"#{files.join('" "')}\""
|
62
|
+
classpath = config.java_libs.map { |lib| "\"#{lib.gsub('"', '\\"')}\"" }.join(File::PATH_SEPARATOR)
|
63
63
|
# Need to use the version of JRuby in the application to compile it
|
64
|
-
javac_cmd = %Q{java -classpath #{
|
64
|
+
javac_cmd = %Q{java -classpath #{classpath} #{java_version(config)} org.jruby.Main -S jrubyc #{jrubyc_options(config)} #{files}}
|
65
65
|
if which('java').nil? && which('env')
|
66
|
-
|
66
|
+
sh_jrubyc %Q{env -i #{javac_cmd}}
|
67
67
|
else
|
68
|
-
|
68
|
+
sh_jrubyc javac_cmd
|
69
69
|
end
|
70
|
-
raise "Compile failed" if $?.exitstatus > 0
|
71
70
|
end
|
72
71
|
@compiled = true
|
73
72
|
end
|
73
|
+
# @deprecated only due compatibility
|
74
|
+
alias_method :run_javac, :run_jrubyc
|
75
|
+
|
76
|
+
def sh_jrubyc(cmd)
|
77
|
+
sh(cmd) do |ok, res|
|
78
|
+
raise "Compilation of .rb files failed (#{res})" unless ok
|
79
|
+
end
|
80
|
+
end
|
81
|
+
private :sh_jrubyc
|
82
|
+
|
83
|
+
def jrubyc_options(config)
|
84
|
+
options = ENV['WARBLER_JRUBYC_OPTIONS'] || config.jrubyc_options
|
85
|
+
options = options.join(' ') if options.is_a?(Array)
|
86
|
+
options || ''
|
87
|
+
end
|
88
|
+
private :jrubyc_options
|
74
89
|
|
75
90
|
def java_version(config)
|
76
91
|
config.bytecode_version ? "-Djava.specification.version=#{config.bytecode_version}" : ''
|
@@ -158,10 +173,10 @@ module Warbler
|
|
158
173
|
end
|
159
174
|
rm_f path
|
160
175
|
ensure_directory_entries
|
161
|
-
puts "Creating #{path}"
|
162
176
|
if Warbler::Config === config_or_path
|
163
177
|
@files.delete("#{config_or_path.jar_name}/#{path}")
|
164
178
|
end
|
179
|
+
puts "Creating #{path}" unless silent?
|
165
180
|
create_jar path, @files
|
166
181
|
end
|
167
182
|
|
@@ -203,7 +218,7 @@ module Warbler
|
|
203
218
|
full_gem_path = Pathname.new(spec.full_gem_path)
|
204
219
|
|
205
220
|
# skip gems whose full_gem_path does not exist
|
206
|
-
(
|
221
|
+
(warn "skipping #{spec.name} (#{full_gem_path.to_s} does not exist)" ; return) unless full_gem_path.exist?
|
207
222
|
|
208
223
|
@files[apply_pathmaps(config, "#{spec.full_name}.gemspec", :gemspecs)] = StringIO.new(spec.to_ruby)
|
209
224
|
FileList["#{full_gem_path.to_s}/**/*"].each do |src|
|
@@ -217,7 +232,7 @@ module Warbler
|
|
217
232
|
def find_application_files(config)
|
218
233
|
config.dirs.select do |d|
|
219
234
|
exists = File.directory?(d)
|
220
|
-
|
235
|
+
warn "application directory `#{d}' does not exist or is not a directory; skipping" unless exists
|
221
236
|
exists
|
222
237
|
end.each do |d|
|
223
238
|
@files[apply_pathmaps(config, d, :application)] = nil
|
@@ -284,8 +299,8 @@ module Warbler
|
|
284
299
|
zipfile.get_output_stream(entry) {|f| f << src.read }
|
285
300
|
elsif src.nil? || File.directory?(src)
|
286
301
|
if File.symlink?(entry) && ! defined?(JRUBY_VERSION)
|
287
|
-
|
288
|
-
|
302
|
+
warn "directory symlinks are not followed unless using JRuby; " +
|
303
|
+
"#{entry.inspect} contents not in archive"
|
289
304
|
end
|
290
305
|
zipfile.mkdir(entry.dup) # in case it's frozen rubyzip 0.9.6.1 workaround
|
291
306
|
elsif File.symlink?(src)
|
@@ -293,7 +308,7 @@ module Warbler
|
|
293
308
|
elsif File.exist?(src)
|
294
309
|
zipfile.add(entry, src)
|
295
310
|
else
|
296
|
-
|
311
|
+
warn "file not found; #{entry.inspect} not in archive"
|
297
312
|
end
|
298
313
|
end
|
299
314
|
end
|
@@ -314,7 +329,7 @@ module Warbler
|
|
314
329
|
class War < Jar
|
315
330
|
def initialize(*)
|
316
331
|
super
|
317
|
-
|
332
|
+
warn "Warbler::War is deprecated. Please replace all occurrences with Warbler::Jar."
|
318
333
|
end
|
319
334
|
end
|
320
335
|
end
|
data/lib/warbler/rake_helper.rb
CHANGED
@@ -6,24 +6,25 @@
|
|
6
6
|
#++
|
7
7
|
|
8
8
|
module Warbler
|
9
|
-
# This module exists for compatibility with Rake 0.9.
|
10
9
|
module RakeHelper
|
10
|
+
|
11
11
|
def self.included(base)
|
12
12
|
base.class_eval do
|
13
13
|
include Rake::DSL if defined?(Rake::DSL)
|
14
|
-
|
15
|
-
include FileUtils
|
16
|
-
include Rake::FileUtilsExt
|
17
|
-
end
|
14
|
+
include Rake::FileUtilsExt # includes FileUtils
|
18
15
|
end
|
19
16
|
end
|
20
17
|
|
21
18
|
def self.extended(base)
|
22
19
|
base.extend Rake::DSL if defined?(Rake::DSL)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
base.extend Rake::FileUtilsExt
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def silent?
|
26
|
+
Rake.application.options.silent rescue nil
|
27
27
|
end
|
28
|
+
|
28
29
|
end
|
29
30
|
end
|
data/lib/warbler/task.rb
CHANGED
@@ -47,7 +47,7 @@ module Warbler
|
|
47
47
|
end
|
48
48
|
@config ||= Config.new
|
49
49
|
unless @config.kind_of? Config
|
50
|
-
|
50
|
+
warn "Warbler::Config not provided by override in initializer or #{Config::FILE}; using defaults"
|
51
51
|
@config = Config.new
|
52
52
|
end
|
53
53
|
@name = name || @config.jar_extension
|
@@ -82,7 +82,7 @@ module Warbler
|
|
82
82
|
@config.features.each do |feature|
|
83
83
|
t = "#@name:#{feature}"
|
84
84
|
unless Rake.application.lookup(t)
|
85
|
-
|
85
|
+
warn "unknown feature `#{feature}', ignoring"
|
86
86
|
next
|
87
87
|
end
|
88
88
|
Rake::Task[t].invoke
|
@@ -47,7 +47,7 @@ module Warbler
|
|
47
47
|
full_gem_path = full_gem_path.dirname
|
48
48
|
# if at top of the path, meaning we cannot find bundler.gemspec, abort.
|
49
49
|
if full_gem_path.to_s =~ /^[\.\/]$/
|
50
|
-
|
50
|
+
warn("Unable to detect bundler spec under '#{spec.full_gem_path}'' and its sub-dirs")
|
51
51
|
exit
|
52
52
|
end
|
53
53
|
end
|
@@ -64,9 +64,9 @@ module Warbler
|
|
64
64
|
config.bundler[:git_specs] << spec
|
65
65
|
when ::Bundler::Source::Path
|
66
66
|
unless bundler_source_is_warbled_gem_itself?(spec.source)
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
warn("Bundler `path' components are not currently supported.\n" +
|
68
|
+
"The `#{spec.full_name}' component was not bundled.\n" +
|
69
|
+
"Your application may fail to boot!")
|
70
70
|
end
|
71
71
|
else
|
72
72
|
config.gems << spec
|
data/lib/warbler/traits/rails.rb
CHANGED
@@ -45,9 +45,12 @@ module Warbler
|
|
45
45
|
def after_configure
|
46
46
|
config.init_contents << "#{config.warbler_templates}/rails.erb"
|
47
47
|
|
48
|
-
if
|
49
|
-
|
50
|
-
|
48
|
+
if config.webxml.jruby.min.runtimes.is_a?(OpenStruct) &&
|
49
|
+
config.webxml.jruby.max.runtimes.is_a?(OpenStruct) # not set
|
50
|
+
if rails_major_version(0) >= 4 || threadsafe_enabled?
|
51
|
+
config.webxml.jruby.min.runtimes = 1
|
52
|
+
config.webxml.jruby.max.runtimes = 1
|
53
|
+
end
|
51
54
|
end
|
52
55
|
|
53
56
|
config.includes += FileList["public/assets/.sprockets-manifest-*.json"].existing
|
@@ -70,14 +73,17 @@ module Warbler
|
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
73
|
-
def
|
76
|
+
def rails_major_version(default = 0)
|
74
77
|
begin
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
+
File.open("#{ENV['BUNDLE_GEMFILE'] || 'Gemfile'}.lock") do |file|
|
79
|
+
file.each_line do |line|
|
80
|
+
match = line.match /^\s*rails\s\(\s*(\d)\.\d+\.\d+.*\)$/
|
81
|
+
return match[1].to_i if match
|
82
|
+
end
|
78
83
|
end
|
79
84
|
rescue
|
80
85
|
end
|
86
|
+
default
|
81
87
|
end
|
82
88
|
end
|
83
89
|
end
|
data/lib/warbler/traits/war.rb
CHANGED
@@ -68,8 +68,8 @@ module Warbler
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def default_jar_files
|
71
|
-
require 'jruby-jars'
|
72
|
-
require 'jruby-rack'
|
71
|
+
require 'jruby-jars' unless defined? JRubyJars.core_jar_path
|
72
|
+
require 'jruby-rack' unless defined? JRubyJars.jruby_rack_jar_path
|
73
73
|
FileList[JRubyJars.core_jar_path, JRubyJars.stdlib_jar_path, JRubyJars.jruby_rack_jar_path]
|
74
74
|
end
|
75
75
|
|
@@ -134,7 +134,8 @@ module Warbler
|
|
134
134
|
def move_jars_to_webinf_lib(jar, selector = nil)
|
135
135
|
return unless selector # default is false
|
136
136
|
selector = /.*/ if selector == true # move all if not a RegExp given
|
137
|
-
|
137
|
+
default_jar_paths = default_jar_files
|
138
|
+
default_jars = default_jar_paths.map { |file| File.basename(file) }
|
138
139
|
jar.files.keys.select { |k| k =~ /^WEB-INF\/.*\.jar$/ }.each do |k|
|
139
140
|
if k.start_with?('WEB-INF/lib/') # .jar already in WEB-INF/lib
|
140
141
|
if default_jars.include? k.sub('WEB-INF/lib/', '')
|
@@ -144,6 +145,8 @@ module Warbler
|
|
144
145
|
next
|
145
146
|
end
|
146
147
|
next unless selector =~ File.basename(k)
|
148
|
+
# default jars might end up mapped twice as they're part of gems
|
149
|
+
next if default_jar_paths.include?(jar.files[k])
|
147
150
|
name = k.sub('WEB-INF', '')[1..-1].gsub(/[\/\\]/, '-')
|
148
151
|
jar.files["WEB-INF/lib/#{name}"] = jar.files[k]
|
149
152
|
jar.files[k] = empty_jar
|
@@ -176,15 +179,6 @@ module Warbler
|
|
176
179
|
@table = Hash.new { |h, k| h[k] = WebxmlOpenStruct.new(k) }
|
177
180
|
end
|
178
181
|
|
179
|
-
def servlet_context_listener
|
180
|
-
case self.booter
|
181
|
-
when :rack
|
182
|
-
"org.jruby.rack.RackServletContextListener"
|
183
|
-
else # :rails, default
|
184
|
-
"org.jruby.rack.rails.RailsServletContextListener"
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
182
|
def [](key)
|
189
183
|
new_ostruct_member(key)
|
190
184
|
send(key)
|
@@ -195,6 +189,35 @@ module Warbler
|
|
195
189
|
send("#{key}=", value)
|
196
190
|
end
|
197
191
|
|
192
|
+
def method_missing(mid, *args)
|
193
|
+
len = args.length
|
194
|
+
if mname = mid[/.*(?==\z)/m]
|
195
|
+
if len != 1
|
196
|
+
raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
|
197
|
+
end
|
198
|
+
modifiable[new_ostruct_member(mname)] = args[0]
|
199
|
+
elsif len == 0
|
200
|
+
@table[mid]
|
201
|
+
else
|
202
|
+
err = NoMethodError.new "undefined method `#{mid}' for #{self}", mid, args
|
203
|
+
err.set_backtrace caller(1)
|
204
|
+
raise err
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def respond_to_missing?(mid, include_private = false)
|
209
|
+
@table.key?(mid.to_s.chomp('=').to_sym) || super
|
210
|
+
end
|
211
|
+
|
212
|
+
def servlet_context_listener
|
213
|
+
case self.booter
|
214
|
+
when :rack
|
215
|
+
"org.jruby.rack.RackServletContextListener"
|
216
|
+
else # :rails, default
|
217
|
+
"org.jruby.rack.rails.RailsServletContextListener"
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
198
221
|
def context_params(escape = true)
|
199
222
|
require 'cgi'
|
200
223
|
params = {}
|
@@ -210,7 +233,7 @@ module Warbler
|
|
210
233
|
end
|
211
234
|
end
|
212
235
|
extra_ignored = Array === ignored ? ignored : []
|
213
|
-
params.delete_if {|k,
|
236
|
+
params.delete_if { |k,_| ['ignored', *extra_ignored].include?(k.to_s) }
|
214
237
|
params
|
215
238
|
end
|
216
239
|
|
data/lib/warbler/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -73,12 +73,14 @@ module ExampleGroupHelpers
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
def cleanup_temp_files(
|
76
|
+
def cleanup_temp_files(options = { :include => nil })
|
77
|
+
except_files = Array(options[:except])
|
78
|
+
include_files = Array(options[:include])
|
77
79
|
after(:each) do
|
78
80
|
FileUtils.rm_rf FileList[*(["log", ".bundle", "tmp"] - except_files)]
|
79
81
|
FileUtils.rm_f FileList[*(["*.war", "*.foobar", "**/config.ru", "*web.xml*", "config/web.xml*",
|
80
82
|
"config/warble.rb", "file.txt", 'manifest', '*Gemfile*', 'MANIFEST.MF*', 'init.rb*',
|
81
|
-
'**/*.class'] - except_files)]
|
83
|
+
'**/*.class'] + include_files - except_files)]
|
82
84
|
end
|
83
85
|
end
|
84
86
|
|
@@ -218,7 +218,7 @@ describe Warbler::Jar, "with Bundler" do
|
|
218
218
|
|
219
219
|
context "in a rack app" do
|
220
220
|
run_in_directory "spec/sample_rack_war"
|
221
|
-
cleanup_temp_files '**/config.ru'
|
221
|
+
cleanup_temp_files except: '**/config.ru'
|
222
222
|
|
223
223
|
it "should have default load path" do
|
224
224
|
jar.add_init_file(config)
|
data/spec/warbler/jar_spec.rb
CHANGED
@@ -35,7 +35,7 @@ describe Warbler::Jar do
|
|
35
35
|
|
36
36
|
context "in a jar project" do
|
37
37
|
run_in_directory "spec/sample_jar"
|
38
|
-
cleanup_temp_files
|
38
|
+
cleanup_temp_files include: '*.java'
|
39
39
|
|
40
40
|
it "detects a Jar trait" do
|
41
41
|
config.traits.should include(Warbler::Traits::Jar)
|
@@ -183,7 +183,7 @@ describe Warbler::Jar do
|
|
183
183
|
jar.compile(config)
|
184
184
|
jar.apply(config)
|
185
185
|
file_list(%r{sample_jar.*\.rb$}).size.should == 2
|
186
|
-
file_list(%r{gems.*\.class$}).size.should
|
186
|
+
file_list(%r{gems.*\.class$}).size.should >= 80 # depending on RubyZip version
|
187
187
|
end
|
188
188
|
|
189
189
|
it "does not compile included gems by default" do
|
@@ -194,6 +194,14 @@ describe Warbler::Jar do
|
|
194
194
|
file_list(%r{gems.*\.class$}).size.should == 0
|
195
195
|
end
|
196
196
|
|
197
|
+
it "compiles with jrubyc options when specified" do
|
198
|
+
config.jrubyc_options = [ '--java' ]
|
199
|
+
config.compiled_ruby_files = %w(lib/sample_jar.rb)
|
200
|
+
jar.compile(config)
|
201
|
+
jar.apply(config)
|
202
|
+
expect( FileList['*'] ).to include 'SampleJar.java'
|
203
|
+
end
|
204
|
+
|
197
205
|
end
|
198
206
|
|
199
207
|
context "with a gemspec without a default executable" do
|
@@ -808,23 +816,23 @@ describe Warbler::Jar do
|
|
808
816
|
rm_rf File.dirname(manifest_file)
|
809
817
|
end
|
810
818
|
|
811
|
-
context "
|
819
|
+
context "when rails version is found in Gemfile.lock" do
|
812
820
|
before :each do
|
813
|
-
File.
|
814
|
-
end
|
815
|
-
|
816
|
-
after :each do
|
817
|
-
rm "Gemfile"
|
821
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../rails4_stub/Gemfile', File.dirname(__FILE__))
|
818
822
|
end
|
819
823
|
|
820
824
|
it_should_behave_like "threaded environment"
|
821
825
|
it_should_behave_like "asset pipeline"
|
822
826
|
end
|
823
827
|
|
824
|
-
context "when rails version is not
|
828
|
+
context "when rails version is not found in Gemfile.lock" do
|
825
829
|
before :each do
|
826
|
-
File.open("Gemfile",
|
827
|
-
File.open("Gemfile.lock",
|
830
|
+
File.open("Gemfile", 'w') { |f| f.puts "gem 'rails-name'\n\n" }
|
831
|
+
File.open("Gemfile.lock", 'w') do |f|
|
832
|
+
f.puts " rails-name (4.0.0)"
|
833
|
+
f.puts " apry-rails (4.2.0)"
|
834
|
+
f.puts ""
|
835
|
+
end
|
828
836
|
end
|
829
837
|
|
830
838
|
after :each do
|
@@ -832,7 +840,11 @@ describe Warbler::Jar do
|
|
832
840
|
rm "Gemfile.lock"
|
833
841
|
end
|
834
842
|
|
835
|
-
|
843
|
+
it "doesn't set runtime numbers to 1" do
|
844
|
+
config.webxml.jruby.min.runtimes.should_not == 1
|
845
|
+
config.webxml.jruby.max.runtimes.should_not == 1
|
846
|
+
end
|
847
|
+
|
836
848
|
it_should_behave_like "asset pipeline"
|
837
849
|
end
|
838
850
|
end
|
data/warble.rb
CHANGED
@@ -57,12 +57,12 @@ Warbler::Config.new do |config|
|
|
57
57
|
|
58
58
|
# The most recent versions of gems are used.
|
59
59
|
# You can specify versions of gems by using a hash assignment:
|
60
|
-
# config.gems["rails"] = "2.
|
60
|
+
# config.gems["rails"] = "4.2.5"
|
61
61
|
|
62
62
|
# You can also use regexps or Gem::Dependency objects for flexibility or
|
63
63
|
# finer-grained control.
|
64
64
|
# config.gems << /^sinatra-/
|
65
|
-
# config.gems << Gem::Dependency.new("sinatra", "= 1.4.
|
65
|
+
# config.gems << Gem::Dependency.new("sinatra", "= 1.4.7")
|
66
66
|
|
67
67
|
# Include gem dependencies not mentioned specifically. Default is
|
68
68
|
# true, uncomment to turn off.
|
@@ -152,9 +152,6 @@ Warbler::Config.new do |config|
|
|
152
152
|
# Application booter to use, either :rack or :rails (autodetected by default)
|
153
153
|
# config.webxml.booter = :rails
|
154
154
|
|
155
|
-
# Set JRuby to run in 1.9 mode.
|
156
|
-
# config.webxml.jruby.compat.version = "1.9"
|
157
|
-
|
158
155
|
# When using the :rack booter, "Rackup" script to use.
|
159
156
|
# - For 'rackup.path', the value points to the location of the rackup
|
160
157
|
# script in the web archive file. You need to make sure this file
|
data/warbler.gemspec
CHANGED
@@ -24,8 +24,8 @@ bundle up all of your application files for deployment to a Java environment.}
|
|
24
24
|
|
25
25
|
gem.add_runtime_dependency 'rake', [">= 10.1.0"]
|
26
26
|
gem.add_runtime_dependency 'jruby-jars', [">= 9.0.0.0"]
|
27
|
-
gem.add_runtime_dependency 'jruby-rack', [">= 1.1.1",
|
28
|
-
gem.add_runtime_dependency 'rubyzip', ["
|
27
|
+
gem.add_runtime_dependency 'jruby-rack', [">= 1.1.1", "< 1.3"]
|
28
|
+
gem.add_runtime_dependency 'rubyzip', ["~> 1.0", "< 1.4"]
|
29
29
|
gem.add_development_dependency 'jbundler', "~> 0.9"
|
30
30
|
gem.add_development_dependency 'rspec', "~> 2.10"
|
31
31
|
gem.add_development_dependency 'rdoc', ">= 2.4.2"
|
data/web.xml.erb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
<web-app xmlns="http://
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<!--
|
1
|
+
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
2
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
4
|
+
version="3.0">
|
5
|
+
<!--
|
6
|
+
<display-name>Uncomment and put name :here: for Tomcat Dashboard</display-name>-->
|
6
7
|
|
7
8
|
<% webxml.context_params.each do |k,v| %>
|
8
9
|
<context-param>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warbler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sieger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,23 +61,23 @@ dependencies:
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '1.0'
|
67
67
|
- - "<"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '1.
|
69
|
+
version: '1.4'
|
70
70
|
name: rubyzip
|
71
71
|
prerelease: false
|
72
72
|
type: :runtime
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- - "
|
75
|
+
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '1.0'
|
78
78
|
- - "<"
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: '1.
|
80
|
+
version: '1.4'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
@@ -262,6 +262,8 @@ files:
|
|
262
262
|
- spec/drb_default_id_conv.rb
|
263
263
|
- spec/drb_helper.rb
|
264
264
|
- spec/m2_home/conf/settings.xml
|
265
|
+
- spec/rails4_stub/Gemfile
|
266
|
+
- spec/rails4_stub/Gemfile.lock
|
265
267
|
- spec/sample_bundler/.bundle/config
|
266
268
|
- spec/sample_bundler/Gemfile
|
267
269
|
- spec/sample_bundler/Gemfile.lock
|
@@ -569,6 +571,8 @@ test_files:
|
|
569
571
|
- spec/drb_default_id_conv.rb
|
570
572
|
- spec/drb_helper.rb
|
571
573
|
- spec/m2_home/conf/settings.xml
|
574
|
+
- spec/rails4_stub/Gemfile
|
575
|
+
- spec/rails4_stub/Gemfile.lock
|
572
576
|
- spec/sample_bundler/.bundle/config
|
573
577
|
- spec/sample_bundler/Gemfile
|
574
578
|
- spec/sample_bundler/Gemfile.lock
|