lib/jbundler/cli.rb in jbundler-0.5.3 vs lib/jbundler/cli.rb in jbundler-0.5.4
- old
+ new
@@ -1,7 +1,7 @@
#
-# Copyright (C) 2013 Kristian Meier
+# Copyright (C) 2013 Christian Meier
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
@@ -30,12 +30,19 @@
end
def do_show
require 'java'
require 'jbundler/classpath_file'
- classpath_file = JBundler::ClasspathFile.new(config.classpath_file)
- if classpath_file.exists?
+ require 'jbundler/vendor'
+ classpath_file = JBundler::ClasspathFile.new( config.classpath_file )
+ vendor = JBundler::Vendor.new( config.vendor_dir )
+ if vendor.vendored?
+ puts "JBundler classpath:"
+ vendor.require_jars.each do |path|
+ puts " * #{path}"
+ end
+ elsif classpath_file.exists?
classpath_file.require_classpath unless defined? JBUNDLER_CLASSPATH
puts "JBundler classpath:"
JBUNDLER_CLASSPATH.each do |path|
puts " * #{path}"
end
@@ -50,11 +57,11 @@
def tree
JBundler::Tree.new( config ).show_it
end
desc 'executable', 'create an executable jar with a given bootstrap.rb file\nLIMITATION: only for jruby 1.6.x and newer'
- method_option :bootstrap, :type => :string, :aliases => '-b'#, :required => true, :desc => 'file which will be executed when the jar gets executed'
+ method_option :bootstrap, :type => :string, :aliases => '-b', :required => true, :desc => 'file which will be executed when the jar gets executed'
method_option :compile, :type => :boolean, :aliases => '-c', :default => false, :desc => 'compile the ruby files from the lib directory'
method_option :verbose, :type => :boolean, :aliases => '-v', :default => false, :desc => 'more output'
method_option :groups, :type => :array, :aliases => '-g', :desc => 'bundler groups to use for determine the gems to include in the jar file'
def executable
ex = JBundler::Executable.new( options[ 'bootstrap' ], config, options[ 'compile' ], options[ :verbose ], *( options[ 'groups' ] || [:default] ) )
@@ -65,11 +72,25 @@
def console
# dummy - never executed !!!
end
desc 'install', "first `bundle install` is called and then the jar dependencies will be installed. for more details see `bundle help install`, jbundler will ignore all options. the install command is also the default when no command is given."
+ method_option :deployment, :type => :boolean, :default => false, :desc => "copy the jars into the vendor/jars directory (or as configured). these vendored jars have preference before the classpath jars !"
+ method_option :no_deployment, :type => :boolean, :default => false, :desc => 'clears the vendored jars'
def install
require 'jbundler'
+ if options[ :no_deployment ]
+ vendor = JBundler::Vendor.new( config.vendor_dir )
+ vendor.clear
+ end
+ if options[ :deployment ]
+ vendor = JBundler::Vendor.new( config.vendor_dir )
+ if vendor.vendored?
+ raise "already vendored. please 'jbundle install --no-deployment before."
+ else
+ vendor.setup( JBundler::ClasspathFile.new( config.classpath_file ) )
+ end
+ end
do_show
puts 'Your jbundle is complete! Use `jbundle show` to see where the bundled jars are installed.'
end
desc 'update', "first `bundle update` is called and if there are no options then the jar dependencies will be updated. for more details see `bundle help update`."