0.0
No commit activity in last 3 years
No release in over 3 years
Shim functionality for Berkshelf
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

berkshelf-shims

Build Status

Provide shims functionality for berkshelf.

Until berkshelf/berkshelf#120 Berkshelf supported a --shims options that would create a directory of soft links referencing versioned cookbooks installed in the Berkshelf. Under the new Vagrant plugin, this was no longer needed and thus removed.

However, under chefspec, the functionality is still useful. The gem provides equivalent functionality.

Just like Berkshelf used to do, berkshelf-shims creates a 'cookbook' directory in the same directory as the Berksfile and populates it with soft links.

Usage

Setup Berkshelf as normal and generate a Berskfile.lock. Without the .lock file berkshelf-gems has nothing to read and will fail.

Add the gem to your Gemfile.

gem 'berkshelf-shims'

Add an appropriate hook for your testing framework.

RSpec hook

Put the following into spec/spec_helper.rb.

require 'berkshelf-shims'

RSpec.configure do |config|
  config.before(:suite) do
    BerkshelfShims::create_shims(File.join(File.dirname(__FILE__), '..'))
  end
end

When instantiating the chef runner, pass in path to the created cookbook directory.

ChefSpec::ChefRunner.new(:cookbook_path => "#{root_dir}/cookbooks")

Please notice that create_shims takes the root directory of the project while, ChefRunner.new needs the created 'cookbooks' directory.