Sha256: 115babdffeab68ce24553d1bc950622442cb5759da5c2b28490b37af9efb535e

Contents?: true

Size: 1.03 KB

Versions: 78

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

78 entries across 78 versions & 1 rubygems

Version Path
chef-11.18.12-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.18.12 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.18.6-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.18.6 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.18.0-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.18.0 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.16.4-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.16.4 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.16.2-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.16.2 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.16.0-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.16.0 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.16.0.rc.0 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.0.0.alpha.1-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.0.0.alpha.1 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.14.6-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.14.6 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.14.2-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-11.14.2 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
chef-12.0.0.alpha.0-x86-mingw32 lib/chef/chef_fs/data_handler/cookbook_data_handler.rb