diff --git a/.travis.yml b/.travis.yml
index ab7b4c4c..5b009525 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,38 +2,39 @@ sudo: false
language: ruby
script: bundle exec rake spec
rvm:
- - jruby-1.7.8
+ - jruby-1.7.24
branches:
only:
- master
- - 2.x-dev
- - /^test-.*/
+ - /-dev|-feature|-fix/
before_install:
- ([ "$BUNDLER_VERSION" ] && gem uninstall bundler --all --force && gem install bundler -v "$BUNDLER_VERSION") || true
- bundle --version
before_script:
- export JRUBY_OPTS="$JRUBY_OPTS --server -Xcext.enabled=false -Xcompile.invokedynamic=false"
env:
- - JRUBY_OPTS="--1.8" BUNDLER_VERSION="~> 1.7.9"
- - JRUBY_OPTS="--1.9" BUNDLER_VERSION="~> 1.8.9"
+ - BUNDLER_VERSION="~> 1.10"
matrix:
include:
- - rvm: jruby-head
- env: JRUBY_OPTS="" BUNDLER_VERSION="~> 1.9.9"
- - rvm: jruby-1.7.20
- env: JRUBY_OPTS="" BUNDLER_VERSION="~> 1.10.2"
+ - rvm: jruby-1.7.24
+ env: JRUBY_OPTS="--1.8" BUNDLER_VERSION="~> 1.7.9" RAKE_VERSION="~> 10.2.2"
+ - rvm: jruby-1.7.24
+ env: JRUBY_OPTS="--1.9" BUNDLER_VERSION="~> 1.11.2" RAKE_VERSION="~> 10.3.2"
+ - rvm: jruby-1.7.8
+ env: JRUBY_OPTS="--1.8" BUNDLER_VERSION="~> 1.8.9" RAKE_VERSION="~> 10.1.1"
+ - rvm: jruby-1.7.16
+ env: JRUBY_OPTS="" BUNDLER_VERSION="~> 1.10.2" RAKE_VERSION="~> 10.4.2"
- rvm: 1.8.7
- env: BUNDLER_VERSION="~> 1.6.9"
+ env: BUNDLER_VERSION="~> 1.6.9" RAKE_VERSION="~> 10.4.2"
- rvm: 1.9.2
- env: BUNDLER_VERSION="~> 1.7.9"
+ env: BUNDLER_VERSION="~> 1.7.9" RAKE_VERSION="~> 10.5.0"
- rvm: 1.9.3
- env: BUNDLER_VERSION="~> 1.8.9"
- - rvm: jruby
+ env: BUNDLER_VERSION="~> 1.8.9" RAKE_VERSION="~> 10.2.2"
+ - rvm: jruby-1.7.24
env: MAVEN_OPTS="-XX:MaxPermSize=128m"
script: mvn clean verify
allow_failures:
- - rvm: jruby
- - rvm: jruby-head
+ - script: mvn clean verify
notifications:
irc:
channels:
diff --git a/Gemfile b/Gemfile
index 1507828f..2fcda13e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -9,6 +9,11 @@ group :development do
gem "maven-tools", "~> 0.34.5"
end
+group :development, :test do
+ gem 'rdoc', '~> 3.10', :require => nil
+ gem 'rake', ENV['RAKE_VERSION'], :require => nil if ENV['RAKE_VERSION']
+end
+
if ENV['RUBYZIP_VERSION']
gem 'rubyzip', ENV['RUBYZIP_VERSION']
elsif RUBY_VERSION < "1.9"
diff --git a/lib/warbler/config.rb b/lib/warbler/config.rb
index 86f1e164..a43c9ada 100644
--- a/lib/warbler/config.rb
+++ b/lib/warbler/config.rb
@@ -242,17 +242,8 @@ def define_tasks
end
end
- # Deprecated
- def war_name
- $stderr.puts "config.war_name deprecated; replace with config.jar_name" #:nocov:
- jar_name #:nocov:
- end
-
- # Deprecated
- def war_name=(w)
- $stderr.puts "config.war_name deprecated; replace with config.jar_name" #:nocov:
- self.jar_name = w #:nocov:
- end
+ alias_method :war_name, :jar_name
+ alias_method :war_name=, :jar_name=
private
def warbler_vendor_excludes(warbler_home)
diff --git a/lib/warbler/jar.rb b/lib/warbler/jar.rb
index 1f83ab1a..ffedbc2e 100644
--- a/lib/warbler/jar.rb
+++ b/lib/warbler/jar.rb
@@ -158,7 +158,7 @@ def create(config_or_path)
end
rm_f path
ensure_directory_entries
- puts "Creating #{path}"
+ puts "Creating #{path}" unless silent?
if Warbler::Config === config_or_path
@files.delete("#{config_or_path.jar_name}/#{path}")
end
diff --git a/lib/warbler/rake_helper.rb b/lib/warbler/rake_helper.rb
index 61261243..b65b0c19 100644
--- a/lib/warbler/rake_helper.rb
+++ b/lib/warbler/rake_helper.rb
@@ -25,5 +25,12 @@ def self.extended(base)
base.extend Rake::FileUtilsExt
end
end
+
+ private
+
+ def silent?
+ Rake.application.options.silent rescue nil
+ end
+
end
end
diff --git a/lib/warbler/traits/bundler.rb b/lib/warbler/traits/bundler.rb
index 201d6646..cfc9df87 100644
--- a/lib/warbler/traits/bundler.rb
+++ b/lib/warbler/traits/bundler.rb
@@ -23,19 +23,18 @@ def self.requirements
end
def before_configure
- config.bundler = true
- config.bundle_without = ["development", "test", "assets"]
+ config.bundler ||= true
+ config.bundle_without = ['development', 'test', 'assets']
end
def after_configure
add_bundler_gems if config.bundler
end
- def add_bundler_gems
- require 'bundler'
- config.gems.clear
+ def add_bundler_gems; require 'bundler'
+ # config.gems.clear allow to add `config.gems` on top of those bundled
config.gem_dependencies = false # Bundler takes care of these
- config.bundler = {}
+ config.bundler = {} if config.bundler == true
bundler_specs.each do |spec|
spec = to_spec(spec)
diff --git a/lib/warbler/traits/gemspec.rb b/lib/warbler/traits/gemspec.rb
index 382ee37b..f6248e21 100644
--- a/lib/warbler/traits/gemspec.rb
+++ b/lib/warbler/traits/gemspec.rb
@@ -18,18 +18,17 @@ def self.detect?
!Dir['*.gemspec'].empty?
end
- def before_configure
+ def before_configure; require 'yaml'
@spec_file = Dir['*.gemspec'].first
- require 'yaml'
- @spec = File.open(@spec_file) {|f| Gem::Specification.from_yaml(f) } rescue Gem::Specification.load(@spec_file)
- @spec.runtime_dependencies.each {|g| config.gems << g }
+ @spec = File.open(@spec_file) { |f| Gem::Specification.from_yaml(f) } rescue Gem::Specification.load(@spec_file)
+ @spec.runtime_dependencies.each { |g| config.gems << g }
config.dirs = []
- config.compiled_ruby_files = @spec.files.select {|f| f =~ /\.rb$/}
+ config.compiled_ruby_files = @spec.files.select { |f| f =~ /\.rb$/ }
end
def after_configure
@spec.require_paths.each do |p|
- add_init_load_path(config.pathmaps.application.inject(p) {|pm,x| pm.pathmap(x)})
+ add_init_load_path( config.pathmaps.application.inject(p) { |pm,x| pm.pathmap(x) } )
end
end
@@ -54,33 +53,27 @@ def update_archive(jar)
end
def default_executable
- if !@spec.executables.empty?
- bundler_version =
- Gem.loaded_specs.include?("bundler") ?
- Gem.loaded_specs["bundler"].version :
- Gem::Version.create("0.0.0")
- if (bundler_version <=> Gem::Version.create("1.8.0")) < 0
- "bin/#{@spec.executables.first}"
+ if ! @spec.executables.empty?
+ exe_script = @spec.executables.first
+ exe_path = File.join(@spec.bindir, exe_script) # bin/script
+ if File.exists?(exe_path)
+ exe_path
+ elsif File.exists?("bin/#{exe_script}") # compatibility
+ "bin/#{exe_script}" # ... should probably remove this
else
- exe_script = @spec.executables.first
- if File.exists?("exe/#{exe_script}")
- "exe/#{exe_script}"
- elsif File.exists?("bin/#{exe_script}")
- "bin/#{exe_script}"
- else
- raise "No `#{exe_script}` executable script found"
- end
+ raise "no `#{exe_script}` executable script found"
end
- elsif exe = Dir['bin/*'].sort.first
- warn "No default executable found in #{@spec_file}, using bin/#{exe}"
- exe
- elsif exe = Dir['exe/*'].sort.first
- warn "No default executable found in #{@spec_file}, using exe/#{exe}"
- exe
+ elsif exe_path = Dir['bin/*'].sort.first
+ warn "no executables found in #{@spec_file}, using #{exe_path}"
+ exe_path
+ elsif exe_path = Dir['exe/*'].sort.first
+ warn "no executables found in #{@spec_file}, using #{exe_path}"
+ exe_path
else
- raise "No executable script found" unless exe
+ raise "no executable script found"
end
end
+
end
end
end
diff --git a/lib/warbler/traits/rails.rb b/lib/warbler/traits/rails.rb
index 3d081504..65807654 100644
--- a/lib/warbler/traits/rails.rb
+++ b/lib/warbler/traits/rails.rb
@@ -12,7 +12,7 @@ class Rails
include Trait
def self.detect?
- File.exist?("config/environment.rb")
+ File.exist?('config/environment.rb')
end
def self.requirements
@@ -24,15 +24,15 @@ def before_configure
config.webxml.rails.env = ENV['RAILS_ENV'] || 'production'
return unless Warbler.framework_detection
- return false unless task = Warbler.project_application.lookup("environment")
+ return false unless task = Warbler.project_application.lookup('environment')
task.invoke rescue nil
return false unless defined?(::Rails)
- config.dirs << "tmp" if File.directory?("tmp")
+ config.dirs << 'tmp' if File.directory?('tmp')
config.webxml.booter = :rails
- unless (defined?(::Rails.vendor_rails?) && ::Rails.vendor_rails?) || File.directory?("vendor/rails")
- config.gems["rails"] = ::Rails::VERSION::STRING
+ unless (defined?(::Rails.vendor_rails?) && ::Rails.vendor_rails?) || File.directory?('vendor/rails')
+ config.gems['rails'] = ::Rails::VERSION::STRING unless Bundler.detect?
end
if defined?(::Rails.configuration.gems)
::Rails.configuration.gems.each do |g|
diff --git a/lib/warbler/traits/war.rb b/lib/warbler/traits/war.rb
index a34c3079..c67039e4 100644
--- a/lib/warbler/traits/war.rb
+++ b/lib/warbler/traits/war.rb
@@ -134,7 +134,8 @@ def add_gemjar(jar)
def move_jars_to_webinf_lib(jar, selector = nil)
return unless selector # default is false
selector = /.*/ if selector == true # move all if not a RegExp given
- default_jars = default_jar_files.map { |file| File.basename(file) }
+ default_jar_paths = default_jar_files
+ default_jars = default_jar_paths.map { |file| File.basename(file) }
jar.files.keys.select { |k| k =~ /^WEB-INF\/.*\.jar$/ }.each do |k|
if k.start_with?('WEB-INF/lib/') # .jar already in WEB-INF/lib
if default_jars.include? k.sub('WEB-INF/lib/', '')
@@ -144,6 +145,8 @@ def move_jars_to_webinf_lib(jar, selector = nil)
next
end
next unless selector =~ File.basename(k)
+ # default jars might end up mapped twice as they're part of gems
+ next if default_jar_paths.include?(jar.files[k])
name = k.sub('WEB-INF', '')[1..-1].gsub(/[\/\\]/, '-')
jar.files["WEB-INF/lib/#{name}"] = jar.files[k]
jar.files[k] = empty_jar
diff --git a/pom.xml b/pom.xml
index 9bb84dbc..b11ff626 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
rubygems
warbler
- 1.4.8
+ 1.4.10
gem
Warbler chirpily constructs .war files of your Rails applications.
Warbler is a gem to make a Java jar or war file out of any Ruby,
@@ -39,7 +39,7 @@ bundle up all of your application files for deployment to a Java environment.
rubygems
rubyzip
- [0.9,1.2)
+ [0.9,1.3)
gem
@@ -52,7 +52,7 @@ bundle up all of your application files for deployment to a Java environment.
rubygems
ruby-maven
- [3.1.1.0,3.1.1.99999]
+ [3.1.1,3.1.99999]
gem
test
@@ -63,13 +63,6 @@ bundle up all of your application files for deployment to a Java environment.gem
test
-
- rubygems
- rdoc
- [2.4.2,)
- gem
- test
-
org.jruby
jruby
diff --git a/spec/sample_jar/sample_jar.gemspec b/spec/sample_jar/sample_jar.gemspec
index 5cbd1418..5690b235 100644
--- a/spec/sample_jar/sample_jar.gemspec
+++ b/spec/sample_jar/sample_jar.gemspec
@@ -10,7 +10,8 @@ Gem::Specification.new do |s|
s.description = ""
s.email = ["nick@nicksieger.com"]
s.executables = ["sample_jar"]
- s.files = ["History.txt", "Rakefile", "README.txt", "sample_jar.gemspec", "bin/sample_jar", "lib/sample_jar.rb", "test/test_sample_jar.rb"]
+ s.bindir = 'sbin'
+ 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"]
s.homepage = ""
s.require_paths = ["lib"]
s.rubygems_version = "1.8.15"
diff --git a/spec/sample_jar/sbin/sample_jar b/spec/sample_jar/sbin/sample_jar
new file mode 100644
index 00000000..02af9713
--- /dev/null
+++ b/spec/sample_jar/sbin/sample_jar
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+
+require 'sample_jar'
+
+SampleJar.hello
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index e0bdaa10..f08ddaed 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -109,7 +109,7 @@ def create_git_gem(gem_name)
gem.summary = "Gem for testing"
gem.platform = Gem::Platform::RUBY
gem.files = `git ls-files`.split("\n")
- gem.add_runtime_dependency 'rake', [">= 10.4.2"]
+ gem.add_runtime_dependency 'rake', ['>= 0.8.7']
end
RUBY
end
diff --git a/spec/warbler/jar_spec.rb b/spec/warbler/jar_spec.rb
index 107b1b03..d9816d2f 100644
--- a/spec/warbler/jar_spec.rb
+++ b/spec/warbler/jar_spec.rb
@@ -149,7 +149,7 @@ def apply_extra_config(config)
it "loads the default executable in main.rb" do
jar.apply(config)
contents = jar.contents('META-INF/main.rb')
- contents.should =~ /load.*sample_jar\/bin\/sample_jar/
+ contents.should == "load 'sample_jar/sbin/sample_jar'"
end
it "includes compiled .rb and .class files" do
@@ -910,10 +910,10 @@ def self.dependencies=(deps)
it "skips Merb development dependencies" do
task :merb_env do
- @merb.dependencies = [Gem::Dependency.new("rake", "= #{RAKEVERSION}", :development)]
+ @merb.dependencies = [Gem::Dependency.new("rake", "= #{Rake::VERSION}", :development)]
end
jar.apply(config)
- file_list(/rake-#{RAKEVERSION}/).should be_empty
+ file_list(/rake-#{Rake::VERSION}/).should be_empty
end
it "warns about using Merb < 1.0" do
diff --git a/warbler.gemspec b/warbler.gemspec
index 97ba3578..90cc61c1 100644
--- a/warbler.gemspec
+++ b/warbler.gemspec
@@ -22,13 +22,12 @@ bundle up all of your application files for deployment to a Java environment.}
gem.rdoc_options = ["--main", "README.rdoc", "-H", "-f", "darkfish"]
- gem.add_runtime_dependency 'rake', [">= 0.9.6"]
+ gem.add_runtime_dependency 'rake', ['>= 0.9.6']
# restrict it for maven not to find jruby-9000.dev
- gem.add_runtime_dependency 'jruby-jars', [">= 1.5.6", '< 2.0']
- gem.add_runtime_dependency 'jruby-rack', [">= 1.1.1", '< 1.3']
- gem.add_runtime_dependency 'rubyzip', [">= 0.9", "< 1.3"]
- gem.add_development_dependency 'jbundler', "~> 0.5.5"
- gem.add_development_dependency 'ruby-maven', '~> 3.1.1.0'
- gem.add_development_dependency 'rspec', "~> 2.10"
- gem.add_development_dependency 'rdoc', ">= 2.4.2"
+ gem.add_runtime_dependency 'jruby-jars', ['>= 1.5.6', '< 2.0']
+ gem.add_runtime_dependency 'jruby-rack', ['>= 1.1.1', '< 1.3']
+ gem.add_runtime_dependency 'rubyzip', ['>= 0.9', "< 1.3"]
+ gem.add_development_dependency 'jbundler', '~> 0.5.5'
+ gem.add_development_dependency 'ruby-maven', '~> 3.1.1'
+ gem.add_development_dependency 'rspec', '~> 2.10'
end