bin/jbundle in jbundler-0.7.4 vs bin/jbundle in jbundler-0.8.0.pre
- old
+ new
@@ -1,70 +1,51 @@
#!/usr/bin/env ruby
-if ARGV[0] == 'help'
+require 'jbundler'
+require 'optparse'
+options = {}
+optparse = OptionParser.new do|opts|
- # ensure we use the right version
- gem 'ruby-maven', '>=3.1.0'
+ opts.banner = "Usage: jbundle [options]"
- require 'jbundler/cli'
+ opts.separator ''
+ opts.separator '* load jars: `Jars.require_jars_lock!`'
+ opts.separator '* classpath features: see `Jars::Classpath'
+ opts.separator ''
+ opts.separator 'NOTE: JBundler is not need during runtime !'
+ opts.separator ''
+ opts.separator 'Options:'
+ opts.separator ''
- JBundler::Cli.start
+ opts.on( '-v', '--verbose', 'Output more information' ) do |t|
+ options[:verbose] = t
+ end
-else
+ opts.on( '-d', '--debug', 'Output debug information' ) do |t|
+ options[:debug] = t
+ end
- if ARGV == [] || ARGV.all?{ |a| a.match( /^-/ ) }
- ARGV.unshift 'install'
+ opts.on( '-f', '--force', 'Force creation of Jars.lock' ) do |t|
+ options[:force] = t
end
- if ARGV[0] == 'console'
- # ensure we use the right version
- gem 'ruby-maven', '>=3.1.0'
+ opts.on( '-t', '--tree', 'Show dependency tree' ) do |t|
+ options[:tree] = t
+ end
- require 'irb'
- require 'jbundler'
- require 'jbundler/lazy'
- include JBundler::Lazy
+ opts.on( '-u', '--update JAR_COORDINATE', 'Resolves given dependency and use latest version' ) do |u|
+ options[:update] = u
+ end
- ARGV.shift
- require 'jbundler'
- if defined? JBUNDLER_CLASSPATH
- warn 'Jarfile dependencies loaded'
- else
- warn 'Could not locate a Jarfile'
- end
-
- IRB.start
-
- else
- if ['lock_down', 'install', 'update', 'show'].member?( ARGV[0] )
-
- is_lock_down = ARGV.delete( 'lock_down' )
- is_vendor = ARGV.delete( '--vendor' )
- is_debug = ARGV.delete( '--debug' )
- ARGV.delete( '--skip-vendor' )
- ARGV.delete( '--skip-debug' )
- ARGV.delete( '--skip-verbose' )
-
- # HACK get the module-class hierachy in place
- gem 'bundler'
- if Gem.loaded_specs['bundler'].version >= Gem::Version.new('1.9.0')
- module Bundler
- class Thor
- module Actions
- end
- end
- end
- end
- load Gem.bin_path('bundler', 'bundle')
-
- ARGV.insert( 0, 'lock_down' ) if is_lock_down
- ARGV.insert( 1, '--debug' ) if is_debug
- ARGV.insert( 1, '--vendor' ) if is_vendor
- end
-
- # ensure we use the right version
- gem 'ruby-maven', '>=3.1.0'
-
- require 'jbundler/cli'
- JBundler::Cli.start
+ opts.on( '--vendor-dir DIRECTORY', 'Vendor directory where to copy the installed jars.', 'add this directory to $LOAD_PATH or set JARS_HOME respectively.' ) do |dir|
+ options[:vendor_dir] = dir
end
+ opts.on( '-h', '--help', 'Display this screen' ) do
+ puts opts
+ exit
+ end
end
+optparse.parse!
+
+require 'jbundler/executor'
+mvn = JBundler::Executor.new( options[:debug], options[:verbose] )
+mvn.lock_down( options )