<commit_before>load File.expand_path(File.join( File.dirname( __FILE__ ), 'setup.rb'))
require 'jbundler/tree'
require 'jbundler/config'
require 'stringio'

describe JBundler::Tree do

  it 'should show dependency tree' do
    skip 'rvm is not working properly' if ENV[ 'rvm_version' ]
    dir = File.join( File.dirname( __FILE__ ), 'tree' )
    java.lang.System.set_property( 'user.dir', dir )
    FileUtils.cd( dir ) do
      exec = JBundler::Tree.new( JBundler::Config.new )
      output = StringIO.new
      $stdout = output
      exec.show_it( true )
      $stdout = STDOUT
      lines = output.string.split( /\n/ )
      lines = lines.select do |line|
        line =~ /:.+:.+:.+:/
      end
      lines.join( "\n" ).must_equal File.read( 'ref.txt' ).strip
    end

  end

end
<commit_msg>run tree_spec not with maven - i.e. when jruby.script property is missing<commit_after>load File.expand_path(File.join( File.dirname( __FILE__ ), 'setup.rb'))
require 'jbundler/tree'
require 'jbundler/config'
require 'stringio'

describe JBundler::Tree do

  it 'should show dependency tree' do

    skip 'that spec does not execute properly with maven' if java.lang.System.get_property( 'jruby.script' ) == nil

    skip 'rvm is not working properly' if ENV[ 'rvm_version' ]

    dir = File.join( File.dirname( __FILE__ ), 'tree' )
    java.lang.System.set_property( 'user.dir', dir )
    FileUtils.cd( dir ) do
      exec = JBundler::Tree.new( JBundler::Config.new )
      output = StringIO.new
      $stdout = output
      exec.show_it( true )
      $stdout = STDOUT
      lines = output.string.split( /\n/ )
      lines = lines.select do |line|
        line =~ /:.+:.+:.+:/
      end
      lines.join( "\n" ).must_equal File.read( 'ref.txt' ).strip
    end

  end

end

FileUtils.rm_rf( File.join( File.expand_path( __FILE__ ).sub( /_spec.rb/, '' ), 'target' ) )

{'fraction_non_alphanumeric': 0.14239656098871575, 'fraction_numerical': 0.0, 'mean_word_length': 2.8550724637681157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5897273', 'n_tokens_mistral': 666, 'n_tokens_neox': 644, 'n_words': 168}