Closed arosenhagen closed 10 years ago
Thanks for your patch.
Unfortunately, this breaks compatibility with Berkshelf v2.
INFO: Installing cookbook dependencies with Berkshelf resolver
Could not find command "vendor".
berks install --path
still works with Berkshelf v3, right? If it's not going to be removed anytime soon, I can live with the deprecation warning.
Or, even better, we can figure out a smart way to use the right command depending on the version. (Something like bundle exec berks version
is super slow.)
PS: Just found out that berks install --path
is going to be removed in Berkshelf v4.
unfortunately chef-runner fails with ERROR: exit status 1
while sticking to berks install --path
and Berkshelf 3 :-/
Oh, so they already removed it and only kept the deprecation warning. I'll take a look asap.
Thanks so far.
I think I'm going to make your changes the new default behavior, but still support Berkshelf v2 somehow (e.g. via an environment variable). What do you think?
:+1:
I think I found a good solution to support both versions.
I let chef-runner create and execute this little Ruby helper script:
require "berkshelf"
cookbook_path = ARGV.shift
berksfile = ::Berkshelf::Berksfile.from_file("Berksfile")
::Berkshelf.ui.mute do
if ::Berkshelf::Berksfile.method_defined?(:vendor)
# Berkshelf 3.0 requires the directory to not exist
FileUtils.rm_rf(cookbook_path)
berksfile.vendor(cookbook_path)
else
berksfile.install(:path => cookbook_path)
end
end
This is exactly the code that ChefSpec and Test Kitchen are using. :)
this looks like a very nice solution ;-)
@arosenhagen Please check my changes. :)
(Since you gave me write access, I thought it'd be OK to push directly.)
I think I'll make Berkshelf's output less verbose too, but in a different commit/PR.
Sorry, I'm afraid I can't help out on that end (since go is totally new to me). That's why I gave you write access to the PR branch. So you're good to take it over ;-)
I see. Hope my changes work for you too. Merging now! :)
Berkshelf switched commands from
berks install --path [PATH}
toberks vendor
.