warbler 1.4.7 → 1.4.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adcf60dd9c5beca381437bfffd9daeb02ec4f6fb
4
- data.tar.gz: d83655891a2cf7374b5a2ba9a78ce42c0c97553f
3
+ metadata.gz: 376781bdadb7244aa3c5922f98c1b1025f40c9c0
4
+ data.tar.gz: 1770365dde33c4c23d2a381357c751bc8deded5e
5
5
  SHA512:
6
- metadata.gz: 072c00735322852bcd2dbabdd9d49c5d0c7730be4900799011d480a99e02ece106d1b77f288d68bee868d2f6aba162d6c6c5beeaf0c3dfa82165e0870dde76da
7
- data.tar.gz: 8f7e1cd06ffc11a0d337aee62a3c6474e97189ec1bc14277e16fd8e196470ae3316f5d8395b8ef38f07119ae1f2ee60d75cf194c1c7a2b857c45a0460cb09791
6
+ metadata.gz: 7c1433a950c083cd92bfee72dd3476be179d96cff5e371eabb339cedfbcffd2de8d9567effd63ab4e483e465ea03fa2c77411215c159e37379a4b7aaa997e5a8
7
+ data.tar.gz: 68cca194a69ffc051afce73800d58460373af2e2d0ee7ce629a4b5d635db84781d6f50ab82cb575aaa2ee89b898aeb1574b2f75a4fffccd0ca9ec27a38bc4186
data/.travis.yml CHANGED
@@ -1,28 +1,38 @@
1
+ sudo: false
2
+ language: ruby
3
+ script: bundle exec rake spec
1
4
  rvm:
2
5
  - jruby-1.7.8
3
6
  branches:
4
7
  only:
5
8
  - master
6
9
  - 2.x-dev
10
+ - /^test-.*/
11
+ before_install:
12
+ - ([ "$BUNDLER_VERSION" ] && gem uninstall bundler --all --force && gem install bundler -v "$BUNDLER_VERSION") || true
13
+ - bundle --version
14
+ before_script:
15
+ - export JRUBY_OPTS="$JRUBY_OPTS --server -Xcext.enabled=false -Xcompile.invokedynamic=false"
7
16
  env:
8
- - JRUBY_OPTS="--1.8 --server -Xcext.enabled=false -Xcompile.invokedynamic=false"
9
- - JRUBY_OPTS="--1.9 --server -Xcext.enabled=false -Xcompile.invokedynamic=false"
17
+ - JRUBY_OPTS="--1.8" BUNDLER_VERSION="~> 1.7.9"
18
+ - JRUBY_OPTS="--1.9" BUNDLER_VERSION="~> 1.8.9"
10
19
  matrix:
11
20
  include:
12
21
  - rvm: jruby-head
13
- env: JRUBY_OPTS="--server -Xcext.enabled=false -Xcompile.invokedynamic=false"
14
- - rvm: jruby-1.7.19
15
- env: JRUBY_OPTS="--server -Xcext.enabled=false -Xcompile.invokedynamic=false"
22
+ env: JRUBY_OPTS="" BUNDLER_VERSION="~> 1.9.9"
23
+ - rvm: jruby-1.7.20
24
+ env: JRUBY_OPTS="" BUNDLER_VERSION="~> 1.10.2"
16
25
  - rvm: 1.8.7
17
- env: ''
26
+ env: BUNDLER_VERSION="~> 1.6.9"
18
27
  - rvm: 1.9.2
19
- env: ''
28
+ env: BUNDLER_VERSION="~> 1.7.9"
20
29
  - rvm: 1.9.3
21
- env: ''
30
+ env: BUNDLER_VERSION="~> 1.8.9"
22
31
  - rvm: jruby
23
32
  env: MAVEN_OPTS="-XX:MaxPermSize=128m"
24
33
  script: mvn clean verify
25
34
  allow_failures:
35
+ - rvm: jruby
26
36
  - rvm: jruby-head
27
37
  notifications:
28
38
  irc:
@@ -32,7 +42,3 @@ notifications:
32
42
  on_failure: always
33
43
  template:
34
44
  - "%{repository} (%{branch}:%{commit} by %{author}): %{message} (%{build_url})"
35
- before_install:
36
- - sudo apt-get update && sudo apt-get install git
37
- - git fetch --unshallow
38
- - gem install bundler --pre
data/History.txt CHANGED
@@ -1,5 +1,8 @@
1
1
  == Master
2
2
 
3
+
4
+ == 1.4.7
5
+
3
6
  - Added the ability to set custom port for Jetty launcher with
4
7
  warbler.port or PORT env var
5
8
 
data/Rakefile CHANGED
@@ -6,15 +6,15 @@
6
6
  # See the file LICENSE.txt for details.
7
7
  #++
8
8
 
9
- unless defined? Bundler
10
- warn "\nPlease `gem install bundler' and run `bundle install' to ensure you have all dependencies and run inside a bundler context 'bundle exec rake'.\n\n"
9
+ begin
10
+ require 'bundler'
11
+ rescue LoadError
12
+ warn "\nPlease `gem install bundler' and run `bundle install' to ensure you have all dependencies.\n\n"
13
+ else
14
+ require 'bundler/gem_helper'
15
+ Bundler::GemHelper.install_tasks :dir => File.dirname(__FILE__)
11
16
  end
12
17
 
13
- require 'bundler/gem_helper'
14
- gem_helper = Bundler::GemHelper.new(File.dirname(__FILE__))
15
- gem_helper.install
16
- gemspec = gem_helper.gemspec
17
-
18
18
  require 'rake/clean'
19
19
  CLEAN << "pkg" << "doc" << Dir['integration/**/target']
20
20
 
@@ -42,8 +42,13 @@ end
42
42
  # the jar tasks is part of maven-tasks
43
43
  task :build => :jar
44
44
 
45
+ load_gemspec = lambda do
46
+ Gem::Specification.load(File.expand_path('warbler.gemspec', File.dirname(__FILE__)))
47
+ end
48
+
45
49
  require 'rdoc/task'
46
50
  RDoc::Task.new(:docs) do |rd|
51
+ gemspec = load_gemspec.call
47
52
  rd.rdoc_dir = "doc"
48
53
  rd.rdoc_files.include("README.rdoc", "History.txt", "LICENSE.txt")
49
54
  rd.rdoc_files += gemspec.require_paths
@@ -54,6 +59,7 @@ end
54
59
  task :release_docs => :docs do
55
60
  config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml"))) rescue nil
56
61
  if config
62
+ gemspec = load_gemspec.call
57
63
  dir = "/var/www/gforge-projects/#{gemspec.rubyforge_project}/#{gemspec.name}"
58
64
  dest = "#{config["username"]}@rubyforge.org:#{dir}"
59
65
  sh %{rsync -rl --delete doc/ #{dest}}
data/ext/WarMain.java CHANGED
@@ -63,6 +63,7 @@ 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
+ static final String WEBSERVER_CONFIG = "/WEB-INF/webserver.xml";
66
67
 
67
68
  /**
68
69
  * jruby arguments, consider the following command :
@@ -141,10 +142,14 @@ public class WarMain extends JarMain {
141
142
 
142
143
  String port = System.getProperty("warbler.port", System.getenv("PORT"));
143
144
  port = port == null ? "8080" : port;
145
+ String webserverConfig = System.getProperty("warbler.webserver_config", System.getenv("WARBLER_WEBSERVER_CONFIG"));
146
+ String embeddedWebserverConfig = new URI("jar", entryPath(WEBSERVER_CONFIG), null).toURL().toString();
147
+ webserverConfig = webserverConfig == null ? embeddedWebserverConfig : webserverConfig;
144
148
  for (Map.Entry entry : props.entrySet()) {
145
149
  String val = (String) entry.getValue();
146
150
  val = val.replace("{{warfile}}", archive).
147
151
  replace("{{port}}", port).
152
+ replace("{{config}}", webserverConfig).
148
153
  replace("{{webroot}}", webroot.getAbsolutePath());
149
154
  entry.setValue(val);
150
155
  }
data/ext/WarblerJar.java CHANGED
@@ -118,16 +118,20 @@ public class WarblerJar {
118
118
  path = value.convertToString().getUnicodeValue();
119
119
  }
120
120
 
121
- InputStream inFile = getStream(path, null);
122
121
  try {
123
- zip.putNextEntry(new ZipEntry(entryName));
124
- byte[] buf = new byte[16384];
125
- int bytesRead;
126
- while ((bytesRead = inFile.read(buf)) != -1) {
127
- zip.write(buf, 0, bytesRead);
122
+ InputStream inFile = getStream(path, null);
123
+ try {
124
+ zip.putNextEntry(new ZipEntry(entryName));
125
+ byte[] buf = new byte[16384];
126
+ int bytesRead;
127
+ while ((bytesRead = inFile.read(buf)) != -1) {
128
+ zip.write(buf, 0, bytesRead);
129
+ }
130
+ } finally {
131
+ close(inFile);
128
132
  }
129
- } finally {
130
- close(inFile);
133
+ } catch (IOException e) {
134
+ System.err.println("File not found; " + path + " not in archive");
131
135
  }
132
136
  }
133
137
  }
data/lib/warbler.rb CHANGED
@@ -34,6 +34,7 @@ require 'warbler/executable_helper'
34
34
  require 'warbler/rake_helper'
35
35
  require 'warbler/pathmap_helper'
36
36
  require 'warbler/platform_helper'
37
+ require 'warbler/bundler_helper'
37
38
  require 'warbler/task'
38
39
  require 'warbler/application'
39
40
  require 'warbler/web_server'
@@ -0,0 +1,22 @@
1
+ #--
2
+ # Copyright (c) 2014-2015 JRuby Team
3
+ # This source code is available under the MIT license.
4
+ # See the file LICENSE.txt for details.
5
+ #++
6
+
7
+ module Warbler
8
+ module BundlerHelper
9
+ def to_spec(spec)
10
+ # JRuby <= 1.7.20 does not handle respond_to? with method_missing right
11
+ # thus a `spec.respond_to?(:to_spec) ? spec.to_spec : spec` won't do :
12
+ if ::Bundler.const_defined?(:StubSpecification) # since Bundler 1.10.1
13
+ spec = spec.to_spec if spec.is_a?(::Bundler::StubSpecification)
14
+ else
15
+ spec = spec.to_spec if spec.respond_to?(:to_spec)
16
+ end
17
+ spec
18
+ end
19
+ module_function :to_spec
20
+ end
21
+ end
22
+
data/lib/warbler/gems.rb CHANGED
@@ -43,16 +43,19 @@ module Warbler
43
43
  end
44
44
 
45
45
  def specs(gem_dependencies)
46
- @specs ||= map{|gem, version| find_single_gem_files(gem_dependencies, gem, version) }.flatten.compact
46
+ @specs ||= map { |gem, version| find_single_gem_files(gem_dependencies, gem, version) }.flatten.compact
47
47
  end
48
48
 
49
49
  private
50
50
 
51
51
  # Add a single gem to WEB-INF/gems
52
52
  def find_single_gem_files(gem_dependencies, gem_pattern, version = nil)
53
+ gem_spec_class = Gem::Specification
54
+ gem_spec_class = Gem::BasicSpecification if Gem.const_defined?(:BasicSpecification)
55
+ # Gem::Specification < Gem::BasicSpecification (since RGs 2.1)
53
56
  case gem_pattern
54
- when Gem::Specification
55
- return gem_pattern
57
+ when gem_spec_class
58
+ return BundlerHelper.to_spec(gem_pattern)
56
59
  when Gem::Dependency
57
60
  gem = gem_pattern
58
61
  else
@@ -62,14 +65,11 @@ module Warbler
62
65
  return nil if gem.respond_to?(:type) and gem.type != :runtime
63
66
 
64
67
  # Deal with deprecated Gem.source_index and #search
65
- matched = gem.respond_to?(:to_spec) ? [gem.to_spec] : Gem.source_index.search(gem)
68
+ matched = gem.respond_to?(:to_spec) ? [ gem.to_spec ] : Gem.source_index.search(gem)
66
69
  fail "gem '#{gem}' not installed" if matched.empty?
67
70
  spec = matched.last
68
- if gem_dependencies
69
- [spec] + spec.dependencies.map{|gem| find_single_gem_files(gem_dependencies, gem) }
70
- else
71
- spec
72
- end
71
+ return spec unless gem_dependencies
72
+ [spec] + spec.dependencies.map { |gem| find_single_gem_files(gem_dependencies, gem) }
73
73
  end
74
74
 
75
75
  end
data/lib/warbler/jar.rb CHANGED
@@ -290,8 +290,10 @@ module Warbler
290
290
  zipfile.mkdir(entry.dup) # in case it's frozen rubyzip 0.9.6.1 workaround
291
291
  elsif File.symlink?(src)
292
292
  zipfile.get_output_stream(entry) { |f| f << File.read(src) }
293
- else
293
+ elsif File.exist?(src)
294
294
  zipfile.add(entry, src)
295
+ else
296
+ $stderr.puts "File not found; #{entry.inspect} not in archive"
295
297
  end
296
298
  end
297
299
  end
@@ -12,6 +12,7 @@ module Warbler
12
12
  class Bundler
13
13
  include Trait
14
14
  include PathmapHelper
15
+ include BundlerHelper
15
16
 
16
17
  def self.detect?
17
18
  File.exist?(ENV['BUNDLE_GEMFILE'] || "Gemfile")
@@ -37,15 +38,15 @@ module Warbler
37
38
  config.bundler = {}
38
39
 
39
40
  bundler_specs.each do |spec|
41
+ spec = to_spec(spec)
40
42
  # Bundler HAX -- fixup bad #loaded_from attribute in fake
41
43
  # bundler gemspec from bundler/source.rb
42
- if spec.name == "bundler"
44
+ if spec.name == 'bundler'
43
45
  full_gem_path = Pathname.new(spec.full_gem_path)
44
-
45
- while !full_gem_path.join('bundler.gemspec').exist?
46
+ while ! full_gem_path.join('bundler.gemspec').exist?
46
47
  full_gem_path = full_gem_path.dirname
47
48
  # if at top of the path, meaning we cannot find bundler.gemspec, abort.
48
- if full_gem_path.to_s=~/^[\.\/]$/
49
+ if full_gem_path.to_s =~ /^[\.\/]$/
49
50
  $stderr.puts("warning: Unable to detect bundler spec under '#{spec.full_gem_path}'' and is sub-dirs")
50
51
  exit
51
52
  end
@@ -139,8 +140,8 @@ module Warbler
139
140
  definition = ::Bundler.definition
140
141
  all = definition.specs.to_a
141
142
  requested = definition.specs_for(definition.groups - bundle_without).to_a
142
- excluded_git_specs = (all - requested).select {|spec| ::Bundler::Source::Git === spec.source }
143
- excluded_git_specs.each {|spec| spec.groups << :warbler_excluded }
143
+ excluded_git_specs = (all - requested).select { |spec| ::Bundler::Source::Git === spec.source }
144
+ excluded_git_specs.each { |spec| spec.groups << :warbler_excluded }
144
145
  requested + excluded_git_specs
145
146
  end
146
147
 
@@ -6,5 +6,5 @@
6
6
  #++
7
7
 
8
8
  module Warbler
9
- VERSION = "1.4.7"
9
+ VERSION = "1.4.8"
10
10
  end
@@ -122,13 +122,23 @@ PROPS
122
122
 
123
123
  def add(jar)
124
124
  super
125
+ jar.files["WEB-INF/webserver.xml"] ||= StringIO.new(<<-CONFIG)
126
+ <?xml version="1.0"?>
127
+ <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
128
+
129
+ <Configure id="Server" class="org.eclipse.jetty.server.Server">
130
+ </Configure>
131
+ CONFIG
132
+
125
133
  jar.files["WEB-INF/webserver.properties"] = StringIO.new(<<-PROPS)
126
134
  mainclass = org.eclipse.jetty.runner.Runner
127
- args = args0,args1,args2
135
+ args = args0,args1,args2,args3,args4
128
136
  props = jetty.home
129
137
  args0 = --port
130
138
  args1 = {{port}}
131
- args2 = {{warfile}}
139
+ args2 = --config
140
+ args3 = {{config}}
141
+ args4 = {{warfile}}
132
142
  jetty.home = {{webroot}}
133
143
  PROPS
134
144
  end
data/lib/warbler_jar.jar CHANGED
Binary file
data/pom.xml CHANGED
@@ -4,17 +4,16 @@
4
4
  <modelVersion>4.0.0</modelVersion>
5
5
  <groupId>rubygems</groupId>
6
6
  <artifactId>warbler</artifactId>
7
- <version>1.4.5.dev-SNAPSHOT</version>
7
+ <version>1.4.8.dev-SNAPSHOT</version>
8
8
  <packaging>gem</packaging>
9
9
  <name>Warbler chirpily constructs .war files of your Rails applications.</name>
10
10
  <description>Warbler is a gem to make a Java jar or war file out of any Ruby,
11
- Rails, Merb, or Rack application. Warbler provides a minimal,
12
- flexible, Ruby-like way to bundle up all of your application files for
13
- deployment to a Java environment.</description>
14
- <url>http://caldersphere.rubyforge.org/warbler</url>
11
+ Rails, or Rack application. Warbler provides a minimal, flexible, Ruby-like way to
12
+ bundle up all of your application files for deployment to a Java environment.</description>
13
+ <url>https://github.com/jruby/warbler</url>
15
14
  <properties>
16
15
  <tesla.dump.readOnly>true</tesla.dump.readOnly>
17
- <jruby.plugins.version>1.0.0-rc4</jruby.plugins.version>
16
+ <jruby.plugins.version>1.0.0</jruby.plugins.version>
18
17
  <tesla.dump.pom>pom.xml</tesla.dump.pom>
19
18
  <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
20
19
  </properties>
@@ -34,19 +33,26 @@ deployment to a Java environment.</description>
34
33
  <dependency>
35
34
  <groupId>rubygems</groupId>
36
35
  <artifactId>jruby-rack</artifactId>
37
- <version>[1.0.0,)</version>
36
+ <version>[1.1.1,1.3)</version>
38
37
  <type>gem</type>
39
38
  </dependency>
40
39
  <dependency>
41
40
  <groupId>rubygems</groupId>
42
41
  <artifactId>rubyzip</artifactId>
43
- <version>[0.9,1.1)</version>
42
+ <version>[0.9,1.2)</version>
44
43
  <type>gem</type>
45
44
  </dependency>
45
+ <dependency>
46
+ <groupId>rubygems</groupId>
47
+ <artifactId>jbundler</artifactId>
48
+ <version>[0.5.5,0.5.99999]</version>
49
+ <type>gem</type>
50
+ <scope>test</scope>
51
+ </dependency>
46
52
  <dependency>
47
53
  <groupId>rubygems</groupId>
48
54
  <artifactId>ruby-maven</artifactId>
49
- <version>[3.1.1.0.0,3.1.1.0.0.0.0.0.0.1)</version>
55
+ <version>[3.1.1.0,3.1.1.99999]</version>
50
56
  <type>gem</type>
51
57
  <scope>test</scope>
52
58
  </dependency>
data/spec/spec_helper.rb CHANGED
@@ -82,6 +82,59 @@ module ExampleGroupHelpers
82
82
  end
83
83
  end
84
84
 
85
+ def create_git_gem(gem_name)
86
+ before do
87
+ @gem_dir = Dir.mktmpdir("#{gem_name}-#{rand(100)}")
88
+ cur_dir = Dir.pwd
89
+ Dir.chdir(@gem_dir) do
90
+ `git init`
91
+ `git config user.email "warbler-test@null.com"`
92
+ `git config user.name "Warbler Test"`
93
+
94
+ # create the gemspec and Gemfile
95
+ File.open("Gemfile", "w") do |f|
96
+ f << <<-RUBY
97
+ source "http://rubygems.org/"
98
+ gemspec
99
+ RUBY
100
+ end
101
+
102
+ File.open("#{gem_name}.gemspec", "w") do |f|
103
+ f << <<-RUBY
104
+ # -*- encoding: utf-8 -*-
105
+ Gem::Specification.new do |gem|
106
+ gem.name = "#{gem_name}"
107
+ gem.version = '1.0'
108
+ gem.authors = ['John Doe']
109
+ gem.summary = "Gem for testing"
110
+ gem.platform = Gem::Platform::RUBY
111
+ gem.files = `git ls-files`.split("\n")
112
+ gem.add_runtime_dependency 'rake', [">= 10.4.2"]
113
+ end
114
+ RUBY
115
+ end
116
+
117
+ Dir.mkdir("lib")
118
+ Dir.mkdir("lib/#{gem_name}")
119
+
120
+ File.open("lib/#{gem_name}/version.rb", "w") do |f|
121
+ f << <<-RUBY
122
+ VERSION = "1.0"
123
+ RUBY
124
+ end
125
+
126
+ # `bundle install --local`
127
+ `git add .`
128
+ `git commit -am "first commit"`
129
+ end
130
+ Dir.chdir(cur_dir)
131
+ end
132
+
133
+ after do
134
+ FileUtils.remove_entry_secure @gem_dir
135
+ end
136
+ end
137
+
85
138
  def run_out_of_process_with_drb
86
139
  before :all do
87
140
  DRb.start_service
@@ -21,6 +21,10 @@ describe Warbler::Jar, "with Bundler" do
21
21
  @extra_config = block
22
22
  end
23
23
 
24
+ def bundle_install(*args)
25
+ `cd #{Dir.pwd} && #{RUBY_EXE} -S bundle install #{args.join(' ')}`
26
+ end
27
+
24
28
  let(:config) { drbclient.config(@extra_config) }
25
29
  let(:jar) { drbclient.jar }
26
30
 
@@ -62,47 +66,30 @@ describe Warbler::Jar, "with Bundler" do
62
66
  end
63
67
 
64
68
  context 'with :git entries in the Gemfile' do
65
- before do
66
- File.open("Gemfile", "w") {|f| f << "gem 'warbler', :git => '#{Warbler::WARBLER_HOME}'\n"}
67
- `#{RUBY_EXE} -S bundle install --local`
68
- end
69
+ create_git_gem("tester")
69
70
 
70
71
  it "works with :git entries in Gemfiles" do
72
+ File.open("Gemfile", "w") {|f| f << "gem 'tester', :git => '#{@gem_dir}'\n"}
73
+ bundle_install '--local'
71
74
  jar.apply(config)
72
- file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/lib/warbler/version\.rb}).should_not be_empty
73
- file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/warbler.gemspec}).should_not be_empty
75
+ file_list(%r{WEB-INF/gems/bundler/gems/tester[^/]*/lib/tester/version\.rb}).should_not be_empty
76
+ file_list(%r{WEB-INF/gems/bundler/gems/tester[^/]*/tester.gemspec}).should_not be_empty
74
77
  end
75
78
 
76
- it "can run commands in the generated warfile" do
77
- use_config do |config|
78
- config.features = %w{runnable}
79
- config.override_gem_home = false
80
- end
79
+ it "bundles only the gemspec for :git entries that are excluded" do
80
+ File.open("Gemfile", "w") {|f| f << "gem 'rake'\ngroup :test do\ngem 'tester', :git => '#{@gem_dir}'\nend\n"}
81
+ bundle_install '--local'
81
82
  jar.apply(config)
82
- jar.create('foo.war')
83
- if RUBY_VERSION >= '1.9'
84
- stdin, stdout, stderr, wait_thr = Open3.popen3('java -jar foo.war -S rake -T')
85
- wait_thr.value.success?.should be(true), stderr.readlines.join
86
- else
87
- `java -jar foo.war -S rake -T`
88
- $?.exitstatus.should == 0
89
- end
83
+ file_list(%r{WEB-INF/gems/bundler/gems/tester[^/]*/lib/tester/version\.rb}).should be_empty
84
+ file_list(%r{WEB-INF/gems/bundler/gems/tester[^/]*/tester.gemspec}).should_not be_empty
90
85
  end
91
- end
92
86
 
93
- it "bundles only the gemspec for :git entries that are excluded" do
94
- File.open("Gemfile", "w") {|f| f << "gem 'rake'\ngroup :test do\ngem 'warbler', :git => '#{Warbler::WARBLER_HOME}'\nend\n"}
95
- `#{RUBY_EXE} -S bundle install --local`
96
- jar.apply(config)
97
- file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/lib/warbler/version\.rb}).should be_empty
98
- file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/warbler.gemspec}).should_not be_empty
99
- end
100
-
101
- it "does not work with :path entries in Gemfiles" do
102
- File.open("Gemfile", "w") {|f| f << "gem 'warbler', :path => '#{Warbler::WARBLER_HOME}'\n"}
103
- `#{RUBY_EXE} -S bundle install --local`
104
- silence { jar.apply(config) }
105
- file_list(%r{warbler}).should be_empty
87
+ it "does not work with :path entries in Gemfiles" do
88
+ File.open("Gemfile", "w") {|f| f << "gem 'tester', :path => '#{@gem_dir}'\n"}
89
+ bundle_install '--local'
90
+ silence { jar.apply(config) }
91
+ file_list(%r{tester}).should be_empty
92
+ end
106
93
  end
107
94
 
108
95
  it "does not bundle dependencies in the test group by default" do
@@ -138,19 +125,23 @@ describe Warbler::Jar, "with Bundler" do
138
125
  run_in_directory "spec/sample_jar"
139
126
  cleanup_temp_files
140
127
 
141
- it "works with :git entries in Gemfiles" do
142
- File.open("Gemfile", "w") {|f| f << "gem 'warbler', :git => '#{Warbler::WARBLER_HOME}'\n"}
143
- `#{RUBY_EXE} -S bundle install --local`
144
- jar.apply(config)
145
- file_list(%r{^bundler/gems/warbler[^/]*/lib/warbler/version\.rb}).should_not be_empty
146
- file_list(%r{^bundler/gems/warbler[^/]*/warbler.gemspec}).should_not be_empty
147
- jar.add_init_file(config)
148
- contents = jar.contents('META-INF/init.rb')
149
- contents.should =~ /ENV\['BUNDLE_GEMFILE'\] = File.expand_path(.*, __FILE__)/
128
+ context 'with :git entries in the Gemfile' do
129
+ create_git_gem("tester")
130
+
131
+ it "works with :git entries in Gemfiles" do
132
+ File.open("Gemfile", "w") {|f| f << "gem 'tester', :git => '#{@gem_dir}'\n"}
133
+ bundle_install '--local'
134
+ jar.apply(config)
135
+ file_list(%r{^bundler/gems/tester[^/]*/lib/tester/version\.rb}).should_not be_empty
136
+ file_list(%r{^bundler/gems/tester[^/]*/tester.gemspec}).should_not be_empty
137
+ jar.add_init_file(config)
138
+ contents = jar.contents('META-INF/init.rb')
139
+ contents.should =~ /ENV\['BUNDLE_GEMFILE'\] = File.expand_path(.*, __FILE__)/
140
+ end
150
141
  end
151
142
 
152
143
  it "adds BUNDLE_GEMFILE to init.rb" do
153
- File.open("Gemfile", "w") {|f| f << "source :rubygems" }
144
+ File.open("Gemfile", "w") {|f| f << "source 'http://rubygems.org/'" }
154
145
  jar.add_init_file(config)
155
146
  contents = jar.contents('META-INF/init.rb')
156
147
  contents.should =~ /ENV\['BUNDLE_GEMFILE'\] = File.expand_path(.*, __FILE__)/
@@ -176,13 +167,55 @@ describe Warbler::Jar, "with Bundler" do
176
167
  contents = jar.contents('META-INF/init.rb')
177
168
  contents.split("\n").grep(/ENV\['BUNDLE_FROZEN'\] = '1'/).should_not be_empty
178
169
  end
170
+
171
+ context "with the runnable feature" do
172
+ before do
173
+ File.open("Rakefile", "w") do |f|
174
+ f << <<-RUBY
175
+ task :test_task do
176
+ puts "success"
177
+ end
178
+ RUBY
179
+ end
180
+
181
+ use_config do |config|
182
+ config.features = %w{runnable}
183
+ end
184
+ jar.apply(config)
185
+ end
186
+
187
+ after do
188
+ rm_rf "Rakefile"
189
+ rm_rf "foo.war"
190
+ end
191
+
192
+ it "adds WarMain and JarMain to file" do
193
+ file_list(%r{^WarMain\.class$}).should_not be_empty
194
+ file_list(%r{^JarMain\.class$}).should_not be_empty
195
+ end
196
+
197
+ it "can run commands in the generated warfile" do
198
+ jar.create('foo.war')
199
+ if RUBY_VERSION >= '1.9'
200
+ stdin, stdout, stderr, wait_thr = Open3.popen3('java -jar foo.war -S rake test_task')
201
+ wait_thr.value.success?.should be(true)
202
+
203
+ # TODO need to update rake or we'll get an warning in stderr
204
+ # stderr.readlines.join.should eq("")
205
+ stdout.readlines.join.should include("success\n")
206
+ else
207
+ `java -jar foo.war -S rake -T`
208
+ $?.exitstatus.should == 0
209
+ end
210
+ end
211
+ end
179
212
  end
180
213
 
181
214
  context "when deployment" do
182
215
  run_in_directory "spec/sample_bundler"
183
216
 
184
217
  it "includes the bundler gem" do
185
- `#{RUBY_EXE} -S bundle install --deployment`
218
+ bundle_install '--deployment'
186
219
  jar.apply(config)
187
220
  file_list(%r{gems/rake-0.8.7/lib}).should_not be_empty
188
221
  file_list(%r{gems/bundler-}).should_not be_empty
metadata CHANGED
@@ -1,39 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sieger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-25 00:00:00.000000000 Z
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: 0.9.6
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - '>='
23
17
  - !ruby/object:Gem::Version
24
18
  version: 0.9.6
19
+ name: rake
25
20
  prerelease: false
26
21
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: jruby-jars
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
24
  - - '>='
32
25
  - !ruby/object:Gem::Version
33
- version: 1.5.6
34
- - - <
35
- - !ruby/object:Gem::Version
36
- version: '2.0'
26
+ version: 0.9.6
27
+ - !ruby/object:Gem::Dependency
37
28
  requirement: !ruby/object:Gem::Requirement
38
29
  requirements:
39
30
  - - '>='
@@ -42,18 +33,18 @@ dependencies:
42
33
  - - <
43
34
  - !ruby/object:Gem::Version
44
35
  version: '2.0'
36
+ name: jruby-jars
45
37
  prerelease: false
46
38
  type: :runtime
47
- - !ruby/object:Gem::Dependency
48
- name: jruby-rack
49
39
  version_requirements: !ruby/object:Gem::Requirement
50
40
  requirements:
51
41
  - - '>='
52
42
  - !ruby/object:Gem::Version
53
- version: 1.1.1
43
+ version: 1.5.6
54
44
  - - <
55
45
  - !ruby/object:Gem::Version
56
- version: '1.3'
46
+ version: '2.0'
47
+ - !ruby/object:Gem::Dependency
57
48
  requirement: !ruby/object:Gem::Requirement
58
49
  requirements:
59
50
  - - '>='
@@ -62,18 +53,18 @@ dependencies:
62
53
  - - <
63
54
  - !ruby/object:Gem::Version
64
55
  version: '1.3'
56
+ name: jruby-rack
65
57
  prerelease: false
66
58
  type: :runtime
67
- - !ruby/object:Gem::Dependency
68
- name: rubyzip
69
59
  version_requirements: !ruby/object:Gem::Requirement
70
60
  requirements:
71
61
  - - '>='
72
62
  - !ruby/object:Gem::Version
73
- version: '0.9'
63
+ version: 1.1.1
74
64
  - - <
75
65
  - !ruby/object:Gem::Version
76
- version: '1.2'
66
+ version: '1.3'
67
+ - !ruby/object:Gem::Dependency
77
68
  requirement: !ruby/object:Gem::Requirement
78
69
  requirements:
79
70
  - - '>='
@@ -82,64 +73,73 @@ dependencies:
82
73
  - - <
83
74
  - !ruby/object:Gem::Version
84
75
  version: '1.2'
76
+ name: rubyzip
85
77
  prerelease: false
86
78
  type: :runtime
87
- - !ruby/object:Gem::Dependency
88
- name: jbundler
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
80
  requirements:
91
- - - ~>
81
+ - - '>='
92
82
  - !ruby/object:Gem::Version
93
- version: 0.5.5
83
+ version: '0.9'
84
+ - - <
85
+ - !ruby/object:Gem::Version
86
+ version: '1.2'
87
+ - !ruby/object:Gem::Dependency
94
88
  requirement: !ruby/object:Gem::Requirement
95
89
  requirements:
96
90
  - - ~>
97
91
  - !ruby/object:Gem::Version
98
92
  version: 0.5.5
93
+ name: jbundler
99
94
  prerelease: false
100
95
  type: :development
101
- - !ruby/object:Gem::Dependency
102
- name: ruby-maven
103
96
  version_requirements: !ruby/object:Gem::Requirement
104
97
  requirements:
105
98
  - - ~>
106
99
  - !ruby/object:Gem::Version
107
- version: 3.1.1.0
100
+ version: 0.5.5
101
+ - !ruby/object:Gem::Dependency
108
102
  requirement: !ruby/object:Gem::Requirement
109
103
  requirements:
110
104
  - - ~>
111
105
  - !ruby/object:Gem::Version
112
106
  version: 3.1.1.0
107
+ name: ruby-maven
113
108
  prerelease: false
114
109
  type: :development
115
- - !ruby/object:Gem::Dependency
116
- name: rspec
117
110
  version_requirements: !ruby/object:Gem::Requirement
118
111
  requirements:
119
112
  - - ~>
120
113
  - !ruby/object:Gem::Version
121
- version: '2.10'
114
+ version: 3.1.1.0
115
+ - !ruby/object:Gem::Dependency
122
116
  requirement: !ruby/object:Gem::Requirement
123
117
  requirements:
124
118
  - - ~>
125
119
  - !ruby/object:Gem::Version
126
120
  version: '2.10'
121
+ name: rspec
127
122
  prerelease: false
128
123
  type: :development
129
- - !ruby/object:Gem::Dependency
130
- name: rdoc
131
124
  version_requirements: !ruby/object:Gem::Requirement
132
125
  requirements:
133
- - - '>='
126
+ - - ~>
134
127
  - !ruby/object:Gem::Version
135
- version: 2.4.2
128
+ version: '2.10'
129
+ - !ruby/object:Gem::Dependency
136
130
  requirement: !ruby/object:Gem::Requirement
137
131
  requirements:
138
132
  - - '>='
139
133
  - !ruby/object:Gem::Version
140
134
  version: 2.4.2
135
+ name: rdoc
141
136
  prerelease: false
142
137
  type: :development
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - '>='
141
+ - !ruby/object:Gem::Version
142
+ version: 2.4.2
143
143
  description: |-
144
144
  Warbler is a gem to make a Java jar or war file out of any Ruby,
145
145
  Rails, or Rack application. Warbler provides a minimal, flexible, Ruby-like way to
@@ -247,6 +247,7 @@ files:
247
247
  - integration/simple_rack_test/src/test/java/org/jruby/warbler/AppTestIT.java
248
248
  - lib/warbler.rb
249
249
  - lib/warbler/application.rb
250
+ - lib/warbler/bundler_helper.rb
250
251
  - lib/warbler/config.rb
251
252
  - lib/warbler/executable_helper.rb
252
253
  - lib/warbler/gems.rb
@@ -391,7 +392,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
392
  version: '0'
392
393
  requirements: []
393
394
  rubyforge_project:
394
- rubygems_version: 2.4.5
395
+ rubygems_version: 2.4.6
395
396
  signing_key:
396
397
  specification_version: 4
397
398
  summary: Warbler chirpily constructs .war files of your Rails applications.
@@ -562,3 +563,4 @@ test_files:
562
563
  - spec/warbler/traits_spec.rb
563
564
  - spec/warbler/war_spec.rb
564
565
  - spec/warbler/web_server_spec.rb
566
+ has_rdoc: