Class: JBundler::Executable

Inherits:
Object
  • Object
show all
Defined in:
lib/jbundler/executable.rb

Defined Under Namespace

Classes: Filter

Instance Method Summary collapse

Constructor Details

#initialize(bootstrap, config, compile, verbose, *groups) ⇒ Executable

Returns a new instance of Executable.



17
18
19
20
21
22
23
24
# File 'lib/jbundler/executable.rb', line 17

def initialize( bootstrap, config, compile, verbose, *groups )
  raise "file not found: #{bootstrap}" unless File.exists?( bootstrap )
  @config = Configurator.new( config )
  @config.bootstrap = bootstrap
  @config.compile = compile
  @config.verbose = verbose
  @config.groups = groups.join( ',' )
end

Instance Method Details

#packitObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/jbundler/executable.rb', line 26

def packit
  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 )

  puts
  puts 'now you can execute your jar like this'
  puts
  puts "\tjava -jar #{File.basename( File.expand_path( '.' ) )}_exec.jar"
  puts
end