Sha256: d2bd423acf0d7511dde5c454ad4a408e9ac9e466f75617e4ce905c05bef6d07f

Contents?: true

Size: 1.03 KB

Versions: 30

Compression:

Stored size: 1.03 KB

Contents

require "chef/chef_fs/data_handler/data_handler_base"
require "chef/cookbook/metadata"

class Chef
  module ChefFS
    module DataHandler
      class CookbookDataHandler < DataHandlerBase
        def normalize(cookbook, entry)
          version = entry.name
          name = entry.parent.name
          result = normalize_hash(cookbook, {
            "name" => "#{name}-#{version}",
            "version" => version,
            "cookbook_name" => name,
            "json_class" => "Chef::CookbookVersion",
            "chef_type" => "cookbook_version",
            "frozen?" => false,
            "metadata" => {},
          })
          result["metadata"] = normalize_hash(result["metadata"], {
            "version" => version,
            "name" => name,
          })
        end

        def preserve_key?(key)
          return key == "cookbook_name" || key == "version"
        end

        def chef_class
          Chef::Cookbook::Metadata
        end

        # Not using this yet, so not sure if to_ruby will be useful.
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
chef-12.18.31-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.18.31 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.17.44-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.17.44 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.16.42 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.16.42-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.15.19 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.15.19-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.14.89-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.14.89 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.14.77-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.14.77 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.14.60-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.14.60 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.13.37-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.13.37 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.13.30 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.13.30-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.12.15-universal-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.12.15 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb