Skip to content

Instantly share code, notes, and snippets.

@tknerr
Created October 4, 2013 22:55
Show Gist options
  • Save tknerr/6834213 to your computer and use it in GitHub Desktop.
Save tknerr/6834213 to your computer and use it in GitHub Desktop.
transforms `Berksfile.lock`ed dependencies to `metadata.rb` depends statements
#!/bin/ruby
require 'json'
# parse locked dependencies
json = JSON.parse(`berks list -F json`)
# transform them to metadata.rb format
deps = json['cookbooks'].map { |cb| %Q(depends "#{cb['name']}", "#{cb['version']}") }
# output for copy/paste to metadata
puts ""
puts "copy/paste this into your `metadata.rb`:"
puts ""
puts deps.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment