Commit 8e7fd69

mo khan <mo@mokhan.ca>
2015-05-01 04:26:53
get specs passing.
1 parent 19a2180
.bundle/config
@@ -1,2 +0,0 @@
----
-BUNDLE_DISABLE_SHARED_GEMS: '1'
recipes/default.rb
@@ -1,8 +1,5 @@
-#
-# Cookbook Name:: mokhan-myface
-# Recipe:: default
-#
-# Copyright 2015, YOUR_COMPANY_NAME
-#
-# All rights reserved - Do Not Redistribute
-#
+package 'apache2'
+
+service 'apache2' do
+  action [:enable, :start]
+end
spec/default_spec.rb
@@ -0,0 +1,11 @@
+describe 'mokhan-myface::default' do
+  let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04').converge(described_recipe) }
+
+  it 'installs apache2' do
+    expect(chef_run).to install_package('apache2')
+  end
+
+  it 'starts the apache2 service' do
+    expect(chef_run).to start_service('apache2')
+  end
+end
spec/spec_helper.rb
@@ -0,0 +1,19 @@
+# This file was generated by the `rspec --init` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# Require this file using `require "spec_helper"` to ensure that it is only
+# loaded once.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+require 'chefspec'
+
+RSpec.configure do |config|
+  config.treat_symbols_as_metadata_keys_with_true_values = true
+  config.run_all_when_everything_filtered = true
+  config.filter_run :focus
+
+  # Run specs in random order to surface order dependencies. If you find an
+  # order dependency and want to debug it, you can fix the order by providing
+  # the seed, which is printed after each run.
+  #     --seed 1234
+  config.order = 'random'
+end
.rspec
@@ -0,0 +1,3 @@
+--color
+--format progress
+--require spec_helper
Gemfile
@@ -1,15 +1,15 @@
 source 'https://rubygems.org'
 
 group :test do
-  gem 'chefspec',         '~> 1.3'
-  gem 'foodcritic',       '~> 2.1'
-  gem 'strainer',         '~> 3.0'
-  gem 'test-kitchen',     '~> 1.0.0.alpha'
-  gem 'kitchen-lxc',      '~> 0.0.1.beta1'
-  gem 'knife-spork',      '~> 1.0.17'
-  gem 'hipchat',          '~> 0.10.0'
+  gem 'chefspec'
+  gem 'foodcritic'
+  gem 'strainer'
+  gem 'test-kitchen'
+  gem 'kitchen-lxc'
+  gem 'knife-spork'
+  gem 'hipchat'
 
-  gem 'guard',            '~> 1.8'
-  gem 'guard-foodcritic', '~> 1.0'
-  gem 'guard-rspec',      '~> 3.0'
+  gem 'guard'
+  gem 'guard-foodcritic'
+  gem 'guard-rspec'
 end
Gemfile.lock
@@ -5,7 +5,7 @@ GEM
     annoy (0.5.6)
       highline (>= 1.5.0)
     app_conf (0.4.2)
-    berkshelf (3.2.3)
+    berkshelf (3.2.4)
       addressable (~> 2.3.4)
       berkshelf-api-client (~> 1.2)
       buff-config (~> 1.0)
@@ -38,39 +38,40 @@ GEM
     celluloid-io (0.16.2)
       celluloid (>= 0.16.0)
       nio4r (>= 1.1.0)
-    chef (11.18.6)
-      chef-zero (~> 2.2, >= 2.2.1)
+    chef (12.3.0)
+      chef-zero (~> 4.1)
       diff-lcs (~> 1.2, >= 1.2.4)
       erubis (~> 2.7)
-      ffi-yajl (~> 1.2)
+      ffi-yajl (>= 1.2, < 3.0)
       highline (~> 1.6, >= 1.6.9)
-      mime-types (~> 1.16)
       mixlib-authentication (~> 1.3)
       mixlib-cli (~> 1.4)
       mixlib-config (~> 2.0)
       mixlib-log (~> 1.3)
-      mixlib-shellout (~> 1.4)
+      mixlib-shellout (>= 2.0.0.rc.0, < 3.0)
       net-ssh (~> 2.6)
       net-ssh-multi (~> 1.1)
-      ohai (~> 7.4)
+      ohai (~> 8.0)
       plist (~> 3.1.0)
       pry (~> 0.9)
-      rest-client (>= 1.0.4, <= 1.6.7)
-    chef-zero (2.2.1)
-      ffi-yajl (~> 1.1)
+      rspec-core (~> 3.2)
+      rspec-expectations (~> 3.2)
+      rspec-mocks (~> 3.2)
+      rspec_junit_formatter (~> 0.2.0)
+      serverspec (~> 2.7)
+      specinfra (~> 2.10)
+    chef-zero (4.2.1)
+      ffi-yajl (>= 1.1, < 3.0)
       hashie (~> 2.0)
       mixlib-log (~> 1.3)
       rack
-    chefspec (1.3.1)
-      chef (>= 10.0)
-      erubis
-      fauxhai (>= 0.1.1, < 2.0)
-      minitest-chef-handler (>= 0.6.0)
-      rspec (~> 2.0)
+      uuidtools (~> 2.1)
+    chefspec (4.2.0)
+      chef (>= 11.14)
+      fauxhai (~> 2.0)
+      rspec (~> 3.0)
     childprocess (0.5.6)
       ffi (~> 1.0, >= 1.0.11)
-    ci_reporter (1.9.3)
-      builder (>= 2.1.2)
     cleanroom (1.0.0)
     coderay (1.1.0)
     dep-selector-libgecode (1.0.2)
@@ -78,84 +79,90 @@ GEM
       dep-selector-libgecode (~> 1.0)
       ffi (~> 1.9)
     diff-lcs (1.2.5)
+    diffy (3.0.7)
     docile (1.1.5)
     drydock (0.6.9)
-    elecksee (1.1.2)
+    elecksee (1.1.4)
       childprocess
       rye
     erubis (2.7.0)
     faraday (0.9.1)
       multipart-post (>= 1.2, < 3)
-    fauxhai (1.1.1)
-      httparty
+    fauxhai (2.3.0)
       net-ssh
       ohai
     ffi (1.9.8)
-    ffi-yajl (1.4.0)
-      ffi (~> 1.5)
+    ffi-yajl (2.2.0)
       libyajl2 (~> 1.2)
-    foodcritic (2.2.0)
+    foodcritic (4.0.0)
       erubis
-      gherkin (~> 2.11.7)
-      nokogiri (~> 1.5.4)
-      treetop (~> 1.4.10)
-      yajl-ruby (~> 1.1.0)
+      gherkin (~> 2.11)
+      nokogiri (~> 1.5)
+      rake
+      rufus-lru (~> 1.0)
+      treetop (~> 1.4)
+      yajl-ruby (~> 1.1)
     formatador (0.2.5)
-    gherkin (2.11.8)
+    gherkin (2.12.2)
       multi_json (~> 1.3)
     git (1.2.9.1)
-    guard (1.8.3)
+    guard (2.12.5)
       formatador (>= 0.2.4)
-      listen (~> 1.3)
-      lumberjack (>= 1.0.2)
-      pry (>= 0.9.10)
-      thor (>= 0.14.6)
+      listen (~> 2.7)
+      lumberjack (~> 1.0)
+      nenv (~> 0.1)
+      notiffany (~> 0.0)
+      pry (>= 0.9.12)
+      shellany (~> 0.0)
+      thor (>= 0.18.1)
+    guard-compat (1.2.1)
     guard-foodcritic (1.0.3)
       foodcritic (>= 1.3, < 5.0)
       guard (>= 1.0, < 3.0)
-    guard-rspec (3.1.0)
-      guard (>= 1.8)
-      rspec (~> 2.13)
+    guard-rspec (4.5.0)
+      guard (~> 2.1)
+      guard-compat (~> 1.1)
+      rspec (>= 2.99.0, < 4.0)
     hashie (2.1.2)
-    highline (1.7.1)
-    hipchat (0.10.1)
+    highline (1.7.2)
+    hipchat (1.5.1)
       httparty
+      mimemagic
     hitimes (1.2.2)
     httparty (0.13.3)
       json (~> 1.8)
       multi_xml (>= 0.5.2)
     ipaddress (0.8.0)
     json (1.8.2)
-    kitchen-lxc (0.0.1)
-      elecksee (>= 1.0.14)
-      test-kitchen (>= 1.0.0.beta.4)
-    knife-spork (1.0.17)
+    kitchen-lxc (0.1.4)
+      elecksee (~> 1.0, >= 1.0.22)
+      test-kitchen (~> 1.2, >= 1.2.1)
+    knife-spork (1.5.1)
       app_conf (>= 0.4.0)
-      chef (>= 0.10.4)
+      chef (>= 11.0.0)
+      diffy (>= 3.0.1)
       git (>= 1.2.5)
     libyajl2 (1.2.0)
-    listen (1.3.1)
+    listen (2.10.0)
+      celluloid (~> 0.16.0)
       rb-fsevent (>= 0.9.3)
       rb-inotify (>= 0.9)
-      rb-kqueue (>= 0.2)
     lumberjack (1.0.9)
     method_source (0.8.2)
-    mime-types (1.25.1)
+    mime-types (2.5)
+    mimemagic (0.3.0)
+    mini_portile (0.6.2)
     minitar (0.5.4)
-    minitest (4.7.5)
-    minitest-chef-handler (1.0.3)
-      chef (>= 10.12.0)
-      ci_reporter (< 2.0)
-      minitest (~> 4.7.3)
     mixlib-authentication (1.3.0)
       mixlib-log
     mixlib-cli (1.5.0)
     mixlib-config (2.1.0)
     mixlib-log (1.6.0)
-    mixlib-shellout (1.6.1)
+    mixlib-shellout (2.0.1)
     multi_json (1.11.0)
     multi_xml (0.5.5)
     multipart-post (2.0.0)
+    nenv (0.2.0)
     net-http-persistent (2.9.4)
     net-scp (1.2.1)
       net-ssh (>= 2.6.5)
@@ -166,18 +173,23 @@ GEM
       net-ssh (>= 2.6.5)
       net-ssh-gateway (>= 1.2.0)
     nio4r (1.1.0)
-    nokogiri (1.5.11)
+    nokogiri (1.6.6.2)
+      mini_portile (~> 0.6.0)
+    notiffany (0.0.6)
+      nenv (~> 0.1)
+      shellany (~> 0.0)
     octokit (3.8.0)
       sawyer (~> 0.6.0, >= 0.5.3)
-    ohai (7.4.1)
+    ohai (8.3.0)
       ffi (~> 1.9)
-      ffi-yajl (~> 1.1)
+      ffi-yajl (>= 1.1, < 3.0)
       ipaddress
-      mime-types (~> 1.16)
+      mime-types (~> 2.0)
       mixlib-cli
       mixlib-config (~> 2.0)
       mixlib-log
-      mixlib-shellout (~> 1.2)
+      mixlib-shellout (~> 2.0)
+      rake (~> 10.1)
       systemu (~> 2.6.4)
       wmi-lite (~> 1.0)
     plist (3.1.0)
@@ -187,13 +199,10 @@ GEM
       method_source (~> 0.8.1)
       slop (~> 3.4)
     rack (1.6.0)
+    rake (10.4.2)
     rb-fsevent (0.9.4)
     rb-inotify (0.9.5)
       ffi (>= 0.5.0)
-    rb-kqueue (0.2.3)
-      ffi (>= 0.5.0)
-    rest-client (1.6.7)
-      mime-types (>= 1.16)
     retryable (2.0.1)
     ridley (4.1.2)
       addressable
@@ -212,30 +221,51 @@ GEM
       retryable (>= 2.0.0)
       semverse (~> 1.1)
       varia_model (~> 0.4)
-    rspec (2.99.0)
-      rspec-core (~> 2.99.0)
-      rspec-expectations (~> 2.99.0)
-      rspec-mocks (~> 2.99.0)
-    rspec-core (2.99.2)
-    rspec-expectations (2.99.2)
-      diff-lcs (>= 1.1.3, < 2.0)
-    rspec-mocks (2.99.3)
-    rye (0.9.12)
+    rspec (3.2.0)
+      rspec-core (~> 3.2.0)
+      rspec-expectations (~> 3.2.0)
+      rspec-mocks (~> 3.2.0)
+    rspec-core (3.2.3)
+      rspec-support (~> 3.2.0)
+    rspec-expectations (3.2.1)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.2.0)
+    rspec-its (1.2.0)
+      rspec-core (>= 3.0.0)
+      rspec-expectations (>= 3.0.0)
+    rspec-mocks (3.2.1)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.2.0)
+    rspec-support (3.2.2)
+    rspec_junit_formatter (0.2.1)
+      builder (< 4)
+      rspec-core (>= 2, < 4, != 2.12.0)
+    rufus-lru (1.0.5)
+    rye (0.9.13)
       annoy
       docile (>= 1.0.1)
       highline (>= 1.5.1)
       net-scp (>= 1.0.2)
       net-ssh (>= 2.0.13)
       sysinfo (>= 0.8.1)
-    safe_yaml (0.9.7)
+    safe_yaml (1.0.4)
     sawyer (0.6.0)
       addressable (~> 2.3.5)
       faraday (~> 0.8, < 0.10)
     semverse (1.2.1)
+    serverspec (2.14.1)
+      multi_json
+      rspec (~> 3.0)
+      rspec-its
+      specinfra (~> 2.25)
+    shellany (0.0.1)
     slop (3.6.0)
     solve (1.2.1)
       dep_selector (~> 1.0)
       semverse (~> 1.1)
+    specinfra (2.30.2)
+      net-scp
+      net-ssh
     storable (0.8.9)
     strainer (3.4.0)
       berkshelf (>= 2.0, < 4.0)
@@ -244,35 +274,35 @@ GEM
       drydock
       storable
     systemu (2.6.5)
-    test-kitchen (1.0.0)
-      mixlib-shellout (~> 1.2)
+    test-kitchen (1.4.0)
+      mixlib-shellout (>= 1.2, < 3.0)
       net-scp (~> 1.1)
       net-ssh (~> 2.7)
-      safe_yaml (~> 0.9)
+      safe_yaml (~> 1.0)
       thor (~> 0.18)
     thor (0.19.1)
     timers (4.0.1)
       hitimes
-    treetop (1.4.15)
-      polyglot
-      polyglot (>= 0.3.1)
+    treetop (1.6.2)
+      polyglot (~> 0.3)
+    uuidtools (2.1.5)
     varia_model (0.4.0)
       buff-extensions (~> 1.0)
       hashie (>= 2.0.2, < 3.0.0)
     wmi-lite (1.0.0)
-    yajl-ruby (1.1.0)
+    yajl-ruby (1.2.1)
 
 PLATFORMS
   ruby
 
 DEPENDENCIES
-  chefspec (~> 1.3)
-  foodcritic (~> 2.1)
-  guard (~> 1.8)
-  guard-foodcritic (~> 1.0)
-  guard-rspec (~> 3.0)
-  hipchat (~> 0.10.0)
-  kitchen-lxc (~> 0.0.1.beta1)
-  knife-spork (~> 1.0.17)
-  strainer (~> 3.0)
-  test-kitchen (~> 1.0.0.alpha)
+  chefspec
+  foodcritic
+  guard
+  guard-foodcritic
+  guard-rspec
+  hipchat
+  kitchen-lxc
+  knife-spork
+  strainer
+  test-kitchen
Guardfile
@@ -0,0 +1,12 @@
+guard :rspec, cli: '--color', all_on_start: false do
+  watch(%r{^spec/.+_spec\.rb$})
+  watch(%r{recipes/(.+)\.rb$})     { |m| "spec/#{m[1]}_spec.rb" }
+  watch('spec/spec_helper.rb')  { 'spec' }
+end
+
+guard :foodcritic, cookbook_paths: '.', all_on_start: false do
+  watch(%r{attributes/.+\.rb$})
+  watch(%r{providers/.+\.rb$})
+  watch(%r{recipes/.+\.rb$})
+  watch(%r{resources/.+\.rb$})
+end
metadata.rb
@@ -1,6 +1,6 @@
 name             'mokhan-myface'
-maintainer       'YOUR_COMPANY_NAME'
-maintainer_email 'YOUR_EMAIL'
+maintainer       'mo khan'
+maintainer_email 'mo@mokhan.ca'
 license          'All rights reserved'
 description      'Installs/Configures mokhan-myface'
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
Strainerfile
@@ -0,0 +1,3 @@
+knife:       bundle exec knife cookbook test $COOKBOOK
+foodcritic:  bundle exec foodcritic $SANDBOX/$COOKBOOK -f any
+rspec:       bundle exec rspec