warbler 2.0.1 → 2.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a948686e291d17e74ba5a81f20ac44295eeaf5dc
4
- data.tar.gz: 00179dc599932291918a6e740a9b242cd55aa1d1
3
+ metadata.gz: 0ea2ec506ff64a6cc7d49b7d75e1bb35ed683d22
4
+ data.tar.gz: 3c3eae60fa8d1a946a6bfd2932b85d1f5720eb22
5
5
  SHA512:
6
- metadata.gz: 0b04a6a3f642fdeaf383e9cfa7d9bf1fcf2c5a2e620a586fc04a07db3fa98399e922071301ed0df5155de2fb36ab41698af1cb7e91ea7ebaca2f76926f789b05
7
- data.tar.gz: a79aaf60d19436a6f71767de58ea6c19b932ea9807a85048b15685335538b420871f42da44ca22cbda2b160816c0c0801bf8be46858d10934fee6218d3bd91a1
6
+ metadata.gz: faf7281b8b54b1f1ac812e89852d7ad55904ef3c4fd9beac4f0a01bd2ddc469c24a973ec1535bbdf6c15349f3f5cdafa576f1c6ded932ff6fd4a83471d784bbf
7
+ data.tar.gz: cbe6bd24e52e9fb102e42b9dfead6f34ec26616324357361936050e2dd5d3e9d6be0ea6811ae586b84c56412a0afbf9e6173775bcda4b431d698c7b5238cd778
@@ -1,4 +1,18 @@
1
- == 2x-dev
1
+ == 2.0.2
2
+
3
+ - #380: exclude spec/integration/rakelib and dot-files being packed into .gem
4
+ - #379: 2.0.1 regression due forcing GEM_PATH = GEM_HOME
5
+
6
+ == 2.0.1
7
+
8
+ - #367: avoid duplicate .jar copies in WEB-INF/lib
9
+ - #364: support for compiling .rb files using jrubyc with options
10
+ - #362: limit rubyzip version to not match too far
11
+ - #363: [backport] support for running with (recent) rubyzip 1.2.0
12
+
13
+ == 2.0.0
14
+
15
+ - Initial release with 9k support
2
16
 
3
17
  == 1.4.9
4
18
 
@@ -9,6 +9,7 @@ import java.io.File;
9
9
  import java.io.IOException;
10
10
  import java.io.FileOutputStream;
11
11
  import java.io.InputStream;
12
+ import java.io.PrintStream;
12
13
  import java.lang.reflect.InvocationTargetException;
13
14
  import java.lang.reflect.Method;
14
15
  import java.net.URI;
@@ -104,7 +105,7 @@ public class JarMain implements Runnable {
104
105
  FileOutputStream outStream = new FileOutputStream(file);
105
106
  final byte[] buf = new byte[65536];
106
107
  try {
107
- int bytesRead = 0;
108
+ int bytesRead;
108
109
  while ((bytesRead = entryStream.read(buf)) != -1) {
109
110
  outStream.write(buf, 0, bytesRead);
110
111
  }
@@ -114,7 +115,7 @@ public class JarMain implements Runnable {
114
115
  outStream.close();
115
116
  file.deleteOnExit();
116
117
  }
117
- if (false) debug(entry.getName() + " extracted to " + file.getPath());
118
+ // if (false) debug(entry.getName() + " extracted to " + file.getPath());
118
119
  return file.toURI().toURL();
119
120
  }
120
121
 
@@ -167,7 +168,11 @@ public class JarMain implements Runnable {
167
168
  }
168
169
 
169
170
  protected static void debug(Throwable t) {
170
- if ( isDebug() ) t.printStackTrace(System.out);
171
+ debug(t, System.out);
172
+ }
173
+
174
+ private static void debug(Throwable t, PrintStream out) {
175
+ if ( isDebug() ) t.printStackTrace(out);
171
176
  }
172
177
 
173
178
  protected void warn(String msg) {
@@ -180,7 +185,7 @@ public class JarMain implements Runnable {
180
185
 
181
186
  protected static void error(String msg, Throwable t) {
182
187
  System.err.println("ERROR: " + msg);
183
- debug(t);
188
+ debug(t, System.err);
184
189
  }
185
190
 
186
191
  protected void delete(File f) {
@@ -100,13 +100,14 @@ public class WarMain extends JarMain {
100
100
  String execArg = argsList.get(sIndex + 1);
101
101
  executableArgv = argsList.subList(sIndex + 2, argsList.size()).toArray(new String[0]);
102
102
 
103
- if (execArg.equals("bundle") && executableArgv.length > 0 && executableArgv[0].equals("exec")) {
104
- warn("`bundle exec' may drop out of the Warbler environment and into the system environment");
105
- } else if (execArg.equals("rails")) {
103
+ if (execArg.equals("rails")) {
106
104
  // The rails executable doesn't play well with ScriptingContainer, so we've packaged the
107
105
  // same script that would have been generated by `rake rails:update:bin`
108
106
  execArg = "./META-INF/rails.rb";
109
107
  }
108
+ else if (execArg.equals("bundle") && executableArgv.length > 0 && executableArgv[0].equals("exec")) {
109
+ warn("`bundle exec' may drop out of the Warbler environment and into the system environment");
110
+ }
110
111
 
111
112
  executable = execArg;
112
113
  }
@@ -124,7 +125,7 @@ public class WarMain extends JarMain {
124
125
  FileOutputStream outStream = new FileOutputStream(jarFile);
125
126
  try {
126
127
  byte[] buf = new byte[4096];
127
- int bytesRead = 0;
128
+ int bytesRead;
128
129
  while ((bytesRead = jarStream.read(buf)) != -1) {
129
130
  outStream.write(buf, 0, bytesRead);
130
131
  }
@@ -179,7 +180,7 @@ public class WarMain extends JarMain {
179
180
  + WEBSERVER_PROPERTIES
180
181
  + " is missing 'mainclass' property)");
181
182
  }
182
- Class klass = Class.forName(mainClass, true, loader);
183
+ Class<?> klass = Class.forName(mainClass, true, loader);
183
184
  Method main = klass.getDeclaredMethod("main", new Class[] { String[].class });
184
185
  String[] newArgs = launchWebServerArguments(props);
185
186
  debug("invoking webserver with: " + Arrays.deepToString(newArgs));
@@ -240,7 +241,9 @@ public class WarMain extends JarMain {
240
241
 
241
242
  invokeMethod(rubyInstanceConfig, "setUpdateNativeENVEnabled", new Class[] { Boolean.TYPE }, false);
242
243
 
243
- final String executablePath = locateExecutable(scriptingContainer);
244
+ final CharSequence execScriptEnvPre = executableScriptEnvPrefix();
245
+
246
+ final String executablePath = locateExecutable(scriptingContainer, execScriptEnvPre);
244
247
  if ( executablePath == null ) {
245
248
  throw new IllegalStateException("failed to locate gem executable: '" + executable + "'");
246
249
  }
@@ -252,7 +255,7 @@ public class WarMain extends JarMain {
252
255
 
253
256
  debug("loading resource: " + executablePath);
254
257
  Object executableInput =
255
- new SequenceInputStream(new ByteArrayInputStream(executableScriptEnvPrefix().getBytes()),
258
+ new SequenceInputStream(new ByteArrayInputStream(execScriptEnvPre.toString().getBytes()),
256
259
  (InputStream) invokeMethod(rubyInstanceConfig, "getScriptSource"));
257
260
 
258
261
  debug("invoking " + executablePath + " with: " + Arrays.toString(executableArgv));
@@ -264,6 +267,7 @@ public class WarMain extends JarMain {
264
267
  return ( outcome instanceof Number ) ? ( (Number) outcome ).intValue() : 0;
265
268
  }
266
269
 
270
+ @Deprecated
267
271
  protected String locateExecutable(final Object scriptingContainer) throws Exception {
268
272
  if ( executable == null ) {
269
273
  throw new IllegalStateException("no executable");
@@ -273,11 +277,27 @@ public class WarMain extends JarMain {
273
277
  return exec.getAbsolutePath();
274
278
  }
275
279
  else {
276
- final String script = locateExecutableScript(executable);
280
+ final String script = locateExecutableScript(executable, executableScriptEnvPrefix());
277
281
  return (String) invokeMethod(scriptingContainer, "runScriptlet", script);
278
282
  }
279
283
  }
280
- protected String executableScriptEnvPrefix() {
284
+
285
+ protected String locateExecutable(final Object scriptingContainer, final CharSequence envPreScript)
286
+ throws Exception {
287
+ if ( executable == null ) {
288
+ throw new IllegalStateException("no executable");
289
+ }
290
+ final File exec = new File(extractRoot, executable);
291
+ if ( exec.exists() ) {
292
+ return exec.getAbsolutePath();
293
+ }
294
+ else {
295
+ final String script = locateExecutableScript(executable, envPreScript);
296
+ return (String) invokeMethod(scriptingContainer, "runScriptlet", script);
297
+ }
298
+ }
299
+
300
+ protected CharSequence executableScriptEnvPrefix() {
281
301
  final String gemsDir = new File(extractRoot, "gems").getAbsolutePath();
282
302
  final String gemfile = new File(extractRoot, "Gemfile").getAbsolutePath();
283
303
  debug("setting GEM_HOME to " + gemsDir);
@@ -286,22 +306,20 @@ public class WarMain extends JarMain {
286
306
  // ideally this would look up the config.override_gem_home setting
287
307
  return "ENV['GEM_HOME'] = ENV['GEM_PATH'] = '"+ gemsDir +"' \n" +
288
308
  "ENV['BUNDLE_GEMFILE'] ||= '"+ gemfile +"' \n" +
289
- "require 'uri:classloader:/META-INF/init.rb' \n";
309
+ "require 'uri:classloader:/META-INF/init.rb'";
290
310
  }
291
311
 
292
- protected String locateExecutableScript(final String executable) {
293
- return executableScriptEnvPrefix() +
294
- "begin\n" +
295
- // locate the executable within gemspecs :
296
- " require 'rubygems' \n" +
297
- " begin\n" +
298
- // add bundler gems to load path:
299
- " require 'bundler' \n" +
300
- // TODO: environment from web.xml. Any others?
301
- " Bundler.setup(:default, *ENV.values_at('RACK_ENV', 'RAILS_ENV').compact)\n" +
302
- " rescue LoadError\n" +
303
- // bundler not used
304
- " end\n" +
312
+ protected String locateExecutableScript(final String executable, final CharSequence envPreScript) {
313
+ return ( envPreScript == null ? "" : envPreScript + " \n" ) +
314
+ "begin\n" + // locate the executable within gemspecs :
315
+ " require 'rubygems' unless defined?(Gem) \n" +
316
+ " begin\n" + // add bundled gems to load path :
317
+ " require 'bundler' \n" +
318
+ " rescue LoadError\n" + // bundler not used
319
+ " else\n" +
320
+ " env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] \n" + // init.rb sets ENV['RAILS_ENV'] ||= ...
321
+ " env ? Bundler.setup(:default, env) : Bundler.setup(:default) \n" +
322
+ " end if ENV_JAVA['warbler.bundler.setup'] != 'false' \n" + // java -Dwarbler.bundler.setup=false -jar my.war -S pry
305
323
  " exec = '"+ executable +"' \n" +
306
324
  " spec = Gem::Specification.find { |s| s.executables.include?(exec) } \n" +
307
325
  " spec ? spec.bin_file(exec) : nil \n" +
@@ -327,7 +345,8 @@ public class WarMain extends JarMain {
327
345
  launchWebServer(server);
328
346
  }
329
347
  catch (FileNotFoundException e) {
330
- if ( e.getMessage().indexOf("WEB-INF/webserver.jar") > -1 ) {
348
+ final String msg = e.getMessage();
349
+ if ( msg != null && msg.contains("WEB-INF/webserver.jar") ) {
331
350
  System.out.println("specify the -S argument followed by the bin file to run e.g. `java -jar rails.war -S rake -T` ...");
332
351
  System.out.println("(or if you'd like your .war file to start a web server package it using `warbler executable war`)");
333
352
  }
@@ -335,9 +354,7 @@ public class WarMain extends JarMain {
335
354
  }
336
355
  return 0;
337
356
  }
338
- else {
339
- return super.start();
340
- }
357
+ return super.start();
341
358
  }
342
359
 
343
360
  @Override
@@ -153,7 +153,7 @@ public class WarblerJar {
153
153
  }
154
154
  }
155
155
 
156
- private static Pattern PROTOCOL = Pattern.compile("^[a-z][a-z0-9]+:");
156
+ private static final Pattern PROTOCOL = Pattern.compile("^[a-z][a-z0-9]+:");
157
157
 
158
158
  private static InputStream getStream(String jar, String entry) throws IOException {
159
159
  Matcher m = PROTOCOL.matcher(jar);
@@ -32,7 +32,7 @@ module Warbler
32
32
 
33
33
  def contents(entry)
34
34
  file = files[entry]
35
- file.respond_to?(:read) ? file.read : File.open(file) {|f| f.read }
35
+ file.respond_to?(:read) ? file.read : File.read(file)
36
36
  end
37
37
 
38
38
  def compile(config)
@@ -125,16 +125,12 @@ module Warbler
125
125
  def gather_all_rb_files(config)
126
126
  FileUtils.mkdir_p('tmp')
127
127
  # Gather all the files in the files list and copy them to the tmp directory
128
- gems_to_compile = files.select {|k, f| !f.is_a?(StringIO) && f =~ /\.rb$/ }
129
- # 1.8.7 Support, convert back to hash
130
- if gems_to_compile.is_a?(Array)
131
- gems_to_compile = gems_to_compile.inject({}) {|h,z| h.merge!(z[0] => z[1]) }
132
- end
133
- gems_to_compile.each do |jar_file, rb|
128
+ files_to_compile = files.select { |_, f| !f.is_a?(StringIO) && f.end_with?('.rb') }
129
+ files_to_compile.each do |jar_file, rb|
134
130
  FileUtils.mkdir_p(File.dirname(File.join('tmp', jar_file)))
135
131
  new_rb = File.join('tmp', jar_file)
136
132
  FileUtils.copy(rb, new_rb)
137
- gems_to_compile[jar_file] = new_rb
133
+ files_to_compile[jar_file] = new_rb
138
134
  end
139
135
  # Gather all the application files which the user wrote (not dependencies)
140
136
  main_files_to_compile = config.compiled_ruby_files - config.excludes.to_a
@@ -145,9 +141,9 @@ module Warbler
145
141
  main_files_to_compile = main_files_to_compile.inject({}) {|h,f| h.merge!(f => f) }
146
142
  files.keys.each do |k|
147
143
  # Update files list to point to the temporary file
148
- files[k] = gems_to_compile[k] || main_files_to_compile[k] || files[k]
144
+ files[k] = files_to_compile[k] || main_files_to_compile[k] || files[k]
149
145
  end
150
- main_files_to_compile.merge(gems_to_compile)
146
+ main_files_to_compile.merge(files_to_compile)
151
147
  end
152
148
 
153
149
  # Apply the information in a Warbler::Config object in order to
@@ -187,7 +183,7 @@ module Warbler
187
183
 
188
184
  # Add a manifest file either from config or by making a default manifest.
189
185
  def add_manifest(config = nil)
190
- unless @files.keys.detect{|k| k =~ /^META-INF\/MANIFEST\.MF$/i}
186
+ unless @files.keys.detect{ |k| k =~ /^META-INF\/MANIFEST\.MF$/i }
191
187
  if config && config.manifest_file
192
188
  @files['META-INF/MANIFEST.MF'] = config.manifest_file
193
189
  else
@@ -198,12 +194,12 @@ module Warbler
198
194
 
199
195
  # Add java libraries to WEB-INF/lib.
200
196
  def find_java_libs(config)
201
- config.java_libs.map {|lib| add_with_pathmaps(config, lib, :java_libs) }
197
+ config.java_libs.map { |lib| add_with_pathmaps(config, lib, :java_libs) }
202
198
  end
203
199
 
204
200
  # Add java classes to WEB-INF/classes.
205
201
  def find_java_classes(config)
206
- config.java_classes.map {|f| add_with_pathmaps(config, f, :java_classes) }
202
+ config.java_classes.map { |f| add_with_pathmaps(config, f, :java_classes) }
207
203
  end
208
204
 
209
205
  # Add gems to WEB-INF/gems
@@ -218,7 +214,19 @@ module Warbler
218
214
  full_gem_path = Pathname.new(spec.full_gem_path)
219
215
 
220
216
  # skip gems whose full_gem_path does not exist
221
- (warn "skipping #{spec.name} (#{full_gem_path.to_s} does not exist)" ; return) unless full_gem_path.exist?
217
+ unless full_gem_path.exist?
218
+ # its very likely that its a default gem e.g. json/jruby-openssl :
219
+ if (Gem.default_dir rescue nil) && full_gem_path.to_s.start_with?(Gem.default_dir)
220
+ # OK if the gem does not exists as its un-packed on the "shared" path
221
+ # ... at least gem spec.spec_file should exists although not crucial
222
+ if JRUBY_VERSION != JRubyJars::VERSION
223
+ warn "skipping #{spec.name} default gem (assuming its part of jruby-jars #{JRubyJars::VERSION})" unless silent?
224
+ end
225
+ else
226
+ warn "skipping #{spec.name} gem (#{full_gem_path.to_s} does not exist)"
227
+ end
228
+ return
229
+ end
222
230
 
223
231
  @files[apply_pathmaps(config, "#{spec.full_name}.gemspec", :gemspecs)] = StringIO.new(spec.to_ruby)
224
232
  FileList["#{full_gem_path.to_s}/**/*"].each do |src|
@@ -296,7 +304,7 @@ module Warbler
296
304
  entries.keys.sort.each do |entry|
297
305
  src = entries[entry]
298
306
  if src.respond_to?(:read)
299
- zipfile.get_output_stream(entry) {|f| f << src.read }
307
+ zipfile.get_output_stream(entry) { |f| f << src.read }
300
308
  elsif src.nil? || File.directory?(src)
301
309
  if File.symlink?(entry) && ! defined?(JRUBY_VERSION)
302
310
  warn "directory symlinks are not followed unless using JRuby; " +
@@ -1,11 +1,11 @@
1
1
  <% if config.relative_gem_path.empty? -%>
2
- ENV['GEM_HOME'] <%= config.override_gem_home ? '=' : '||=' %> File.expand_path('../..', __FILE__)
2
+ ENV['GEM_HOME'] <%= config.override_gem_home ? '=' : '||=' %> File.expand_path(File.join('..', '..', '<%= config.gem_path %>'), __FILE__)
3
3
  <% else -%>
4
- ENV['GEM_HOME'] <%= config.override_gem_home ? '=' : '||=' %> File.expand_path('../../<%= config.relative_gem_path %>', __FILE__)
4
+ ENV['GEM_HOME'] <%= config.override_gem_home ? '=' : '||=' %> File.expand_path(File.join('..', '..', '<%= config.relative_gem_path %>'), __FILE__)
5
5
  <% end -%>
6
6
  <% if config.override_gem_home -%>
7
- ENV['GEM_PATH'] = ENV['GEM_HOME']
7
+ ENV['GEM_PATH'] = nil # RGs sets Gem.paths.path = Gem.default_path + [ GEM_HOME ]
8
8
  <% end -%>
9
9
  <% if config.bundler && config.bundler[:gemfile_path] -%>
10
- ENV['BUNDLE_GEMFILE'] = File.expand_path('../../<%= config.bundler[:gemfile_path] %>', __FILE__)
10
+ ENV['BUNDLE_GEMFILE'] = File.expand_path(File.join('..', '..', '<%= config.bundler[:gemfile_path] %>'), __FILE__)
11
11
  <% end -%>
@@ -1,3 +1,5 @@
1
- ENV['RACK_ENV'] ||= '<%= (params = config.webxml.context_params; params['rack.env']) %>'
1
+ <% if (params = config.webxml.context_params) && params['rack.env'] -%>
2
+ ENV['RACK_ENV'] ||= '<%= params['rack.env'] %>'
3
+ <% end -%>
2
4
 
3
5
  $LOAD_PATH.unshift $servlet_context.getRealPath('/WEB-INF') if $servlet_context
@@ -1,7 +1,9 @@
1
1
  if $servlet_context.nil?
2
2
  ENV['GEM_HOME'] <%= config.override_gem_home ? '=' : '||=' %> File.expand_path(File.join('..', '..', '<%= config.gem_path %>'), __FILE__)
3
3
  <% if config.override_gem_home -%>
4
- ENV['GEM_PATH'] = ENV['GEM_HOME']
4
+ <% # GEM_HOME/GEM_PATH are set as .war gets extracted (on java -jar ...)
5
+ # ... thus setting `ENV['GEM_PATH'] = nil` would cause a boot failure
6
+ -%>
5
7
  <% end -%>
6
8
  <% if config.bundler && config.bundler[:gemfile_path] -%>
7
9
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path(File.join('..', '..', '<%= config.bundler[:gemfile_path] %>'), __FILE__)
@@ -9,7 +11,7 @@ if $servlet_context.nil?
9
11
  else
10
12
  ENV['GEM_HOME'] <%= config.override_gem_home ? '=' : '||=' %> $servlet_context.getRealPath('<%= config.gem_path %>')
11
13
  <% if config.override_gem_home -%>
12
- ENV['GEM_PATH'] = ENV['GEM_HOME']
14
+ ENV['GEM_PATH'] = nil
13
15
  <% end -%>
14
16
  <% if config.bundler && config.bundler[:gemfile_path] -%>
15
17
  ENV['BUNDLE_GEMFILE'] ||= $servlet_context.getRealPath('/<%= config.bundler[:gemfile_path] %>')
@@ -74,11 +74,13 @@ module Warbler
74
74
  end
75
75
 
76
76
  def add_init_load_path(path)
77
- config.init_contents << StringIO.new("$LOAD_PATH.unshift __FILE__.sub(/!.*/, '!/#{path}')\n")
77
+ config.init_contents << StringIO.new("$LOAD_PATH.unshift File.expand_path(File.join('..', '..', '#{path}'), __FILE__)\n")
78
+ # with __FILE__ = "uri:classloader:/META-INF/init.rb"
79
+ # ... will end up as "uri:classloader://xxx-gem/lib"
78
80
  end
79
81
 
80
82
  def add_main_rb(jar, bin_path, params = nil)
81
- binary = ""
83
+ binary = "".dup
82
84
  binary << "ARGV.unshift('#{params}')\n" if params
83
85
  binary << "load '#{bin_path}'"
84
86
  jar.files['META-INF/main.rb'] = StringIO.new(binary)
@@ -18,18 +18,17 @@ module Warbler
18
18
  !Dir['*.gemspec'].empty?
19
19
  end
20
20
 
21
- def before_configure
21
+ def before_configure; require 'yaml'
22
22
  @spec_file = Dir['*.gemspec'].first
23
- require 'yaml'
24
23
  @spec = File.open(@spec_file) { |f| Gem::Specification.from_yaml(f) } rescue Gem::Specification.load(@spec_file)
25
24
  @spec.runtime_dependencies.each { |g| config.gems << g }
26
25
  config.dirs = []
27
- config.compiled_ruby_files = @spec.files.select {|f| f =~ /\.rb$/}
26
+ config.compiled_ruby_files = @spec.files.select { |f| f =~ /\.rb$/ }
28
27
  end
29
28
 
30
29
  def after_configure
31
30
  @spec.require_paths.each do |p|
32
- add_init_load_path(config.pathmaps.application.inject(p) {|pm,x| pm.pathmap(x)})
31
+ add_init_load_path( config.pathmaps.application.inject(p) { |pm,x| pm.pathmap(x) } )
33
32
  end
34
33
  end
35
34
 
@@ -55,32 +54,26 @@ module Warbler
55
54
 
56
55
  def default_executable
57
56
  if ! @spec.executables.empty?
58
- bundler_version =
59
- Gem.loaded_specs.include?("bundler") ?
60
- Gem.loaded_specs["bundler"].version :
61
- Gem::Version.create("0.0.0")
62
- if (bundler_version <=> Gem::Version.create("1.8.0")) < 0
63
- "bin/#{@spec.executables.first}"
57
+ exe_script = @spec.executables.first
58
+ exe_path = File.join(@spec.bindir, exe_script) # bin/script
59
+ if File.exists?(exe_path)
60
+ exe_path
61
+ elsif File.exists?("bin/#{exe_script}") # compatibility
62
+ "bin/#{exe_script}" # ... should probably remove this
64
63
  else
65
- exe_script = @spec.executables.first
66
- if File.exists?("exe/#{exe_script}")
67
- "exe/#{exe_script}"
68
- elsif File.exists?("bin/#{exe_script}")
69
- "bin/#{exe_script}"
70
- else
71
- raise "No `#{exe_script}` executable script found"
72
- end
64
+ raise "no `#{exe_script}` executable script found"
73
65
  end
74
- elsif exe = Dir['bin/*'].sort.first
75
- warn "No default executable found in #{@spec_file}, using bin/#{exe}"
76
- exe
77
- elsif exe = Dir['exe/*'].sort.first
78
- warn "No default executable found in #{@spec_file}, using exe/#{exe}"
79
- exe
66
+ elsif exe_path = Dir['bin/*'].sort.first
67
+ warn "no executables found in #{@spec_file}, using #{exe_path}"
68
+ exe_path
69
+ elsif exe_path = Dir['exe/*'].sort.first
70
+ warn "no executables found in #{@spec_file}, using #{exe_path}"
71
+ exe_path
80
72
  else
81
- raise "No executable script found" unless exe
73
+ raise "no executable script found"
82
74
  end
83
75
  end
76
+
84
77
  end
85
78
  end
86
79
  end
@@ -29,7 +29,7 @@ module Warbler
29
29
  end
30
30
 
31
31
  def after_configure
32
- config.init_contents << StringIO.new("require 'rubygems'\n")
32
+ config.init_contents << StringIO.new("require 'rubygems' unless defined?(Gem)\n")
33
33
  end
34
34
 
35
35
  def update_archive(jar)
@@ -6,5 +6,5 @@
6
6
  #++
7
7
 
8
8
  module Warbler
9
- VERSION = "2.0.1"
9
+ VERSION = "2.0.2"
10
10
  end
Binary file
@@ -0,0 +1,112 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actionmailer (4.2.5.1)
5
+ actionpack (= 4.2.5.1)
6
+ actionview (= 4.2.5.1)
7
+ activejob (= 4.2.5.1)
8
+ mail (~> 2.5, >= 2.5.4)
9
+ rails-dom-testing (~> 1.0, >= 1.0.5)
10
+ actionpack (4.2.5.1)
11
+ actionview (= 4.2.5.1)
12
+ activesupport (= 4.2.5.1)
13
+ rack (~> 1.6)
14
+ rack-test (~> 0.6.2)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
+ actionview (4.2.5.1)
18
+ activesupport (= 4.2.5.1)
19
+ builder (~> 3.1)
20
+ erubis (~> 2.7.0)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
+ activejob (4.2.5.1)
24
+ activesupport (= 4.2.5.1)
25
+ globalid (>= 0.3.0)
26
+ activemodel (4.2.5.1)
27
+ activesupport (= 4.2.5.1)
28
+ builder (~> 3.1)
29
+ activerecord (4.2.5.1)
30
+ activemodel (= 4.2.5.1)
31
+ activesupport (= 4.2.5.1)
32
+ arel (~> 6.0)
33
+ activerecord-jdbc-adapter (1.3.19)
34
+ activerecord (>= 2.2)
35
+ activerecord-jdbcpostgresql-adapter (1.3.19)
36
+ activerecord-jdbc-adapter (~> 1.3.19)
37
+ jdbc-postgres (>= 9.1)
38
+ activesupport (4.2.5.1)
39
+ i18n (~> 0.7)
40
+ json (~> 1.7, >= 1.7.7)
41
+ minitest (~> 5.1)
42
+ thread_safe (~> 0.3, >= 0.3.4)
43
+ tzinfo (~> 1.1)
44
+ arel (6.0.3)
45
+ builder (3.2.2)
46
+ concurrent-ruby (1.0.0-java)
47
+ erubis (2.7.0)
48
+ globalid (0.3.6)
49
+ activesupport (>= 4.1.0)
50
+ i18n (0.7.0)
51
+ jdbc-postgres (9.4.1206)
52
+ json (1.8.3-java)
53
+ loofah (2.0.3)
54
+ nokogiri (>= 1.5.9)
55
+ mail (2.6.3)
56
+ mime-types (>= 1.16, < 3)
57
+ mime-types (2.99)
58
+ minitest (5.8.4)
59
+ nokogiri (1.6.7.2-java)
60
+ rack (1.6.4)
61
+ rack-test (0.6.3)
62
+ rack (>= 1.0)
63
+ rails (4.2.5.1)
64
+ actionmailer (= 4.2.5.1)
65
+ actionpack (= 4.2.5.1)
66
+ actionview (= 4.2.5.1)
67
+ activejob (= 4.2.5.1)
68
+ activemodel (= 4.2.5.1)
69
+ activerecord (= 4.2.5.1)
70
+ activesupport (= 4.2.5.1)
71
+ bundler (>= 1.3.0, < 2.0)
72
+ railties (= 4.2.5.1)
73
+ sprockets-rails
74
+ rails-api (0.4.0)
75
+ actionpack (>= 3.2.11)
76
+ railties (>= 3.2.11)
77
+ rails-deprecated_sanitizer (1.0.3)
78
+ activesupport (>= 4.2.0.alpha)
79
+ rails-dom-testing (1.0.7)
80
+ activesupport (>= 4.2.0.beta, < 5.0)
81
+ nokogiri (~> 1.6.0)
82
+ rails-deprecated_sanitizer (>= 1.0.1)
83
+ rails-html-sanitizer (1.0.3)
84
+ loofah (~> 2.0)
85
+ railties (4.2.5.1)
86
+ actionpack (= 4.2.5.1)
87
+ activesupport (= 4.2.5.1)
88
+ rake (>= 0.8.7)
89
+ thor (>= 0.18.1, < 2.0)
90
+ rake (10.5.0)
91
+ sprockets (3.5.2)
92
+ concurrent-ruby (~> 1.0)
93
+ rack (> 1, < 3)
94
+ sprockets-rails (3.0.1)
95
+ actionpack (>= 4.0)
96
+ activesupport (>= 4.0)
97
+ sprockets (>= 3.0.0)
98
+ thor (0.19.1)
99
+ thread_safe (0.3.5-java)
100
+ tzinfo (1.2.2)
101
+ thread_safe (~> 0.1)
102
+
103
+ PLATFORMS
104
+ java
105
+
106
+ DEPENDENCIES
107
+ activerecord-jdbcpostgresql-adapter (= 1.3.19)
108
+ rails (~> 4.2)
109
+ rails-api (= 0.4.0)
110
+
111
+ BUNDLED WITH
112
+ 1.11.2
@@ -0,0 +1,4 @@
1
+ ---
2
+ BUNDLE_FROZEN: '1'
3
+ BUNDLE_PATH: vendor/bundle
4
+ BUNDLE_DISABLE_SHARED_GEMS: '1'
@@ -0,0 +1,13 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ rake (10.5.0)
5
+
6
+ PLATFORMS
7
+ java
8
+
9
+ DEPENDENCIES
10
+ rake (= 10.5.0)
11
+
12
+ BUNDLED WITH
13
+ 1.11.2
@@ -10,7 +10,8 @@ Gem::Specification.new do |s|
10
10
  s.description = ""
11
11
  s.email = ["nick@nicksieger.com"]
12
12
  s.executables = ["sample_jar"]
13
- s.files = ["History.txt", "Rakefile", "README.txt", "sample_jar.gemspec", "bin/sample_jar", "lib/sample_jar.rb", "test/test_sample_jar.rb"]
13
+ s.bindir = 'sbin'
14
+ s.files = ["History.txt", "Rakefile", "README.txt", "sample_jar.gemspec", "bin/sample_jar", "sbin/sample_jar", "lib/sample_jar.rb", "test/test_sample_jar.rb"]
14
15
  s.homepage = ""
15
16
  s.require_paths = ["lib"]
16
17
  s.rubygems_version = "1.8.15"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sample_jar'
4
+
5
+ SampleJar.hello
@@ -149,7 +149,7 @@ describe Warbler::Jar do
149
149
  it "loads the default executable in main.rb" do
150
150
  jar.apply(config)
151
151
  contents = jar.contents('META-INF/main.rb')
152
- contents.should =~ /load.*sample_jar\/bin\/sample_jar/
152
+ contents.should == "load 'sample_jar/sbin/sample_jar'"
153
153
  end
154
154
 
155
155
  it "includes compiled .rb and .class files" do
@@ -15,7 +15,11 @@ Gem::Specification.new do |gem|
15
15
  Rails, or Rack application. Warbler provides a minimal, flexible, Ruby-like way to
16
16
  bundle up all of your application files for deployment to a Java environment.}
17
17
 
18
- gem.files = `git ls-files`.split("\n")
18
+ gem.files = `git ls-files`.split("\n").
19
+ reject { |file| file =~ /^\./ }. # .gitignore, .travis.yml
20
+ reject { |file| file =~ /^spec|test\// }. # spec/**/*.spec
21
+ reject { |file| file =~ /^integration\// }. # (un-used) *.rake files
22
+ reject { |file| file =~ /^rakelib\// } # (un-used) *.rake files
19
23
  gem.test_files = `git ls-files -- {test,spec,features,integration}/*`.split("\n")
20
24
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
25
  gem.require_paths = ["lib"]
@@ -15,8 +15,8 @@
15
15
 
16
16
  <%- if webxml.respond_to?(:servlet_filter) -%>
17
17
  <filter>
18
- <filter-class><%= webxml.servlet_filter %></filter-class>
19
18
  <filter-name><%= webxml.servlet_filter_name %></filter-name>
19
+ <filter-class><%= webxml.servlet_filter %></filter-class>
20
20
  <async-supported><%= !! webxml.servlet_filter_async %></async-supported>
21
21
  </filter>
22
22
  <filter-mapping>
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.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sieger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -116,8 +116,6 @@ executables:
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - ".gitignore"
120
- - ".travis.yml"
121
119
  - Gemfile
122
120
  - History.txt
123
121
  - LICENSE.txt
@@ -642,6 +640,7 @@ files:
642
640
  - spec/sample_jar/bin/sample_jar
643
641
  - spec/sample_jar/lib/sample_jar.rb
644
642
  - spec/sample_jar/sample_jar.gemspec
643
+ - spec/sample_jar/sbin/sample_jar
645
644
  - spec/sample_jar/test/test_sample_jar.rb
646
645
  - spec/sample_jbundler/.jbundler/classpath.rb
647
646
  - spec/sample_jbundler/Gemfile
@@ -1213,6 +1212,7 @@ test_files:
1213
1212
  - spec/sample_jar/bin/sample_jar
1214
1213
  - spec/sample_jar/lib/sample_jar.rb
1215
1214
  - spec/sample_jar/sample_jar.gemspec
1215
+ - spec/sample_jar/sbin/sample_jar
1216
1216
  - spec/sample_jar/test/test_sample_jar.rb
1217
1217
  - spec/sample_jbundler/.jbundler/classpath.rb
1218
1218
  - spec/sample_jbundler/Gemfile
data/.gitignore DELETED
@@ -1,16 +0,0 @@
1
- coverage*
2
- pkg
3
- doc
4
- .bundle
5
- nbproject
6
- target
7
- Gemfile.lock
8
- .idea
9
- warbler.iml
10
- warbler.iws
11
- warbler.ipr
12
- warbler-*.gem
13
- log
14
- integration/**/*.iml
15
- build.log
16
- .ruby-version
@@ -1,27 +0,0 @@
1
- rvm:
2
- - jruby-9.0.5.0
3
- - jruby-9.1.0.0
4
- branches:
5
- only:
6
- - master
7
- - /-dev|-feature|-fix/
8
- env:
9
- - JRUBY_OPTS="--server -Xcompile.invokedynamic=false"
10
- matrix:
11
- include:
12
- - rvm: jruby-head
13
- env: JRUBY_OPTS="--server -Xcompile.invokedynamic=false"
14
- allow_failures:
15
- - rvm: jruby-head
16
- notifications:
17
- irc:
18
- channels:
19
- - "irc.freenode.org#jruby"
20
- on_success: change
21
- on_failure: always
22
- template:
23
- - "%{repository} (%{branch}:%{commit} by %{author}): %{message} (%{build_url})"
24
- before_install:
25
- - sudo apt-get update && sudo apt-get install git
26
- - git fetch --unshallow
27
- - gem install bundler