Skip to content

Commit

Permalink
Merge pull request #11 from RoboticCheese/jdh-custom-resources
Browse files Browse the repository at this point in the history
Convert to custom resources
  • Loading branch information
hartmantis committed Jan 28, 2016
2 parents 3cfabdf + 997dd91 commit 836ffa6
Show file tree
Hide file tree
Showing 43 changed files with 420 additions and 940 deletions.
6 changes: 2 additions & 4 deletions .kitchen.yml
Expand Up @@ -16,8 +16,6 @@ suites:
- name: default
run_list:
- recipe[vmware-fusion]
attributes:
- name: uninstall
- name: remove
run_list:
- recipe[vmware-fusion_test::uninstall]
attributes:
- recipe[vmware-fusion_test::remove]
17 changes: 14 additions & 3 deletions Berksfile
@@ -1,8 +1,19 @@
# Encoding: UTF-8
# encoding: utf-8

source 'https://supermarket.chef.io'

metadata

cookbook 'vmware-fusion_test',
path: 'test/fixtures/cookbooks/vmware-fusion_test'
group :test do
cookbook 'resource_vmware_fusion_test',
path: 'spec/support/cookbooks/resource_vmware_fusion_test'
cookbook 'resource_vmware_fusion_app_test',
path: 'spec/support/cookbooks/resource_vmware_fusion_app_test'
cookbook 'resource_vmware_fusion_config_test',
path: 'spec/support/cookbooks/resource_vmware_fusion_config_test'
end

group :integration do
cookbook 'vmware-fusion_test',
path: 'test/fixtures/cookbooks/vmware-fusion_test'
end
6 changes: 4 additions & 2 deletions CHANGELOG.md
@@ -1,8 +1,10 @@
VMware Fusion Cookbook CHANGELOG
================================

v?.?.? (????-??-??)
-------------------
Unreleased
----------
- Convert to Chef custom resources (breaking compatibility with Chef < 12 and
requiring the compat_resource cookbook for Chef < 12.5)

v0.2.0 (2015-08-25)
-------------------
Expand Down
15 changes: 6 additions & 9 deletions Gemfile
@@ -1,4 +1,4 @@
# Encoding: UTF-8
# encoding: utf-8

source 'https://rubygems.org'

Expand All @@ -12,12 +12,10 @@ end

group :test do
gem 'rake'
gem 'cane'
gem 'countloc'
gem 'rubocop'
gem 'foodcritic'
gem 'rspec', '>= 3'
gem 'chefspec', '>= 4'
gem 'rspec'
gem 'chefspec'
gem 'simplecov'
gem 'simplecov-console'
gem 'coveralls'
Expand All @@ -28,15 +26,14 @@ group :test do
end

group :integration do
gem 'serverspec', '>= 2'
gem 'cucumber'
gem 'serverspec'
end

group :deploy do
gem 'stove'
end

group :production do
gem 'chef', '>= 11'
gem 'berkshelf', '>= 3'
gem 'chef', '>= 12.5'
gem 'berkshelf'
end
2 changes: 1 addition & 1 deletion Guardfile
@@ -1,4 +1,4 @@
# Encoding: UTF-8
# encoding: utf-8

guard :rspec, all_on_start: true, notification: false do
watch(%r{^spec/.+_spec\.rb$})
Expand Down
17 changes: 1 addition & 16 deletions README.md
Expand Up @@ -126,21 +126,6 @@ Attributes:
| license | `nil` | An optional license key |
| action | `:create` | Action(s) to perform |

Providers
=========

***Chef::Provider::VmwareFusion***

Main provider for OS X (the only platform VMware Fusion is for).

***Chef::Provider::VmwareFusionApp***

A provider dedicated to app installation and removal.

***Chef::Provider::VmwareFusionConfig***

A provider dedicated to app configuration.

Contributing
============

Expand All @@ -155,7 +140,7 @@ License & Authors
=================
- Author: Jonathan Hartman <j@p4nt5.com>

Copyright 2015 Jonathan Hartman
Copyright 2015-2016, Jonathan Hartman

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
14 changes: 2 additions & 12 deletions Rakefile
@@ -1,25 +1,15 @@
# Encoding: UTF-8
# encoding: utf-8

require 'rubygems'
require 'English'
require 'bundler/setup'
require 'rubocop/rake_task'
require 'cane/rake_task'
require 'rspec/core/rake_task'
require 'foodcritic'
require 'kitchen/rake_tasks'
require 'stove/rake_task'

Cane::RakeTask.new

RuboCop::RakeTask.new

desc 'Display LOC stats'
task :loc do
puts "\n## LOC Stats"
Kernel.system 'countloc -r .'
end

FoodCritic::Rake::LintTask.new do |f|
f.options = { fail_tags: %w(any) }
end
Expand All @@ -30,4 +20,4 @@ Kitchen::RakeTasks.new

Stove::RakeTask.new

task default: %w(cane rubocop loc foodcritic spec)
task default: %w(rubocop foodcritic spec)
4 changes: 2 additions & 2 deletions attributes/default.rb
@@ -1,9 +1,9 @@
# Encoding: UTF-8
# encoding: utf-8
#
# Cookbook Name:: vmware-fusion
# Attributes:: default
#
# Copyright 2015 Jonathan Hartman
# Copyright 2015-2016, Jonathan Hartman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
32 changes: 12 additions & 20 deletions libraries/matchers.rb
@@ -1,9 +1,9 @@
# Encoding: UTF-8
# encoding: utf-8
#
# Cookbook Name:: vmware-fusion
# Library:: matchers
#
# Copyright 2015 Jonathan Hartman
# Copyright 2015-2016, Jonathan Hartman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,25 +19,17 @@
#

if defined?(ChefSpec)
[:vmware_fusion, :vmware_fusion_app, :vmware_fusion_config].each do |m|
ChefSpec.define_matcher(m)
end

[:install, :remove, :configure].each do |a|
define_method("#{a}_vmware_fusion") do |name|
ChefSpec::Matchers::ResourceMatcher.new(:vmware_fusion, a, name)
end
end

[:install, :remove].each do |a|
define_method("#{a}_vmware_fusion_app") do |name|
ChefSpec::Matchers::ResourceMatcher.new(:vmware_fusion_app, a, name)
end
end
{
vmware_fusion: %i(install remove configure),
vmware_fusion_app: %i(install remove),
vmware_fusion_config: %i(create)
}.each do |matcher, actions|
ChefSpec.define_matcher(matcher)

[:configure].each do |a|
define_method("#{a}_vmware_fusion_config") do |name|
ChefSpec::Matchers::ResourceMatcher.new(:vmware_fusion_config, a, name)
actions.each do |action|
define_method("#{action}_#{matcher}") do |name|
ChefSpec::Matchers::ResourceMatcher.new(matcher, action, name)
end
end
end
end
78 changes: 0 additions & 78 deletions libraries/provider_vmware_fusion.rb

This file was deleted.

92 changes: 0 additions & 92 deletions libraries/provider_vmware_fusion_app.rb

This file was deleted.

0 comments on commit 836ffa6

Please sign in to comment.