devcreek 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,3 +2,7 @@
2
2
 
3
3
  * Beta Release
4
4
  * Initial release of DevCreek Ruby gem. Support for Test::Unit framework.
5
+
6
+ == 0.2 / 2007-12-07
7
+
8
+ * Small change to the documentation. Add logging functionality.
data/README.txt CHANGED
@@ -50,7 +50,7 @@
50
50
  DevCreek::Core.instance().load(
51
51
  :user => 'your_devcreek_username',
52
52
  :password => 'your_devcreek_password',
53
- :project => 'your_devcreek_project'
53
+ :project => 'your_devcreek_project',
54
54
  :enabled => true
55
55
  )
56
56
  --------
@@ -5,6 +5,11 @@
5
5
  # Licensed under the LGPL, see the file README.txt in the distribution
6
6
 
7
7
  require 'devcreek_testrunnermediator.rb' #for test/unit library
8
+ require 'logger'
9
+
10
+ $DEV_CREEK_LOG = Logger.new($stderr)
11
+ $DEV_CREEK_LOG.level = Logger::INFO
12
+
8
13
  module DevCreek
9
- VERSION = "0.1"
14
+ VERSION = "0.2"
10
15
  end
@@ -15,17 +15,9 @@ require 'rubygems'
15
15
  require 'uuidtools'
16
16
  require 'test/unit/ui/testrunnermediator'
17
17
 
18
- #class Test::Unit::TestCase
19
- # alias_method :old_run, :run
20
- # def run(*args)
21
- # puts "TestCase.run.start #{name}"
22
- ## result = old_run(*args, &block)
23
- # puts "TestCase.run.start #{name}"
24
- # end
25
- #end
26
-
27
18
  class Test::Unit::UI::TestRunnerMediator
28
19
  alias_method :old_initialize, :initialize
20
+
29
21
  def initialize(*args)
30
22
  result = old_initialize(*args)
31
23
 
@@ -34,16 +26,19 @@ class Test::Unit::UI::TestRunnerMediator
34
26
  @@dev_creek_reg = /([\w]*)\(([\w]*)\)/
35
27
 
36
28
  add_listener(Test::Unit::UI::TestRunnerMediator::STARTED) do |test_result|
29
+ $DEV_CREEK_LOG.debug "Test::Unit::TestRunnerMediator::STARTED: #{test_result}"
37
30
  @@dev_creek_test_suite = DevCreek::TestSuite.new("Test::Unit")
38
31
  end
39
32
 
40
33
  add_listener(Test::Unit::TestCase::STARTED) do |name|
34
+ $DEV_CREEK_LOG.debug "Test::Unit::TestCase::STARTED: #{name}"
41
35
  test_name = name.match(@@dev_creek_reg)[1]
42
36
  test_class = name.match(@@dev_creek_reg)[2]
43
37
  @@dev_creek_test_suite.test_results[name] = DevCreek::TestResult.new(test_name, test_class)
44
38
  end
45
39
 
46
40
  add_listener(Test::Unit::TestResult::FAULT) do |fault|
41
+ $DEV_CREEK_LOG.debug "Test::Unit::TestResult::FAULT: #{fault}"
47
42
  dc_test_result = @@dev_creek_test_suite.test_results[fault.test_name]
48
43
  if fault.instance_of? Test::Unit::Failure
49
44
  dc_test_result.has_a_failure
@@ -53,6 +48,7 @@ class Test::Unit::UI::TestRunnerMediator
53
48
  end
54
49
 
55
50
  add_listener(Test::Unit::TestCase::FINISHED) do |test_name|
51
+ $DEV_CREEK_LOG.debug "Test::Unit::TestCase::FINISHED: #{test_name}"
56
52
  @@dev_creek_test_suite.test_results[test_name].has_finished
57
53
  end
58
54
 
@@ -62,14 +58,14 @@ class Test::Unit::UI::TestRunnerMediator
62
58
  if @@dev_creek_test_suite.has_test_results?
63
59
  session_id = UUID.timestamp_create().to_s
64
60
  xml_data = @@dev_creek_test_suite.to_xml(session_id)
65
- puts xml_data
66
- p 'Attempting DevCreek transmission...'
61
+ $DEV_CREEK_LOG.debug "Submitting body: \n #{xml_data}"
62
+ $DEV_CREEK_LOG.info "Attempting DevCreek transmission..."
67
63
  response = DevCreek::Transmitter.submit(session_id, xml_data)
68
64
  case response
69
65
  when Net::HTTPSuccess
70
- puts '...transmission successful.'
66
+ $DEV_CREEK_LOG.info "...transmission successful."
71
67
  else
72
- puts "...failure transmiting TestUnit results to DevCreek: ${response.error!}"
68
+ $DEV_CREEK_LOG.error "...failure transmiting TestUnit results to DevCreek - HTTPResponse with Code # #{response.code}, HTTPResponse message \"#{response.message}\""
73
69
  end
74
70
  end
75
71
  end
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: devcreek
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.1"
7
- date: 2007-12-06 00:00:00 -05:00
6
+ version: "0.2"
7
+ date: 2007-12-07 00:00:00 -05:00
8
8
  summary: The DevCreek gem enables programmers to collect and transmit metrics from their Ruby test framework to a DevCreek server.
9
9
  require_paths:
10
10
  - lib
11
11
  email: caleb.powell@gmail.com
12
12
  homepage: http://rubyforge.org/projects/devcreek/
13
13
  rubyforge_project: devcreek
14
- description: "The DevCreek gem enables programmers to collect and transmit metrics from their Ruby Test::Unit test suites to a DevCreek server. Please visit the DevCreek site (http://devcreek.com/index.html/) for more info. == FEATURES/PROBLEMS: Test::Unit is the currently the only supported framework. Rspec support is on it's way ;-) == SYNOPSIS: The DevCreek Ruby Gem is library that, when loaded, will automatically listen to and collect metrics from your Test::Unit unit tests. All you have to do is load the DevCreek library in your code and give it your DevCreek account info so that it can transmit the metrics to the server. Here is the simplest example of how to load DevCreek: -------- #Load the devcreek gem require 'rubygems' require 'devcreek' #set your account info DevCreek::Core.instance().load_from_yaml(\"#{ENV['HOME']}/.yoursettingsfile.devcreek.yml\") -------- There are two ways to provide DevCreek with your account settings. The first (as shown above) is to point DevCreek to a settings file. The 'enabled' attribute tells devcreek whether or not it should actually transmit the metrics that it collects. The yaml file would like this: -------- user: your_devcreek_username password: your_devcreek_password project: your_devcreek_project enabled: true -------- The other way to provide DevCreek with your settings is via a hash. So, instead of loading a yaml file, you could do this: -------- #Load the devcreek gem require 'rubygems' require 'devcreek' #set your account info DevCreek::Core.instance().load( :user => 'your_devcreek_username', :password => 'your_devcreek_password', :project => 'your_devcreek_project' :enabled => true ) -------- The first method is preferrable because it allows you to keep your account settings outside of your project (and therefore your source control tool). If you only have 1 test file, you can place the code to load devcreek in the test file and your done. However, most projects will have many test files. In this case, you need to make sure that the Ruby interpreter loads devcreek before running the test classes. This can be done via the Ruby '-r' option. For example, assuming your code to load devcreek is in a file called foo.rb, you would run your tests from the command line like this: ruby -r foo.rb test/test_* If you run your tests from a Rakefile, then you need to tell rake to include the -r option when it runs the tests (rake runs it's tests in a separate Ruby process). You can do this pretty easily in your Rakefile, like so; -------- require 'rake/testtask' Rake::TestTask.new('all_tests') do |t| t.ruby_opts = ['-r foo.rb'] t.test_files = ['test/test_*.rb'] end -------- == REQUIREMENTS:"
14
+ description: "The DevCreek gem enables programmers to collect and transmit metrics from their Ruby Test::Unit test suites to a DevCreek server. Please visit the DevCreek site (http://devcreek.com/index.html/) for more info. == FEATURES/PROBLEMS: Test::Unit is the currently the only supported framework. Rspec support is on it's way ;-) == SYNOPSIS: The DevCreek Ruby Gem is library that, when loaded, will automatically listen to and collect metrics from your Test::Unit unit tests. All you have to do is load the DevCreek library in your code and give it your DevCreek account info so that it can transmit the metrics to the server. Here is the simplest example of how to load DevCreek: -------- #Load the devcreek gem require 'rubygems' require 'devcreek' #set your account info DevCreek::Core.instance().load_from_yaml(\"#{ENV['HOME']}/.yoursettingsfile.devcreek.yml\") -------- There are two ways to provide DevCreek with your account settings. The first (as shown above) is to point DevCreek to a settings file. The 'enabled' attribute tells devcreek whether or not it should actually transmit the metrics that it collects. The yaml file would like this: -------- user: your_devcreek_username password: your_devcreek_password project: your_devcreek_project enabled: true -------- The other way to provide DevCreek with your settings is via a hash. So, instead of loading a yaml file, you could do this: -------- #Load the devcreek gem require 'rubygems' require 'devcreek' #set your account info DevCreek::Core.instance().load( :user => 'your_devcreek_username', :password => 'your_devcreek_password', :project => 'your_devcreek_project', :enabled => true ) -------- The first method is preferrable because it allows you to keep your account settings outside of your project (and therefore your source control tool). If you only have 1 test file, you can place the code to load devcreek in the test file and your done. However, most projects will have many test files. In this case, you need to make sure that the Ruby interpreter loads devcreek before running the test classes. This can be done via the Ruby '-r' option. For example, assuming your code to load devcreek is in a file called foo.rb, you would run your tests from the command line like this: ruby -r foo.rb test/test_* If you run your tests from a Rakefile, then you need to tell rake to include the -r option when it runs the tests (rake runs it's tests in a separate Ruby process). You can do this pretty easily in your Rakefile, like so; -------- require 'rake/testtask' Rake::TestTask.new('all_tests') do |t| t.ruby_opts = ['-r foo.rb'] t.test_files = ['test/test_*.rb'] end -------- == REQUIREMENTS:"
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin