Skip to content

Commit

Permalink
use minitest-chef-handler gem
Browse files Browse the repository at this point in the history
  • Loading branch information
btm committed Apr 13, 2012
1 parent f50858e commit f015dfc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,15 @@ Example
assert File.exists?(Dir.glob("/etc/rc5.d/S*apache2").first)
end
end

Changelog
=====

### v0.0.5

* Install the minitest-chef-handler gem instead of downloading from github directly
*

### v0.0.4

Add examples/ top level directory (may not work)
3 changes: 1 addition & 2 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
license "Apache 2.0"
description "Installs and configures minitest-chef-handler"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.0.3"
depends "chef_handler"
version "0.0.4"
29 changes: 14 additions & 15 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Hack to install Gem immediately pre Chef 0.10.10 (CHEF-2879)
r = gem_package "minitest" do
gem_package "minitest" do
action :nothing
end
end.run_action(:install)

r.run_action(:install)
Gem.clear_paths
gem_package "minitest-chef-handler" do
action :nothing
end.run_action(:install)

# Download latest copy of minitest-chef-handler
remote_file "minitest-chef-handler" do
source "https://raw.github.com/calavera/minitest-chef-handler/master/lib/minitest-chef-handler.rb"
path "#{node["chef_handler"]["handler_path"]}/minitest-chef-handler.rb"
end
Gem.clear_paths
require "minitest-chef-handler"

# Directory to store cookbook tests
directory node[:minitest][:path] do
Expand All @@ -31,10 +29,11 @@
end
end

# Install the handler using the LWRP in the chef_handler cookbook
chef_handler "MiniTest::Chef::Handler" do
source "#{node["chef_handler"]["handler_path"]}/minitest-chef-handler.rb"
arguments :verbose => true, :path => "#{node[:minitest][:path]}/**/*_test.rb"
action :enable
end
handler = MiniTest::Chef::Handler.new({
:path => "#{node[:minitest][:path]}/**/*_test.rb",
:verbose => true})

Chef::Log.info("Enabling minitest-chef-handler as a report handler")
Chef::Config.send("report_handlers").delete_if {|v| v.class.to_s.include? MiniTest::Chef::Handler}
Chef::Config.send("report_handlers") << handler

0 comments on commit f015dfc

Please sign in to comment.