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 'base64' | |
require 'time' | |
require 'digest/sha1' | |
require 'openssl' | |
require 'net/https' | |
require 'json' | |
class ChefAPI | |
# Public: Gets/Sets the http object. |
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
class Chef | |
class Provider | |
class File | |
class Copy << Chef::Provider::File | |
def compare_content | |
checksum(@current_resource.path) == checksum(@new_resource.content) | |
end |
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
# ADD this to Rakefile and run it by issuing rake roles.to_json | |
ROLE_DIR = File.expand_path(File.join(TOPDIR, "roles")) | |
namespace :roles do | |
desc "Convert ruby roles from ruby to json, creating/overwriting json files." | |
task :to_json do | |
Dir.glob(File.join(ROLE_DIR, '*.rb')) do |rb_file| | |
role = Chef::Role.new | |
role.from_file(rb_file) | |
json_file = rb_file.sub(/\.rb$/,'.json') |