Last active
December 30, 2015 02:49
-
-
Save kisoku/7765559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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