warbler 1.3.7 → 1.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -6,3 +6,7 @@ nbproject
6
6
  target
7
7
  Gemfile.lock
8
8
  .idea
9
+ warbler.iml
10
+ warbler.iws
11
+ warbler.ipr
12
+ warbler-*.gem
data/Gemfile CHANGED
@@ -1,6 +1,9 @@
1
1
  source "http://rubygems.org/"
2
2
 
3
- gemspec
3
+ gem 'rake', ">= 0.9.6"
4
+ gem 'jruby-jars', ">= 1.5.6"
5
+ gem 'jruby-rack', ">= 1.0.0"
6
+ gem 'rubyzip', ">= 0.9.8"
4
7
 
5
8
  group :development do
6
9
  gem "jruby-openssl", :platform => :jruby
data/History.txt CHANGED
@@ -1,3 +1,28 @@
1
+ == 1.3.8
2
+
3
+ - Numerous fixes related to -S option and local environment.
4
+ - #162: Close the URLClassLoader before deleting tempJARs
5
+ - #161: Comment out config.dirs to match default
6
+ - #158: Warbler looking in the wrong directory for bundler gem
7
+
8
+ == 1.3.7
9
+
10
+ - #154: Use #load in .rb shims
11
+ - #153: Runnable war error
12
+ - #152: Mirror fallback for winstone-jenkins?
13
+ - #150: Don't delete contents of symlinked folder.
14
+ - #148: Resolving issue when an alternate BUNDLE_PATH is used
15
+ - #144: No such file to load -- bundler/setup (with bundler 1.3.4)
16
+ - #141: Support running executables from Bundler gems and project-local scripts
17
+ - #136: java -jar rails.war -S rake db:migrate
18
+ - #125: Fix self executable jar/wars when the filename contains '#' symbols
19
+ - #122: When comparing zip file entries, ignore trailing slashes
20
+ - #118: warble pluginize does not work on rails 3.x
21
+ - #117: Allow compile feature to work in 1.9 mode
22
+ - #112: Reset ENV['GEM_HOME'], limit search to within .jar
23
+ - #105: Pick executables deterministically and warn when doing so
24
+ - #104: Default executable is system-dependent
25
+
1
26
  == 1.3.6
2
27
 
3
28
  - #100: fix winstone URL
data/ext/JarMain.java CHANGED
@@ -36,6 +36,8 @@ public class JarMain implements Runnable {
36
36
 
37
37
  protected File extractRoot;
38
38
 
39
+ protected URLClassLoader classLoader;
40
+
39
41
  JarMain(String[] args) {
40
42
  this.args = args;
41
43
  URL mainClass = getClass().getResource(MAIN);
@@ -125,12 +127,12 @@ public class JarMain implements Runnable {
125
127
 
126
128
  protected Object newScriptingContainer(final URL[] jars) throws Exception {
127
129
  System.setProperty("org.jruby.embed.class.path", "");
128
- ClassLoader loader = new URLClassLoader(jars);
129
- Class scriptingContainerClass = Class.forName("org.jruby.embed.ScriptingContainer", true, loader);
130
+ classLoader = new URLClassLoader(jars);
131
+ Class scriptingContainerClass = Class.forName("org.jruby.embed.ScriptingContainer", true, classLoader);
130
132
  Object scriptingContainer = scriptingContainerClass.newInstance();
131
133
  debug("scripting container class loader urls: " + Arrays.toString(jars));
132
134
  invokeMethod(scriptingContainer, "setArgv", (Object) args);
133
- invokeMethod(scriptingContainer, "setClassLoader", new Class[] { ClassLoader.class }, loader);
135
+ invokeMethod(scriptingContainer, "setClassLoader", new Class[] { ClassLoader.class }, classLoader);
134
136
  return scriptingContainer;
135
137
  }
136
138
 
@@ -165,6 +167,10 @@ public class JarMain implements Runnable {
165
167
  if (debug) System.out.println(msg);
166
168
  if (debug && t != null) t.printStackTrace(System.out);
167
169
  }
170
+
171
+ protected void warn(String msg) {
172
+ System.out.println("WARNING: " + msg);
173
+ }
168
174
 
169
175
  protected void delete(File f) {
170
176
  try {
@@ -194,6 +200,15 @@ public class JarMain implements Runnable {
194
200
  }
195
201
 
196
202
  public void run() {
203
+ // If the URLClassLoader isn't closed, on Windows, temp JARs won't be cleaned up
204
+ try {
205
+ invokeMethod(classLoader, "close");
206
+ }
207
+ catch(NoSuchMethodException e) { } // We're not being run on Java >= 7
208
+ catch(Exception e) {
209
+ System.err.println("error: " + e.toString());
210
+ }
211
+
197
212
  if ( extractRoot != null ) delete(extractRoot);
198
213
  }
199
214
 
data/ext/WarMain.java CHANGED
@@ -63,14 +63,19 @@ public class WarMain extends JarMain {
63
63
  static final String MAIN = "/" + WarMain.class.getName().replace('.', '/') + ".class";
64
64
  static final String WEBSERVER_PROPERTIES = "/WEB-INF/webserver.properties";
65
65
  static final String WEBSERVER_JAR = "/WEB-INF/webserver.jar";
66
-
67
- // jruby arguments, consider the following command :
68
- // `java -jar rails.was --1.9 -S rake db:migrate`
69
- // arguments == [ "--1.9" ]
70
- // executable == "rake"
71
- // executableArgv == [ "db:migrate" ]
66
+
67
+ /**
68
+ * jruby arguments, consider the following command :
69
+ * `java -jar rails.was --1.9 -S rake db:migrate`
70
+ * arguments == [ "--1.9" ]
71
+ * executable == "rake"
72
+ * executableArgv == [ "db:migrate" ]
73
+ */
72
74
  private final String[] arguments;
73
- // null to launch webserver or != null to run a executable e.g. rake
75
+
76
+ /**
77
+ * null to launch webserver or != null to run a executable e.g. rake
78
+ */
74
79
  private final String executable;
75
80
  private final String[] executableArgv;
76
81
 
@@ -90,6 +95,10 @@ public class WarMain extends JarMain {
90
95
  arguments = argsList.subList(0, sIndex).toArray(new String[0]);
91
96
  executable = argsList.get(sIndex + 1);
92
97
  executableArgv = argsList.subList(sIndex + 2, argsList.size()).toArray(new String[0]);
98
+
99
+ if (executable.equals("bundle") && executableArgv.length > 0 && executableArgv[0].equals("exec")) {
100
+ warn("`bundle exec' may drop out of the Warbler environment and into the system environment");
101
+ }
93
102
  }
94
103
  }
95
104
 
@@ -212,13 +221,22 @@ public class WarMain extends JarMain {
212
221
  @Override
213
222
  protected int launchJRuby(final URL[] jars) throws Exception {
214
223
  final Object scriptingContainer = newScriptingContainer(jars);
215
-
224
+
225
+ String jrubyStdlibJar = "";
226
+ for (URL url : jars) {
227
+ if (url.toString().matches("file:/.*jruby-stdlib-.*jar")) {
228
+ jrubyStdlibJar = url.toString();
229
+ debug("using jruby-stdlib: " + jrubyStdlibJar);
230
+ }
231
+ }
232
+
233
+ invokeMethod(scriptingContainer, "setHomeDirectory", "classpath:/META-INF/jruby.home");
216
234
  invokeMethod(scriptingContainer, "setArgv", (Object) executableArgv);
217
- //invokeMethod(scriptingContainer, "setHomeDirectory", "classpath:/META-INF/jruby.home");
218
235
  invokeMethod(scriptingContainer, "setCurrentDirectory", extractRoot.getAbsolutePath());
219
- //invokeMethod(scriptingContainer, "runScriptlet", "ENV.clear");
220
- //invokeMethod(scriptingContainer, "runScriptlet", "ENV['PATH']=''"); // bundler 1.1.x
221
-
236
+ invokeMethod(scriptingContainer, "runScriptlet", "$: << \"" + jrubyStdlibJar + "!/META-INF/jruby.home/lib/ruby/1.9/site_ruby\"");
237
+ invokeMethod(scriptingContainer, "runScriptlet", "$: << \"" + jrubyStdlibJar + "!/META-INF/jruby.home/lib/ruby/shared\"");
238
+ invokeMethod(scriptingContainer, "runScriptlet", "$: << \"" + jrubyStdlibJar + "!/META-INF/jruby.home/lib/ruby/1.9\"");
239
+
222
240
  final Object provider = invokeMethod(scriptingContainer, "getProvider");
223
241
  final Object rubyInstanceConfig = invokeMethod(provider, "getRubyInstanceConfig");
224
242
 
@@ -263,7 +281,9 @@ public class WarMain extends JarMain {
263
281
  final String gemfile = new File(extractRoot, "Gemfile").getAbsolutePath();
264
282
  debug("setting GEM_HOME to " + gemsDir);
265
283
  debug("... and BUNDLE_GEMFILE to " + gemfile);
266
- return "ENV['GEM_HOME'] ||= ENV['GEM_PATH'] = '"+ gemsDir +"' \n" +
284
+
285
+ // ideally this would look up the config.override_gem_home setting
286
+ return "ENV['GEM_HOME'] = ENV['GEM_PATH'] = '"+ gemsDir +"' \n" +
267
287
  "ENV['BUNDLE_GEMFILE'] ||= '"+ gemfile +"' \n" +
268
288
  "require 'META-INF/init.rb' \n";
269
289
  }
@@ -1 +1 @@
1
- ENV['RAILS_ENV'] = '<%= config.webxml.rails.env %>'
1
+ ENV['RAILS_ENV'] ||= '<%= config.webxml.rails.env %>'
@@ -6,5 +6,5 @@
6
6
  #++
7
7
 
8
8
  module Warbler
9
- VERSION = "1.3.7"
9
+ VERSION = "1.3.8"
10
10
  end
data/lib/warbler_jar.jar CHANGED
Binary file
data/warble.rb CHANGED
@@ -11,7 +11,7 @@ Warbler::Config.new do |config|
11
11
  # config.features = %w(gemjar)
12
12
 
13
13
  # Application directories to be included in the webapp.
14
- config.dirs = %w(app config db lib log vendor tmp)
14
+ # config.dirs = %w(app config db lib log script vendor tmp)
15
15
 
16
16
  # Additional files/directories to include, above those in config.dirs
17
17
  # config.includes = FileList["db"]
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: 1.3.7
4
+ version: 1.3.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-01 00:00:00.000000000 Z
12
+ date: 2013-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake