Added: dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/JRubyBased.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/JRubyBased.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/JRubyBased.html Wed May 9 23:46:39 2018 @@ -0,0 +1,670 @@ + + + + + + +module Buildr::TestFramework::JRubyBased - buildr + + + + + + + + + + + + + + +
+

+ module Buildr::TestFramework::JRubyBased +

+ +
+ +
+ + + + +
+ + + + + +
+
+

Constants

+
+
+ +
VERSION + +
+ + +
+
+ + + + + +
+
+

Public Class Methods

+
+ + +
+ +
+ dependencies() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 57
+def dependencies
+  unless @dependencies
+    @dependencies = [jruby_artifact]
+  end
+  @dependencies
+end
+
+ +
+ + + + +
+ + +
+ +
+ included(mod) + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + +
+ + + +
+
# File lib/buildr/java/bdd.rb, line 64
+def included(mod)
+  mod.extend ClassMethods
+  super
+end
+
+ +
+ + + + +
+ + +
+ +
+ jruby_artifact() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 53
+def jruby_artifact
+  "org.jruby:jruby-complete:jar:#{version}"
+end
+
+ +
+ + + + +
+ + +
+ +
+ version() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 49
+def version
+  Buildr.settings.build['jruby'] || VERSION
+end
+
+ +
+ + + + +
+ + +
+ +
+
+

Public Instance Methods

+
+ + +
+ +
+ jruby_home() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 117
+def jruby_home
+  @jruby_home ||= RUBY_PLATFORM =~ /java/ ? RbConfig::CONFIG['prefix'] :
+    ( ENV['JRUBY_HOME'] || File.expand_path('~/.jruby') )
+end
+
+ +
+ + + + +
+ + +
+ +
+ jruby_installed?() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 122
+def jruby_installed?
+  !Dir.glob(File.join(jruby_home, 'lib', 'jruby*.jar')).empty?
+end
+
+ +
+ + + + +
+ + +
+ +
+ run(tests, dependencies) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 82
+def run(tests, dependencies)
+  maybe_install_jruby
+  dependencies |= [task.compile.target.to_s]
+
+  spec_dir = task.project.path_to(:source, :spec, :ruby)
+  report_dir = task.report_to.to_s
+  rm_rf report_dir
+  mkdir_p report_dir
+  ENV['CI_REPORTS'] = report_dir
+
+  runner = runner_config
+  runner.content = runner_content(binding)
+
+  Buildr.write(runner.file, runner.content)
+  rm_f runner.result
+
+  if RUBY_PLATFORM[/java/] && !options.fork
+    runtime = new_runtime
+    runtime.getObject.java.lang.System.getProperties().putAll(options[:properties] || {})
+    runtime.getLoadService.require runner.file
+  else
+    cmd_options = task.options.only(:properties, :java_args)
+    cmd_options.update(:classpath => dependencies, :project => task.project)
+    jruby runner.file, tests, cmd_options rescue nil
+  end
+
+  fail "Missing result YAML file: #{runner.result}" unless File.exist? runner.result
+
+  result = YAML.load(File.read(runner.result))
+  if Exception === result
+    raise [result.message, result.backtrace].flatten.join("\n")
+  end
+  tests - result.failed
+end
+
+ +
+ + + + +
+ + +
+ +
+
+

Protected Instance Methods

+
+ + +
+ +
+ jruby(*args) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 139
+def jruby(*args)
+  java_args = ['org.jruby.Main', *args]
+  java_args << {} unless Hash === args.last
+  cmd_options = java_args.last
+  project = cmd_options.delete(:project)
+  cmd_options[:classpath] ||= []
+  if jruby_home && jruby_home != ''
+    Dir.glob(File.join(jruby_home, 'lib', '*.jar')) { |jar| cmd_options[:classpath] << jar }
+    cmd_options[:properties]['jruby.home'] = jruby_home
+  end
+  cmd_options[:java_args] ||= []
+  cmd_options[:java_args] << '-Xmx512m' unless cmd_options[:java_args].detect {|a| a =~ /^-Xmx/}
+  cmd_options[:properties] ||= {}
+  Java::Commands.java(*java_args)
+end
+
+ +
+ + + + +
+ + +
+ +
+ jruby_gem() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 164
+def jruby_gem
+  %Q{
+   require 'jruby'
+   def JRuby.gem(name, version = '>0', *args)
+      require 'rbconfig'
+      jruby_home = RbConfig::CONFIG['prefix']
+      expected_version = '#{TestFramework::JRubyBased.version}'
+      unless JRUBY_VERSION >= expected_version
+        fail "Expected JRuby version \#{expected_version} installed at \#{jruby_home} but got \#{JRUBY_VERSION}"
+      end
+      require 'rubygems'
+      begin
+        Kernel.send :gem, name, version
+      rescue LoadError, Gem::LoadError => e
+        require 'rubygems/gem_runner'
+        args = ['install', name, '--version', version] + args
+        Gem::GemRunner.new.run(args)
+        Kernel.send :gem, name, version
+      end
+   end
+  }
+end
+
+ +
+ + + + +
+ + +
+ +
+ maybe_install_jruby() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 127
+def maybe_install_jruby
+  unless jruby_installed?
+    jruby_artifact = Buildr.artifact(TestFramework::JRubyBased.jruby_artifact)
+    msg = "JRUBY_HOME is not correctly set or points to an invalid JRuby installation: #{jruby_home}"
+    puts msg
+    puts ''
+    puts "You need to install JRuby version #{jruby_artifact.version} using your system package manager."
+
+    fail msg unless jruby_installed?
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_runtime(cfg = {}) { |config| ... } + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 155
+def new_runtime(cfg = {})
+  config = Java.org.jruby.RubyInstanceConfig.new
+  cfg.each_pair do |name, value|
+    config.send("#{name}=", value)
+  end
+  yield config if block_given?
+  Java.org.jruby.Ruby.newInstance config
+end
+
+ +
+ + + + +
+ + +
+ +
+ runner_config(runner = OpenStruct.new) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/bdd.rb, line 187
+def runner_config(runner = OpenStruct.new)
+  [:requires, :gems, :output, :format].each do |key|
+    runner.send("#{key}=", options[key])
+  end
+  runner.html_report ||= File.join(task.report_to.to_s, 'report.html')
+  runner.result ||= task.project.path_to(:target, :spec, 'result.yaml')
+  runner.file ||= task.project.path_to(:target, :spec, 'runner.rb')
+  runner.requires ||= []
+  runner.requires.unshift File.join(File.dirname(__FILE__), 'test_result')
+  runner.gems ||= {}
+  runner.rspec ||= %w(--format progress --format documentation)
+  runner.format.each { |format| runner.rspec << '--format' << format } if runner.format
+  runner.rspec.push '--format', "Buildr::TestFramework::TestResult::YamlFormatter"
+  runner.rspec.push '-o', runner.result
+  runner
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/JRubyBased/ClassMethods.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/JRubyBased/ClassMethods.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/JRubyBased/ClassMethods.html Wed May 9 23:46:39 2018 @@ -0,0 +1,157 @@ + + + + + + +module Buildr::TestFramework::JRubyBased::ClassMethods - buildr + + + + + + + + + + + + + + +
+

+ module Buildr::TestFramework::JRubyBased::ClassMethods +

+ +
+ +
+ + + + +
+ + + + + + + + + +
+
+

Public Instance Methods

+
+ + +
+ +
+ dependencies() + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + +
+ + + +
+
# File lib/buildr/java/bdd.rb, line 71
+def dependencies
+  unless @dependencies
+    super
+    if !RUBY_PLATFORM[/java/] && !TestFramework::JRubyBased.jruby_installed?
+      @dependencies |= TestFramework::JRubyBased.dependencies
+    end
+  end
+  @dependencies
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/Java.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/Java.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/Java.html Wed May 9 23:46:39 2018 @@ -0,0 +1,163 @@ + + + + + + +class Buildr::TestFramework::Java - buildr + + + + + + + + + + + + + + +
+

+ class Buildr::TestFramework::Java +

+ +
+ +
+ + + + +
+ + + + + + + + + +
+
+

Public Class Methods

+
+ + +
+ +
+ dependencies() + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + Buildr::TestFramework::Base.dependencies +
+ + + +
+
# File lib/buildr/java/tests.rb, line 27
+def dependencies
+  unless @dependencies
+    super
+    # Add buildr utility classes (e.g. JavaTestFilter)
+    @dependencies |= [ File.join(File.dirname(__FILE__)) ]
+  end
+  @dependencies
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/TestResult.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/TestResult.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/TestResult.html Wed May 9 23:46:39 2018 @@ -0,0 +1,190 @@ + + + + + + +class Buildr::TestFramework::TestResult - buildr + + + + + + + + + + + + + + +
+

+ class Buildr::TestFramework::TestResult +

+ +
+ +

A class used by buildr for jruby based frameworks, so that buildr can know +which tests succeeded/failed.

+ +
+ + + + +
+ + + + + + + +
+
+

Attributes

+
+ + +
+
+ failed[RW] +
+ +
+ + + +
+
+ +
+
+ succeeded[RW] +
+ +
+ + + +
+
+ +
+ + + +
+
+

Public Class Methods

+
+ + +
+ +
+ new() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/test_result.rb, line 50
+def initialize
+  @failed, @succeeded = [], []
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/TestResult/Error.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/TestResult/Error.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/TestResult/Error.html Wed May 9 23:46:39 2018 @@ -0,0 +1,264 @@ + + + + + + +class Buildr::TestFramework::TestResult::Error - buildr + + + + + + + + + + + + + + +
+

+ class Buildr::TestFramework::TestResult::Error +

+ +
+ +
+ + + + +
+ + + + + + + +
+
+

Attributes

+
+ + +
+
+ backtrace[R] +
+ +
+ + + +
+
+ +
+
+ message[R] +
+ +
+ + + +
+
+ +
+ + + +
+
+

Public Class Methods

+
+ + +
+ +
+ dump_yaml(file, e) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/test_result.rb, line 34
+def self.dump_yaml(file, e)
+  FileUtils.mkdir_p File.dirname(file)
+  File.open(file, 'w') { |f| f.puts(YAML.dump(Error.new(e.message, e.backtrace))) }
+end
+
+ +
+ + + + +
+ + +
+ +
+ guard(file) { || ... } + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/test_result.rb, line 39
+def self.guard(file)
+  begin
+    yield
+  rescue => e
+    dump_yaml(file, e)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ new(message, backtrace) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/test_result.rb, line 28
+def initialize(message, backtrace)
+  @message = message
+  @backtrace = backtrace
+  set_backtrace backtrace
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/TestResult/YamlFormatter.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/TestResult/YamlFormatter.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/TestFramework/TestResult/YamlFormatter.html Wed May 9 23:46:39 2018 @@ -0,0 +1,398 @@ + + + + + + +class Buildr::TestFramework::TestResult::YamlFormatter - buildr + + + + + + + + + + + + + + +
+

+ class Buildr::TestFramework::TestResult::YamlFormatter +

+ +
+ +

An Rspec formatter used by buildr

+ +
+ + + + +
+ + + + + + + +
+
+

Attributes

+
+ + +
+
+ result[R] +
+ +
+ + + +
+
+ +
+ + + +
+
+

Public Class Methods

+
+ + +
+ +
+ new(output) + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + +
+ + + +
+
# File lib/buildr/java/test_result.rb, line 61
+def initialize(output)
+  super(output)
+  @result = Hash.new
+  @result[:succeeded] = []
+  @result[:failed] = []
+end
+
+ +
+ + + + +
+ + +
+ +
+
+

Public Instance Methods

+
+ + +
+ +
+ close() + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + +
+ + + +
+
# File lib/buildr/java/test_result.rb, line 88
+def close
+  super
+  result.succeeded = result.succeeded - result.failed
+  output.puts YAML.dump(result)
+end
+
+ +
+ + + + +
+ + +
+ +
+ example_failed(example) + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + +
+ + + +
+
# File lib/buildr/java/test_result.rb, line 78
+def example_failed(example)
+  super(example)
+  result.failed << example_name(example)
+end
+
+ +
+ + + + +
+ + +
+ +
+ example_passed(example) + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + +
+ + + +
+
# File lib/buildr/java/test_result.rb, line 68
+def example_passed(example)
+  super(example)
+  result.succeeded << example_name(example)
+end
+
+ +
+ + + + +
+ + +
+ +
+ example_pending(example) + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + +
+ + + +
+
# File lib/buildr/java/test_result.rb, line 73
+def example_pending(example)
+  super(example)
+  result.succeeded << example_name(example)
+end
+
+ +
+ + + + +
+ + +
+ +
+ start(example_count) + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + +
+ + + +
+
# File lib/buildr/java/test_result.rb, line 83
+def start(example_count)
+  super(example_count)
+  @result = TestResult.new
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.6/site/rdoc/Buildr/TestNG.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/TestNG.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/TestNG.html Wed May 9 23:46:39 2018 @@ -0,0 +1,219 @@ + + + + + + +class Buildr::TestNG - buildr + + + + + + + + + + + + + + +
+

+ class Buildr::TestNG +

+ +
+ +

TestNG test framework. To use in your project:

+ +
test.using :testng
+
+ +

Support the following options:

+ + +
+ + + + +
+ + + + + +
+
+

Constants

+
+
+ +
VERSION + +
+ + +
+
+ + + + + +
+
+

Public Class Methods

+
+ + +
+ +
+ dependencies() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/tests.rb, line 293
+def dependencies
+  return ["org.testng:testng:jar:jdk15:#{version}"] + JMock.dependencies if version < '6.0'
+  ["org.testng:testng:jar:#{version}",'com.beust:jcommander:jar:1.27'] + JMock.dependencies
+end
+
+ +
+ + + + +
+ + +
+ +
+ version() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/java/tests.rb, line 289
+def version
+  Buildr.settings.build['testng'] || VERSION
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + +