Sha256: 73ee3d5b1691bb1c5345d544d4abd4f0cfeb8c9d62f32d295958bf71dc8b13a0
Contents?: true
Size: 1012 Bytes
Versions: 1
Compression:
Stored size: 1012 Bytes
Contents
module KnifeCookbookDependencies class Lockfile DEFAULT_FILENAME = "#{KCD::DEFAULT_FILENAME}.lock" def initialize(cookbooks) @cookbooks = cookbooks end def write(filename = DEFAULT_FILENAME) content = @cookbooks.map do |cookbook| get_cookbook_definition(cookbook) end.join("\n") File::open(DEFAULT_FILENAME, "wb") { |f| f.write content } end def get_cookbook_definition(cookbook) definition = "cookbook '#{cookbook.name}'" if cookbook.from_git? definition += ", :git => '#{cookbook.git_repo}', :ref => '#{cookbook.git_ref || 'HEAD'}'" elsif cookbook.from_path? definition += ", :path => '#{cookbook.local_path}'" else definition += ", :locked_version => '#{cookbook.locked_version}'" end return definition end def remove! self.class.remove! end class << self def remove! FileUtils.rm_f DEFAULT_FILENAME end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
knife_cookbook_dependencies-0.0.7 | lib/kcd/lockfile.rb |