Created
February 12, 2013 19:49
-
-
Save MarkRoddy/4772809 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
#!/usr/bin/ruby | |
require 'rubygems' | |
gem 'chef', ">= 0" | |
require 'chef/role' | |
if 1 != ARGV.length then | |
print "Please specify a role name or path to it's ruby file\n" | |
exit | |
end | |
role_name_or_path = ARGV[0]; | |
if File.exists?(role_name_or_path) then | |
role_path = role_name_or_path | |
else | |
role_path = "roles/#{role_name_or_path}.rb" | |
end | |
role = Chef::Role.new | |
role.from_file(role_path) | |
print Chef::JSONCompat.to_json_pretty(role) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment