Skip to content

Commit

Permalink
Merge 3e26e3a into 2abce6c
Browse files Browse the repository at this point in the history
  • Loading branch information
hartmantis committed May 13, 2015
2 parents 2abce6c + 3e26e3a commit 058f663
Show file tree
Hide file tree
Showing 36 changed files with 289 additions and 438 deletions.
12 changes: 10 additions & 2 deletions .kitchen.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ driver:
platforms:
- name: ubuntu-14-04-x64
- name: ubuntu-12-04-x64
# - name: debian-7-0-x64
# - name: debian-6-0-x64
- name: debian-7-0-x64
# The Debian 6 Digital Ocean image doesn't have sudo installed
- name: debian-6-0-x64
provisioner:
sudo_command:
verifier:
sudo_command:
- name: centos-6-5-x64
- name: macosx
driver:
name: localhost
24 changes: 16 additions & 8 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ provisioner:
platforms:
- name: ubuntu-14.04
- name: ubuntu-12.04
- name: debian-7.6
- name: debian-7.8
- name: debian-6.0.10
- name: centos-6.5
- name: macosx-10.8
- name: macosx-10.9
- name: centos-6.6
# - name: macosx-10.8
# - name: macosx-10.9
- name: macosx-10.10
driver:
box: roboticcheese/macosx-10.10
ssh:
insert_key: false
- name: windows-2012
driver:
box: roboticcheese/windows-2012

suites:
- name: default
Expand All @@ -33,12 +40,13 @@ suites:
package_url: https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.3.4-1_amd64.deb
excludes:
- ubuntu-12.04
- debian-7.6
- debian-7.8
- debian-6.0.10
- centos-6.5
- macosx-10.8
- macosx-10.9
- centos-6.6
- macosx-10.10
- windows-2012
- ubuntu-12-04-x64
- debian-7-0-x64
- debian-6-0-x64
- centos-6-5-x64
- macosx
3 changes: 0 additions & 3 deletions .rubocop.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ before_script:
- echo -e $DIGITALOCEAN_SSH_KEY_BODY > ~/.ssh/id_rsa

script:
- chef exec bundle exec rspec --default-path test/integration/global_shell_init/serverspec -f d && chef exec rake
- chef exec rake && chef exec kitchen test -c 4

after_script:
- chef exec bundle exec kitchen destroy
- chef exec kitchen destroy

env:
global:
Expand Down
2 changes: 1 addition & 1 deletion Berksfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Encoding: UTF-8

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

metadata
29 changes: 29 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Kindle Cookbook Contributor Code of Conduct
===========================================

As contributors and maintainers of this project, we pledge to respect all
people who contribute through reporting issues, posting feature requests,
updating documentation, submitting pull requests or patches, and other
activities.

We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual
language or imagery, derogatory comments or personal attacks, trolling, public
or private harassment, insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct. Project maintainers who do not
follow the Code of Conduct may be removed from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by opening an issue or contacting one or more of the project
maintainers.

This Code of Conduct is adapted from the
[Contributor Covenant](http://contributor-covenant.org), version 1.0.0,
available [here](http://contributor-covenant.org/version/1/0/0/).
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source 'https://rubygems.org'
group :development do
gem 'yard-chef'
gem 'guard'
gem 'guard-foodcritic'
gem 'guard-rspec'
gem 'guard-kitchen'
end
Expand All @@ -15,8 +16,6 @@ group :test do
gem 'countloc'
gem 'rubocop'
gem 'foodcritic'
# TODO: guard-foodcritic has a dep conflict with Berkshelf 3
# gem 'guard-foodcritic'
gem 'rspec', '>= 3'
gem 'chefspec', '>= 4'
gem 'simplecov'
Expand All @@ -25,7 +24,9 @@ group :test do
gem 'fauxhai'
gem 'test-kitchen'
gem 'kitchen-digitalocean', '>= 0.8.0'
gem 'kitchen-localhost'
gem 'kitchen-vagrant'
gem 'winrm-transport'
end

group :integration do
Expand Down
15 changes: 8 additions & 7 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Encoding: UTF-8

guard :rspec, all_on_start: true, notification: false do
watch(/^spec\/.+_spec\.rb$/)
watch(%r{^spec/.+_spec\.rb$})
watch('spec/spec_helper.rb') { 'spec' }

watch(/^recipes\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" }
watch(/^attributes\/(.+)\.rb$/)
watch(/^files\/(.+)/)
watch(/^templates\/(.+)/)
watch(/^providers\/(.+)\.rb/)
watch(/^resources\/(.+)\.rb/)
watch(%r{^recipes/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^attributes/(.+)\.rb$})
watch(%r{^files/(.+)})
watch(%r{^templates/(.+)})
watch(%r{^providers/(.+)\.rb})
watch(%r{^resources/(.+)\.rb})
watch(%r{^libraries/(.+)\.rb})
end

# guard :foodcritic, cookbook_paths: '.', cli: '-t ~FC023 -f any' do
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Chef-DK Cookbook
================
[![Cookbook Version](http://img.shields.io/cookbook/v/chef-dk.svg)][cookbook]
[![Build Status](http://img.shields.io/travis/RoboticCheese/chef-dk-chef.svg)][travis]
[![Code Climate](http://img.shields.io/codeclimate/github/RoboticCheese/chef-dk-chef.svg)][codeclimate]
[![Coverage Status](http://img.shields.io/coveralls/RoboticCheese/chef-dk-chef.svg)][coveralls]
[![Cookbook Version](https://img.shields.io/cookbook/v/chef-dk.svg)][cookbook]
[![Build Status](https://img.shields.io/travis/RoboticCheese/chef-dk-chef.svg)][travis]
[![Code Climate](https://img.shields.io/codeclimate/github/RoboticCheese/chef-dk-chef.svg)][codeclimate]
[![Coverage Status](https://img.shields.io/coveralls/RoboticCheese/chef-dk-chef.svg)][coveralls]

[cookbook]: https://supermarket.getchef.com/cookbooks/chef-dk
[travis]: http://travis-ci.org/RoboticCheese/chef-dk-chef
[cookbook]: https://supermarket.chef.io/cookbooks/chef-dk
[travis]: https://travis-ci.org/RoboticCheese/chef-dk-chef
[codeclimate]: https://codeclimate.com/github/RoboticCheese/chef-dk-chef
[coveralls]: https://coveralls.io/r/RoboticCheese/chef-dk-chef

Expand All @@ -28,7 +28,7 @@ that is used for installation under Windows. _This cookbook will not run on
Windows under earlier versions of Chef._

This cookbook consumes the
[dmg cookbook](http://supermarket.getchef.com/cookbooks/dmg) in order to
[dmg cookbook](https://supermarket.chef.io/cookbooks/dmg) in order to
support OS X installs. That cookbook's limitations, such as the inability
to upgrade or uninstall packages, are thus present in the OS X implementation
here.
Expand Down Expand Up @@ -141,7 +141,7 @@ License & Authors
=================
- Author: Jonathan Hartman <j@p4nt5.com>

Copyright 2014, Jonathan Hartman
Copyright 2014-2015, 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
10 changes: 1 addition & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ task :loc do
Kernel.system 'countloc -r .'
end

desc 'Run knife cookbook syntax test'
task :cookbook_test do
path = File.expand_path('../..', __FILE__)
cb = File.basename(File.expand_path('..', __FILE__))
Kernel.system "knife cookbook test -c test/knife.rb -o #{path} #{cb}"
$CHILD_STATUS == 0 || fail('Cookbook syntax check failed!')
end

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

Stove::RakeTask.new

task default: %w(cane rubocop loc cookbook_test foodcritic spec kitchen:all)
task default: %w(cane rubocop loc foodcritic spec)
2 changes: 1 addition & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cookbook Name:: chef-dk
# Attributes:: default
#
# Copyright 2014, Jonathan Hartman
# Copyright 2014-2015 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
23 changes: 6 additions & 17 deletions spec/support/matchers/chef_dk.rb → libraries/matchers.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Encoding: UTF-8
#
# Cookbook Name:: chef-dk
# Spec:: support/matchers/chef_dk
# Library:: matchers
#
# Copyright (C) 2014, Jonathan Hartman
# Copyright (C) 2014-2015 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 @@ -17,21 +17,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require 'spec_helper'
if defined?(ChefSpec)
ChefSpec.define_matcher(:chef_dk)

module ChefSpec
module API
# Some simple matchers for the chef_dk resource
#
# @author Jonathan Hartman <j@p4nt5.com>
module ChefDkMatchers
ChefSpec.define_matcher :chef_dk

def install_chef_dk(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:chef_dk,
:install,
resource_name)
end
end
def install_chef_dk(name)
ChefSpec::Matchers::ResourceMatcher.new(:chef_dk, :install, name)
end
end
26 changes: 17 additions & 9 deletions libraries/provider_chef_dk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cookbook Name:: chef-dk
# Library:: provider_chef_dk
#
# Copyright 2014, Jonathan Hartman
# Copyright 2014-2015 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 Expand Up @@ -58,10 +58,8 @@ def load_current_resource
#
def action_install
omnijack_gem.run_action(:install)
metadata.yolo && Chef::Log.warn('Using a ChefDk package not ' \
'officially supported on this platform')
remote_file.run_action(:create)
global_shell_init(:create).write_file
node['platform'] == 'windows' || global_shell_init(:create).write_file
package.run_action(:install)
new_resource.installed = true
end
Expand All @@ -70,7 +68,7 @@ def action_install
# Uninstall the ChefDk package and delete the cached file
#
def action_remove
global_shell_init(:delete).write_file
node['platform'] == 'windows' || global_shell_init(:delete).write_file
package.run_action(:remove)
remote_file.run_action(:delete)
# A full uninstall would also delete the omnijack gem, but ehhh...
Expand Down Expand Up @@ -178,8 +176,14 @@ def filename
# @return [Hash]
#
def metadata
require 'omnijack'
@metadata ||= Omnijack::Project::ChefDk.new(metadata_params).metadata
unless @metadata
require 'omnijack'
@metadata = Omnijack::Project::ChefDk.new(metadata_params).metadata
@metadata.yolo && Chef::Log.warn('Using a ChefDk package not ' \
'officially supported on this ' \
'platform')
end
@metadata
end

#
Expand All @@ -202,8 +206,12 @@ def metadata_params
# @return [Chef::Resource::ChefGem]
#
def omnijack_gem
@omnijack_gem ||= Resource::ChefGem.new('omnijack', run_context)
@omnijack_gem.version('~> 1.0')
unless @omnijack_gem
package_url = new_resource.package_url
@omnijack_gem = Resource::ChefGem.new('omnijack', run_context)
@omnijack_gem.version('~> 1.0')
@omnijack_gem.only_if { package_url.nil? }
end
@omnijack_gem
end

Expand Down
2 changes: 1 addition & 1 deletion libraries/provider_chef_dk_debian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cookbook Name:: chef-dk
# Library:: provider_chef_dk_debian
#
# Copyright 2014, Jonathan Hartman
# Copyright 2014-2015 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
2 changes: 1 addition & 1 deletion libraries/provider_chef_dk_mac_os_x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cookbook Name:: chef-dk
# Library:: provider_chef_dk_mac_os_x
#
# Copyright 2014, Jonathan Hartman
# Copyright 2014-2015 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
2 changes: 1 addition & 1 deletion libraries/provider_chef_dk_rhel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cookbook Name:: chef-dk
# Library:: provider_chef_dk_rhel
#
# Copyright 2014, Jonathan Hartman
# Copyright 2014-2015 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
2 changes: 1 addition & 1 deletion libraries/provider_chef_dk_windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cookbook Name:: chef-dk
# Library:: provider_chef_dk_windows
#
# Copyright 2014, Jonathan Hartman
# Copyright 2014-2015 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
2 changes: 1 addition & 1 deletion libraries/resource_chef_dk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cookbook Name:: chef-dk
# Library:: resource_chef_dk
#
# Copyright 2014, Jonathan Hartman
# Copyright 2014-2015 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
4 changes: 3 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Encoding: UTF-8

#
# rubocop:disable SingleSpaceBeforeFirstArg
name 'chef-dk'
maintainer 'Jonathan Hartman'
maintainer_email 'j@p4nt5.com'
Expand All @@ -17,3 +18,4 @@
end
supports 'mac_os_x', '>= 10.8'
supports 'windows'
# rubocop:enable SingleSpaceBeforeFirstArg
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cookbook Name:: chef-dk
# Recipe:: default
#
# Copyright 2014, Jonathan Hartman
# Copyright 2014-2015 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

0 comments on commit 058f663

Please sign in to comment.