lib/jbundler/executable.rb in jbundler-0.5.3 vs lib/jbundler/executable.rb in jbundler-0.5.4
- old
+ new
@@ -1,43 +1,42 @@
-require 'maven/tools/jarfile'
-require 'maven/tools/dsl'
require 'maven/ruby/maven'
require 'fileutils'
-require 'jbundler/executable_pom'
module JBundler
class Executable
class Filter
def initialize(a)
@a = a
end
def method_missing(m, *args, &b)
args[ 0 ].sub!(/^.* - /, '' )
- args[ 0 ] = 'asd'
@a.send(m,*args, &b)
end
end
- BOOTSTRAP = 'jar-bootstrap.rb'
-
- include Maven::Tools::DSL
-
def initialize( bootstrap, config, compile, verbose, *groups )
raise "file not found: #{bootstrap}" unless File.exists?( bootstrap )
- @pom = ExecutablePom.new( bootstrap, config, compile, verbose, *groups )
+ @config = Configurator.new( config )
+ @config.bootstrap = bootstrap
+ @config.compile = compile
+ @config.verbose = verbose
+ @config.groups = groups.join( ',' )
end
def packit
- m = Maven::Ruby::Maven.new( @pom.project, '.executable.pom.xml' )
- m.verbose = @verbose
- m.package
+ m = Maven::Ruby::Maven.new
+ m.options[ '-f' ] = File.join( File.dirname( __FILE__ ),
+ 'executable_pom.rb' )
+ @config.configure( m )
+ m.verbose = @config.verbose
+ m.package( '-P', @config.compile ? :compile : :no_compile )
- FileUtils.rm_f( 'dependency-reduced-pom.xml' )
+ #FileUtils.rm_f( 'dependency-reduced-pom.xml' )
puts
puts 'now you can execute your jar like this'
puts
- puts "\tjava -jar #{@pom.work_dir}/#{@pom.project.artifact_id}.jar"
+ puts "\tjava -jar #{@config.work_dir}/executable/*.jar"
puts
end
end
end