Class: JBundler::Tree

Inherits:
Object
  • Object
show all
Includes:
Maven::Tools::DSL
Defined in:
lib/jbundler/tree.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Tree

Returns a new instance of Tree.



12
13
14
# File 'lib/jbundler/tree.rb', line 12

def initialize( config )
  @config = Configurator.new( config )
end

Instance Method Details

#show_it(debug = false) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jbundler/tree.rb', line 16

def show_it( debug = false )
  m = Maven::Ruby::Maven.new
  m.options[ '-f' ] = File.join( File.dirname( __FILE__ ), 'tree_pom.rb' )
  @config.configure( m )

  unless debug
    # silence the output
    old = java.lang.System.err
    java.lang.System.err = java.io.PrintStream.new( java.io.ByteArrayOutputStream.new )
  end

  m.exec( 'org.apache.maven.plugins:maven-dependency-plugin:2.8:tree' )

  puts File.read( File.join( File.expand_path( @config.work_dir ), 
                             'tree.txt' ) )
  
ensure
  java.lang.System.err = old if old
end