summaryrefslogtreecommitdiff
path: root/lib/hoe
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 /lib/hoe
parent435e819126befb27b1d15f52c988b5ce0830d526 (diff)
downloadhoe-e9045496d7f74267405e4121422dbcfaef75d519.tar.gz
+ Removed dead rcov plugin and added (simple)cov plugin.
[git-p4: depot-paths = "//src/hoe/dev/": change = 13573]
Diffstat (limited to 'lib/hoe')
-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
4 files changed, 41 insertions, 70 deletions
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