class Warbler::Traits::JBundler

The JBundler trait uses JBundler to determine jar dependencies to be added to the project.

Public Class Methods

detect?() click to toggle source
# File lib/warbler/traits/jbundler.rb, line 16
def self.detect?
  File.exist?(ENV['JBUNDLE_JARFILE'] || "Jarfile")
end
requirements() click to toggle source
# File lib/warbler/traits/jbundler.rb, line 20
def self.requirements
  [ Traits::War, Traits::Jar ]
end

Public Instance Methods

add_jbundler_jars() click to toggle source
# File lib/warbler/traits/jbundler.rb, line 32
def add_jbundler_jars
  require 'jbundler/config'
  classpath = ::JBundler::Config.new.classpath_file
  if File.exists?( classpath )
    require File.expand_path( classpath )
  else
    raise 'jbundler support needs jruby to create a local config: jruby -S jbundle install'
  end
  # use only the jars from jbundler and jruby
  config.java_libs += jruby_jars
  config.java_libs += JBUNDLER_CLASSPATH
  config.java_libs.uniq! {|lib| lib.split(File::SEPARATOR).last }
  config.init_contents << "#{config.warbler_templates}/jbundler.erb"
end
after_configure() click to toggle source
# File lib/warbler/traits/jbundler.rb, line 28
def after_configure
  add_jbundler_jars if config.jbundler
end
before_configure() click to toggle source
# File lib/warbler/traits/jbundler.rb, line 24
def before_configure
  config.jbundler = true
end