Skip to content

Instantly share code, notes, and snippets.

@kisoku
Last active December 30, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kisoku/7765559 to your computer and use it in GitHub Desktop.
Save kisoku/7765559 to your computer and use it in GitHub Desktop.
require 'json'
# quickly generate a list of all the locked versions from Berksfile.lock
# in a format suitable for environment['cookbook_versions']
# basically berks apply without berkshelf
lockfile = JSON.load(IO.read("Berksfile.lock"))
cb_versions = {}
lockfile['sources'].keys.sort.each do |cb|
if lockfile['sources'][cb].has_key? 'locked_version'
cb_versions[cb] = lockfile['sources'][cb]['locked_version']
end
end
puts JSON.pretty_generate(cb_versions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment