Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup, gemspec modification for new 1.9 hotness, and a little reorg…

…anization
  • Loading branch information...
commit 2125f7f0b634ebd67e0c6ff7f36a6196af826683 1 parent d7b1698
Aaron Bedra authored
View
123 Rakefile
@@ -17,8 +17,7 @@ require 'rake/clean'
ENV["RCOVPATH"] = "bin/rcov"
# The following task is largely equivalent to:
-# Rcov::RcovTask.new
-# (really!)
+# Rcov::RcovTask.new
desc "Create a cross-referenced code coverage report."
Rcov::RcovTask.new do |t|
t.test_files = FileList['test/*_test.rb']
@@ -74,122 +73,24 @@ end
desc "Run the unit tests"
task :test => [:test_rcovrt]
-#, :test_pure_ruby] disabled since 1.8.5 broke them
+
+desc "install by setup.rb"
+task :install do
+ sh "sudo ruby setup.rb install"
+end
+
+task :default => :test
desc "Generate rdoc documentation for the rcov library"
Rake::RDocTask.new("rdoc") { |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = "rcov"
rdoc.options << "--line-numbers" << "--inline-source"
- rdoc.rdoc_files.include('readme_for_api')
- rdoc.rdoc_files.include('readme_for_rake')
- rdoc.rdoc_files.include('readme_for_rant')
- rdoc.rdoc_files.include('readme_for_vim')
+ rdoc.rdoc_files.include('doc/readme_for_api')
+ rdoc.rdoc_files.include('doc/readme_for_rake')
+ rdoc.rdoc_files.include('doc/readme_for_rant')
+ rdoc.rdoc_files.include('doc/readme_for_vim')
rdoc.rdoc_files.include('lib/**/*.rb')
}
-task :default => :test
-
-desc "install by setup.rb"
-task :install do
- sh "sudo ruby setup.rb install"
-end
-
-
-PKG_FILES = ["bin/rcov", "lib/rcov.rb", "lib/rcov/lowlevel.rb", "lib/rcov/xx.rb", "lib/rcov/version.rb", "lib/rcov/rant.rb", "lib/rcov/report.rb", "lib/rcov/rcovtask.rb", "ext/rcovrt/extconf.rb", "ext/rcovrt/rcovrt.c", "ext/rcovrt/callsite.c", "LEGAL", "LICENSE", "Rakefile", "Rantfile", "readme_for_rake", "readme_for_rant", "readme_for_vim", "readme_for_emacs", "readme_for_vim", "readme_for_api", "THANKS", "test/functional_test.rb", "test/file_statistics_test.rb", "test/assets/sample_03.rb", "test/assets/sample_05-new.rb", "test/code_coverage_analyzer_test.rb", "test/assets/sample_04.rb", "test/assets/sample_02.rb", "test/assets/sample_05-old.rb", "test/assets/sample_01.rb", "test/turn_off_rcovrt.rb", "test/call_site_analyzer_test.rb", "test/assets/sample_05.rb", "rcov.vim", "rcov.el", "setup.rb", "BLURB", "CHANGES"]
-
-# gem management tasks Use these to build the java code before creating the gem package
-# this code can also be used to generate the MRI gem. But I left the gemspec file in too.
-spec = Gem::Specification.new do |s|
- s.name = %q{rcov}
- s.version = Rcov::VERSION
-
- s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version=
- s.authors = ["Mauricio Fernandez"]
- s.cert_chain = nil
- s.date = %q{2007-11-21}
- s.default_executable = %q{rcov}
- s.description = %q{rcov is a code coverage tool for Ruby. It is commonly used for viewing overall test unit coverage of target code. It features fast execution (20-300 times faster than previous tools), multiple analysis modes, XHTML and several kinds of text reports, easy automation with Rake via a RcovTask, fairly accurate coverage information through code linkage inference using simple heuristics, colorblind-friendliness...}
- s.email = %q{mfp@acm.org}
- s.executables = ["rcov"]
- s.extensions = ["ext/rcovrt/extconf.rb"]
- s.platform = Gem::Platform::RUBY
- s.extra_rdoc_files = ["readme_for_api", "readme_for_rake", "readme_for_rant", "readme_for_vim"]
- s.files = PKG_FILES
- s.has_rdoc = true
- s.homepage = %q{http://eigenclass.org/hiki.rb?rcov}
- s.rdoc_options = ["--main", "readme_for_api", "--title", "rcov code coverage tool"]
- s.require_paths = ["lib"]
- s.required_ruby_version = Gem::Requirement.new("> 0.0.0")
- s.rubygems_version = %q{1.2.0}
- s.summary = %q{Code coverage analysis tool for Ruby}
- s.test_files = ["test/functional_test.rb", "test/file_statistics_test.rb", "test/code_coverage_analyzer_test.rb", "test/call_site_analyzer_test.rb"]
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 1
-
- if current_version >= 3 then
- else
- end
- else
- end
-end
-
-# tasks added in to support generating the JRuby gem.
-if RUBY_PLATFORM == 'java'
- spec.platform = "jruby"
- spec.extensions = []
- # add the jruby extension to the file list
- PKG_FILES << "lib/rcovrt.jar"
-
- def java_classpath_arg
- begin
- require 'java'
- classpath = java.lang.System.getProperty('java.class.path')
- rescue LoadError
- end
-
- if classpath.empty?
- classpath = FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
- end
-
- classpath ? "-cp #{classpath}" : ""
- end
-
-
- CLEAN.include ["ext/java/classes", "lib/rcovrt.jar", "pkg"]
-
- def compile_java
- mkdir_p "ext/java/classes"
- sh "javac -g -target 1.5 -source 1.5 -d ext/java/classes #{java_classpath_arg} #{FileList['ext/java/src/**/*.java'].join(' ')}"
- end
-
- def make_jar
- require 'fileutils'
- lib = File.join(File.dirname(__FILE__), 'lib')
- FileUtils.mkdir(lib) unless File.exists? lib
- sh "jar cf lib/rcovrt.jar -C ext/java/classes/ ."
- end
-
- file 'lib/rcovrt.jar' => FileList["ext/java/src/*.java"] do
- compile_java
- make_jar
- end
-
- desc "compile the java extension and put it into the lib directory"
- task :java_compile => ["lib/rcovrt.jar"]
-
-end
-
-Rake::GemPackageTask.new(spec) do |p|
- p.need_tar = true
- p.gem_spec = spec
-end
-
-# extend the gem task to include the java_compile
-if RUBY_PLATFORM == 'java'
- Rake::Task["pkg"].enhance(["java_compile"])
-end
-
# vim: set sw=2 ft=ruby:
View
0  readme_for_api → doc/readme_for_api
File renamed without changes
View
0  readme_for_emacs → doc/readme_for_emacs
File renamed without changes
View
0  readme_for_rake → doc/readme_for_rake
File renamed without changes
View
0  readme_for_rant → doc/readme_for_rant
File renamed without changes
View
0  readme_for_vim → doc/readme_for_vim
File renamed without changes
View
0  rcov.el → editor-extensions/rcov.el
File renamed without changes
View
0  rcov.vim → editor-extensions/rcov.vim
File renamed without changes
View
14 rcov.gemspec
@@ -1,20 +1,22 @@
+PKG_FILES = ["bin/rcov", "lib/rcov.rb", "lib/rcov/lowlevel.rb", "lib/rcov/xx.rb", "lib/rcov/version.rb", "lib/rcov/rant.rb", "lib/rcov/report.rb", "lib/rcov/rcovtask.rb", "ext/rcovrt/extconf.rb", "ext/rcovrt/1.8/rcovrt.c", "ext/rcovrt/1.9/rcovrt.c", "ext/rcovrt/1.8/callsite.c", "ext/rcovrt/1.9/callsite.c", "LEGAL", "LICENSE", "Rakefile", "Rantfile", "doc/readme_for_rake", "doc/readme_for_rant", "doc/readme_for_vim", "doc/readme_for_emacs", "doc/readme_for_vim", "doc/readme_for_api", "THANKS", "test/functional_test.rb", "test/file_statistics_test.rb", "test/assets/sample_03.rb", "test/assets/sample_05-new.rb", "test/code_coverage_analyzer_test.rb", "test/assets/sample_04.rb", "test/assets/sample_02.rb", "test/assets/sample_05-old.rb", "test/assets/sample_01.rb", "test/turn_off_rcovrt.rb", "test/call_site_analyzer_test.rb", "test/assets/sample_05.rb", "editor-extensions/rcov.vim", "editor-extensions/rcov.el", "setup.rb", "BLURB", "CHANGES"]
+
Gem::Specification.new do |s|
s.name = %q{rcov}
- s.version = "0.8.1.5.6"
+ s.version = "0.8.1.5.7"
s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version=
- s.authors = ["Mauricio Fernandez"]
+ s.authors = ["Mauricio Fernandez", "Chad Humphries", "Aaron Bedra"]
s.cert_chain = nil
- s.date = %q{2008-08-29}
+ s.date = %q{2009-03-17}
s.default_executable = %q{rcov}
s.description = %q{rcov is a code coverage tool for Ruby. It is commonly used for viewing overall test unit coverage of target code. It features fast execution (20-300 times faster than previous tools), multiple analysis modes, XHTML and several kinds of text reports, easy automation with Rake via a RcovTask, fairly accurate coverage information through code linkage inference using simple heuristics, colorblind-friendliness...}
s.email = %q{mfp@acm.org}
s.executables = ["rcov"]
s.extensions = ["ext/rcovrt/extconf.rb"]
- s.extra_rdoc_files = ["readme_for_api", "readme_for_rake", "readme_for_rant", "readme_for_vim"]
- s.files = ["bin/rcov", "lib/rcov.rb", "lib/rcov/lowlevel.rb", "lib/rcov/xx.rb", "lib/rcov/version.rb", "lib/rcov/rant.rb", "lib/rcov/report.rb", "lib/rcov/rexml_extensions.rb", "lib/rcov/rcovtask.rb", "ext/rcovrt/extconf.rb", "ext/rcovrt/rcovrt.c", "ext/rcovrt/callsite.c", "LEGAL", "LICENSE", "Rakefile", "Rantfile", "readme_for_rake", "readme_for_rant", "readme_for_vim", "readme_for_api", "THANKS", "test/functional_test.rb", "test/file_statistics_test.rb", "test/assets/sample_03.rb", "test/assets/sample_05-new.rb", "test/code_coverage_analyzer_test.rb", "test/assets/sample_04.rb", "test/assets/sample_02.rb", "test/assets/sample_05-old.rb", "test/assets/sample_01.rb", "test/turn_off_rcovrt.rb", "test/call_site_analyzer_test.rb", "test/assets/sample_05.rb", "test/rexml_test.rb", "rcov.vim", "rcov.el", "setup.rb", "BLURB", "CHANGES"]
+ s.extra_rdoc_files = ["doc/readme_for_api", "doc/readme_for_rake", "doc/readme_for_rant", "doc/readme_for_vim"]
+ s.files = PKG_FILES
s.has_rdoc = true
- s.homepage = %q{http://eigenclass.org/hiki.rb?rcov}
+ s.homepage = %q{http://github.com/spicycode/rcov}
s.rdoc_options = ["--main", "readme_for_api", "--title", "rcov code coverage tool"]
s.require_paths = ["lib"]
s.required_ruby_version = Gem::Requirement.new("> 0.0.0")
View
80 test/call_site_analyzer_test.rb
@@ -73,37 +73,25 @@ def test_return_values_when_no_match
def test_basic_defsite_recording
@a.run_hooked{ @o.f1 }
- verify_defsite_equal(["./test/assets/sample_03.rb", 3],
- @a.defsite("Rcov::Test::Temporary::Sample03", "f1"))
- verify_defsite_equal(["./test/assets/sample_03.rb", 7],
- @a.defsite("Rcov::Test::Temporary::Sample03", "f2"))
- verify_defsite_equal(["./test/assets/sample_03.rb", 7],
- @a.defsite("Rcov::Test::Temporary::Sample03#f2"))
+ verify_defsite_equal(["./test/assets/sample_03.rb", 3], @a.defsite("Rcov::Test::Temporary::Sample03", "f1"))
+ verify_defsite_equal(["./test/assets/sample_03.rb", 7], @a.defsite("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_defsite_equal(["./test/assets/sample_03.rb", 7], @a.defsite("Rcov::Test::Temporary::Sample03#f2"))
end
def test_basic_callsite_recording
@a.run_hooked{ @o.f1 }
assert(@a.analyzed_classes.include?("Rcov::Test::Temporary::Sample03"))
assert_equal(%w[f1 f2], @a.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10},
- @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10},
- @a.callsites("Rcov::Test::Temporary::Sample03#f2"))
- #verify_callsites_equal({["./test/sample_03.rb:4:in `f1'"] => 10},
- # @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
- #verify_callsites_equal({["./test/sample_03.rb:4:in `f1'"] => 10},
- # @a.callsites("Rcov::Test::Temporary::Sample03#f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10}, @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10}, @a.callsites("Rcov::Test::Temporary::Sample03#f2"))
end
def test_basic_callsite_recording_API
@a.run_hooked{ @o.f1 }
assert(@a.analyzed_classes.include?("Rcov::Test::Temporary::Sample03"))
assert_equal(%w[f1 f2], @a.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1,
- "./test/assets/sample_03.rb", 4]] => 10},
- @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10},
- @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10}, @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10}, @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
callsites = @a.callsites("Rcov::Test::Temporary::Sample03", "f2")
callsite = callsites.keys[0]
#expand path is used here to compensate for differences between JRuby and MRI
@@ -117,12 +105,8 @@ def test_basic_callsite_recording_with_singleton_classes
@a.run_hooked{ @o.class.g1 }
assert(@a.analyzed_classes.include?("#<Class:Rcov::Test::Temporary::Sample03>"))
assert_equal(%w[g1 g2], @a.analyzed_methods("#<Class:Rcov::Test::Temporary::Sample03>"))
- verify_callsites_equal({[[class << Rcov::Test::Temporary::Sample03; self end,
- :g1, "./test/assets/sample_03.rb", 15]] => 10},
- @a.callsites("Rcov::Test::Temporary::Sample03.g2"))
- verify_callsites_equal({[[class << Rcov::Test::Temporary::Sample03; self end,
- :g1, "./test/assets/sample_03.rb", 15]] => 10},
- @a.callsites("#<Class:Rcov::Test::Temporary::Sample03>","g2"))
+ verify_callsites_equal({[[class << Rcov::Test::Temporary::Sample03; self end, :g1, "./test/assets/sample_03.rb", 15]] => 10}, @a.callsites("Rcov::Test::Temporary::Sample03.g2"))
+ verify_callsites_equal({[[class << Rcov::Test::Temporary::Sample03; self end, :g1, "./test/assets/sample_03.rb", 15]] => 10}, @a.callsites("#<Class:Rcov::Test::Temporary::Sample03>","g2"))
end
@@ -130,24 +114,17 @@ def test_differential_callsite_recording
@a.run_hooked{ @o.f1 }
assert(@a.analyzed_classes.include?("Rcov::Test::Temporary::Sample03"))
assert_equal(%w[f1 f2], @a.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1,
- "./test/assets/sample_03.rb", 4]] => 10},
- @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10}, @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
@a.run_hooked{ @o.f1 }
assert(@a.analyzed_classes.include?("Rcov::Test::Temporary::Sample03"))
assert_equal(%w[f1 f2], @a.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1,
- "./test/assets/sample_03.rb", 4]] => 20},
- @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 20}, @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
@a.run_hooked{ @o.f3 }
assert_equal(%w[f1 f2 f3], @a.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1,
- "./test/assets/sample_03.rb", 4]] => 120,
- [[Rcov::Test::Temporary::Sample03, :f3,
- "./test/assets/sample_03.rb", 11]]=>100 },
- @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 120,
+ [[Rcov::Test::Temporary::Sample03, :f3, "./test/assets/sample_03.rb", 11]] => 100 }, @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
end
def test_reset
@@ -158,10 +135,7 @@ def test_reset
end
assert(@a.analyzed_classes.include?("Rcov::Test::Temporary::Sample03"))
assert_equal(%w[f1 f2], @a.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1,
- "./test/assets/sample_03.rb", 4]] => 10},
- @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
-
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10}, @a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
end
def test_nested_callsite_recording
@@ -171,37 +145,27 @@ def test_nested_callsite_recording
b.run_hooked { @o.f1 }
assert(b.analyzed_classes.include?("Rcov::Test::Temporary::Sample03"))
assert_equal(%w[f1 f2], b.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1,
- "./test/assets/sample_03.rb", 4]] => 10},
- b.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10}, b.callsites("Rcov::Test::Temporary::Sample03", "f2"))
@o.f1
assert_equal(%w[f1 f2], b.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1,
- "./test/assets/sample_03.rb", 4]] => 10},
- b.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 10}, b.callsites("Rcov::Test::Temporary::Sample03", "f2"))
assert(a.analyzed_classes.include?("Rcov::Test::Temporary::Sample03"))
assert_equal(%w[f1 f2], a.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1,
- "./test/assets/sample_03.rb", 4]] => 20},
- a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 20}, a.callsites("Rcov::Test::Temporary::Sample03", "f2"))
end
+
b.run_hooked{ @o.f3 }
assert_equal(%w[f1 f2 f3], b.analyzed_methods("Rcov::Test::Temporary::Sample03"))
- verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1,
- "./test/assets/sample_03.rb", 4]] => 110,
- [[Rcov::Test::Temporary::Sample03, :f3,
- "./test/assets/sample_03.rb", 11]]=>100 },
- b.callsites("Rcov::Test::Temporary::Sample03", "f2"))
+ verify_callsites_equal({[[Rcov::Test::Temporary::Sample03, :f1, "./test/assets/sample_03.rb", 4]] => 110,
+ [[Rcov::Test::Temporary::Sample03, :f3, "./test/assets/sample_03.rb", 11]]=>100 }, b.callsites("Rcov::Test::Temporary::Sample03", "f2"))
end
def test_expand_name
assert_equal(["Foo", "foo"], @a.instance_eval{ expand_name("Foo#foo") })
assert_equal(["Foo", "foo"], @a.instance_eval{ expand_name("Foo", "foo") })
- assert_equal(["#<Class:Foo>", "foo"],
- @a.instance_eval{ expand_name("Foo.foo") })
- assert_equal(["#<Class:Foo>", "foo"],
- @a.instance_eval{ expand_name("#<Class:Foo>", "foo") })
+ assert_equal(["#<Class:Foo>", "foo"], @a.instance_eval{ expand_name("Foo.foo") })
+ assert_equal(["#<Class:Foo>", "foo"], @a.instance_eval{ expand_name("#<Class:Foo>", "foo") })
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.