Sha256: 639f242f2470ae3c0fc813a1745944c201d61dc23277b38c03ff73450a8c7aac

Contents?: true

Size: 956 Bytes

Versions: 20

Compression:

Stored size: 956 Bytes

Contents

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

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
knife-essentials-1.3 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.2.1 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.2 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.1.1 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.1 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.0.0 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.0.0.beta5 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.0.0.beta4 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.0.0.beta3 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.0.0.beta2 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-1.0.0.beta1 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-0.9.8 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-0.9.7 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-0.9.6 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-0.9.5 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-0.9.4 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-0.9.3 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-0.9.2 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-0.9.1 lib/chef_fs/data_handler/cookbook_data_handler.rb
knife-essentials-0.9.0 lib/chef_fs/data_handler/cookbook_data_handler.rb