Skip to content

Commit

Permalink
Merge pull request #98 from chef/style
Browse files Browse the repository at this point in the history
Switch from finstyle / rubocop to chefstyle
  • Loading branch information
chris-rock authored Aug 23, 2016
2 parents 7dd7f44 + 96f6796 commit 3ccd656
Show file tree
Hide file tree
Showing 17 changed files with 298 additions and 355 deletions.
65 changes: 0 additions & 65 deletions .rubocop.yml

This file was deleted.

13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ language: ruby
cache: bundler
dist: trusty
services:
- docker
- docker
bundler_args: "--without integration guard tools"
before_install:
- gem install bundler
- gem --version
- gem install bundler
- gem --version
matrix:
include:
- rvm: 1.9.3
- rvm: 2.0
- rvm: 2.1
- rvm: 2.1.9
- rvm: ruby-head
- rvm: 2.2
- rvm: 2.2.5
bundler_args: "--without guard tools"
script: bundle exec rake test:integration OS='default profile contains_inspec'
- rvm: 2.2
- rvm: 2.2.5
bundler_args: "--without guard tools"
script: bundle exec rake test:integration OS='supermarket'
allow_failures:
Expand Down
10 changes: 5 additions & 5 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# encoding: utf-8

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

cookbook 'apt'
cookbook 'yum'
cookbook 'os_prepare', path: './test/cookbooks/os_prepare'
cookbook 'ssh-hardening', git: 'https://github.com/dev-sec/chef-ssh-hardening.git'
cookbook "apt"
cookbook "yum"
cookbook "os_prepare", path: "./test/cookbooks/os_prepare"
cookbook "ssh-hardening", git: "https://github.com/dev-sec/chef-ssh-hardening.git"
30 changes: 15 additions & 15 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# -*- encoding: utf-8 -*-
source 'https://rubygems.org'
source "https://rubygems.org"
gemspec

group :guard do
gem 'guard-rspec', :require => nil
gem 'guard-rubocop', :require => nil
gem "guard-rspec", :require => nil
gem "guard-rubocop", :require => nil
end

group :test do
gem 'bundler', '~> 1.5'
gem 'minitest', '~> 5.5'
gem 'rake', '~> 10'
gem 'rubocop', '~> 0.32'
gem 'concurrent-ruby', '~> 0.9'
gem 'codeclimate-test-reporter', :require => nil
gem "bundler", "~> 1.5"
gem "minitest", "~> 5.5"
gem "rake", "~> 10"
gem "chefstyle", "~> 0.4.0"
gem "concurrent-ruby", "~> 0.9"
gem "codeclimate-test-reporter", :require => nil
end

# pin dependency for Ruby 1.9.3 since bundler is not
# detecting that net-ssh 3 does not work with 1.9.3
if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('1.9.3')
gem 'net-ssh', '~> 2.9'
if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("1.9.3")
gem "net-ssh", "~> 2.9"
end

group :integration do
gem 'berkshelf', '>= 4.2.3'
gem 'kitchen-dokken'
gem "berkshelf", ">= 4.2.3"
gem "kitchen-dokken"
end

group :tools do
gem 'pry', '~> 0.10'
gem 'github_changelog_generator', '1.11.3'
gem "pry", "~> 0.10"
gem "github_changelog_generator", "1.11.3"
end
6 changes: 3 additions & 3 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
ignore %r{^\.gem/}

def rspec_opts
{ cmd: 'bundle exec rspec' }
{ cmd: "bundle exec rspec" }
end

def rubocop_opts
{ all_on_start: false, keep_failed: false, cli: '-r finstyle' }
{ all_on_start: false, keep_failed: false, cli: "-r chefstyle" }
end

group :red_green_refactor, halt_on_fail: true do
guard :rspec, rspec_opts do
watch(%r{^spec/(.*)_spec\.rb})
watch(%r{^lib/(.*)([^/]+)\.rb}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^spec/spec_helper\.rb}) { 'spec' }
watch(%r{^spec/spec_helper\.rb}) { "spec" }
end

guard :rubocop, rubocop_opts do
Expand Down
52 changes: 30 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Kitchen::InSpec - A Test Kitchen Verifier for InSpec

[![Build Status Master](https://travis-ci.org/chef/kitchen-inspec.svg?branch=master)](https://travis-ci.org/chef/kitchen-inspec) [![Gem Version](https://badge.fury.io/rb/kitchen-inspec.svg)](https://badge.fury.io/rb/kitchen-inspec)

This is the kitchen driver for [InSpec](https://github.com/chef/inspec). To see the project in action, we have the following test-kitchen examples available:

- [Chef and InSpec](https://github.com/chef/inspec/tree/master/examples/kitchen-chef)
- [Puppet and InSpec](https://github.com/chef/inspec/tree/master/examples/kitchen-puppet)
- [Ansible and InSpec](https://github.com/chef/inspec/tree/master/examples/kitchen-ansible)
- [Chef and InSpec](https://github.com/chef/inspec/tree/master/examples/kitchen-chef)
- [Puppet and InSpec](https://github.com/chef/inspec/tree/master/examples/kitchen-puppet)
- [Ansible and InSpec](https://github.com/chef/inspec/tree/master/examples/kitchen-ansible)

## Installation

Expand All @@ -16,22 +18,28 @@ gem 'kitchen-inspec'

And then execute:

$ bundle
```shell
$ bundle
```

Or install it yourself as:

$ gem install kitchen-inspec
```shell
$ gem install kitchen-inspec
```

## Usage

In your .kitchen.yml include
```

```yaml
verifier:
name: inspec
```
Optionally specify sudo and sudo_command
```
```yaml
verifier:
name: inspec
sudo: true
Expand All @@ -49,8 +57,8 @@ By default `kitchen-inspec` expects test to be in `test/integration/%suite%` dir
├── README.md
├── metadata.rb
├── recipes
   ├── default.rb
   └── nginx.rb
├── default.rb
└── nginx.rb
└── test
└── integration
└── default
Expand All @@ -68,13 +76,13 @@ A complete profile is used here, including a custom inspec resource named `gordo
├── README.md
├── metadata.rb
├── recipes
   ├── default.rb
   └── nginx.rb
├── default.rb
└── nginx.rb
└── test
└── integration
└── default
├── controls
   └── gordon.rb
└── gordon.rb
├── inspec.yml
└── libraries
└── gordon_config.rb
Expand All @@ -91,8 +99,8 @@ If you need support with other testing frameworks, we recommend to place the tes
├── README.md
├── metadata.rb
├── recipes
   ├── default.rb
   └── nginx.rb
├── default.rb
└── nginx.rb
└── test
└── integration
└── default
Expand All @@ -104,7 +112,7 @@ If you need support with other testing frameworks, we recommend to place the tes
In case you want to reuse tests across multiple cookbooks, they should become an extra artifact independent of a Chef cookbook, call [InSpec profiles](https://github.com/chef/inspec/blob/master/docs/profiles.rst). Those can be easiliy added to existing local tests as demonstrated in previous sections. To include remote profiles, adapt the `verifier` attributes in `.kitchen.yml`
```
```yaml
suites:
- name: default
verifier:
Expand All @@ -114,14 +122,14 @@ suites:

`inspec_tests` accepts all values that `inspec exec profile` would expect. We support:

* local directory eg. `/path/to/profile`
* github url `https://github.com/dev-sec/tests-ssh-hardening`
* Chef Supermarket `supermarket://hardening/ssh-hardening` (list all available profiles with `inspec supermarket profiles`)
* Chef Compliance `compliance://base/ssh`
- local directory eg. `/path/to/profile`
- github url `https://github.com/dev-sec/tests-ssh-hardening`
- Chef Supermarket `supermarket://hardening/ssh-hardening` (list all available profiles with `inspec supermarket profiles`)
- Chef Compliance `compliance://base/ssh`

The following example illustrates the usage in a `.kitchen.yml`

```
```yaml
suites:
- name: contains_inspec
run_list:
Expand Down Expand Up @@ -162,10 +170,10 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/chef/kitchen-inspec.
Bug reports and pull requests are welcome on GitHub at <https://github.com/chef/kitchen-inspec>.

## License

Apache 2.0 (see [LICENSE][license])
Apache 2.0 (see [LICENSE])

[license]: https://github.com/chef/kitchen-inspec/blob/master/LICENSE
Loading

0 comments on commit 3ccd656

Please sign in to comment.