summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Davis <ryand-ruby@zenspider.com>2022-10-19 10:00:54 -0800
committerRyan Davis <ryand-ruby@zenspider.com>2022-10-19 10:00:54 -0800
commite9045496d7f74267405e4121422dbcfaef75d519 (patch)
tree3cc660350fb9bfea9ce7ee2c2a132f3c324b0f63
parent435e819126befb27b1d15f52c988b5ce0830d526 (diff)
downloadhoe-e9045496d7f74267405e4121422dbcfaef75d519.tar.gz
+ Removed dead rcov plugin and added (simple)cov plugin.
[git-p4: depot-paths = "//src/hoe/dev/": change = 13573]
-rw-r--r--Manifest.txt2
-rw-r--r--Rakefile1
-rw-r--r--lib/hoe/clean.rb2
-rw-r--r--lib/hoe/cov.rb34
-rw-r--r--lib/hoe/rcov.rb68
-rw-r--r--lib/hoe/test.rb7
6 files changed, 43 insertions, 71 deletions
diff --git a/Manifest.txt b/Manifest.txt
index a2c61b6..be04a7a 100644
--- a/Manifest.txt
+++ b/Manifest.txt
@@ -8,6 +8,7 @@ bin/sow
lib/hoe.rb
lib/hoe/clean.rb
lib/hoe/compiler.rb
+lib/hoe/cov.rb
lib/hoe/debug.rb
lib/hoe/deps.rb
lib/hoe/flay.rb
@@ -20,7 +21,6 @@ lib/hoe/package.rb
lib/hoe/publish.rb
lib/hoe/racc.rb
lib/hoe/rake.rb
-lib/hoe/rcov.rb
lib/hoe/rdoc.rb
lib/hoe/signing.rb
lib/hoe/test.rb
diff --git a/Rakefile b/Rakefile
index 504827d..8914444 100644
--- a/Rakefile
+++ b/Rakefile
@@ -6,6 +6,7 @@ require "./lib/hoe.rb"
Hoe.plugin :seattlerb
Hoe.plugin :isolate
Hoe.plugin :rdoc
+Hoe.plugin :cov
Hoe.spec "hoe" do
developer "Ryan Davis", "ryand-ruby@zenspider.com"
diff --git a/lib/hoe/clean.rb b/lib/hoe/clean.rb
index c59be5b..0b3e5c6 100644
--- a/lib/hoe/clean.rb
+++ b/lib/hoe/clean.rb
@@ -16,7 +16,7 @@ module Hoe::Clean
def initialize_clean
self.clean_globs ||= %w[diff diff.txt TAGS ri deps .source_index
- *.gem **/*~ **/.*~ **/*.rbc coverage*]
+ *.gem **/*~ **/.*~ **/*.rbc]
end
##
diff --git a/lib/hoe/cov.rb b/lib/hoe/cov.rb
new file mode 100644
index 0000000..222bf5f
--- /dev/null
+++ b/lib/hoe/cov.rb
@@ -0,0 +1,34 @@
+##
+# Coverage plugin for hoe. Uses simplecov.
+#
+# === Tasks Provided:
+#
+# cov:: Analyze code coverage with tests using simplecov.
+
+module Hoe::Cov
+
+ ##
+ # Activate the cov dependencies.
+
+ def activate_cov_deps
+ dependency "simplecov", "~> 0.21", :development
+ end
+
+ ##
+ # Define tasks for plugin.
+
+ def define_cov_tasks
+ task :isolate # ensure it exists
+
+ self.clean_globs << "coverage"
+
+ desc "Run tests and analyze code coverage"
+ task :cov => :isolate do
+ test_task.test_prelude = "require \"simplecov\"; SimpleCov.start"
+
+ Rake::Task[:test].invoke
+ end
+ rescue LoadError
+ warn "simplecov not found"
+ end
+end
diff --git a/lib/hoe/rcov.rb b/lib/hoe/rcov.rb
deleted file mode 100644
index c3ba542..0000000
--- a/lib/hoe/rcov.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-##
-# RCov plugin for hoe.
-#
-# === Tasks Provided:
-#
-# rcov:: Analyze code coverage with tests
-
-module Hoe::RCov
-
- ##
- # Activate the rcov dependencies.
-
- def activate_rcov_deps
- dependency "rcov", "~> 0.9", :development
- end
-
- ##
- # Define tasks for plugin.
-
- def define_rcov_tasks
- task :isolate # ensure it exists
-
- task :rcov => :isolate do
- sh(*make_rcov_cmd)
- end
-
- task :clobber_rcov do
- rm_rf "coverage"
- end
-
- task :clobber => :clobber_rcov
-
- # this is for my emacs rcov overlay stuff on emacswiki.
- task :rcov_overlay do
- path = ENV["FILE"]
- rcov, eol = Marshal.load(File.read("coverage.info")).last[path], 1
- puts rcov[:lines].zip(rcov[:coverage]).map { |line, coverage|
- bol, eol = eol, eol + line.length
- [bol, eol, "#ffcccc"] unless coverage
- }.compact.inspect
- end
- rescue LoadError
- # skip
- task :clobber_rcov # in case rcov didn't load
- # TODO: didn't load? this must be terribly historical
- end
-
- def make_rcov_cmd # :nodoc:
- rcov = Gem.bin_wrapper "rcov"
- tests = test_globs.sort.map { |g| Dir.glob(g) }.flatten.map(&:inspect)
-
- cmd = %W[#{rcov}
- #{Hoe::RUBY_FLAGS}
- --text-report
- --no-color
- --save coverage.info
- -x ^/
- -x tmp/isolate
- --sort coverage
- --sort-reverse
- -o coverage
- ] + tests
-
- cmd
- end
-end
-
-task :clean => :clobber_rcov
diff --git a/lib/hoe/test.rb b/lib/hoe/test.rb
index af9ddbc..e959153 100644
--- a/lib/hoe/test.rb
+++ b/lib/hoe/test.rb
@@ -57,6 +57,11 @@ module Hoe::Test
attr_accessor :rspec_options
##
+ # The test task created for this plugin.
+
+ attr_accessor :test_task
+
+ ##
# Initialize variables for plugin.
def initialize_test
@@ -81,7 +86,7 @@ module Hoe::Test
require "minitest/test_task" # currently in hoe, but will move
test_prelude = self.test_prelude
- Minitest::TestTask.create :test do |t|
+ self.test_task = Minitest::TestTask.create :test do |t|
t.test_prelude = test_prelude
t.libs += Hoe.include_dirs.uniq
end