Sha256: 1d0bfb1c0d7a59991e4dec1e018099a32f2c6c8bbd340928a6bd7d56d020227a

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

require 'chef_fs/file_system/base_fs_object'

module ChefFS
  module FileSystem
    class CookbookFile < BaseFSObject
      def initialize(name, parent, file)
        super(name, parent)
        @file = file
      end

      attr_reader :file

      def checksum
        file[:checksum]
      end

      def read
        old_sign_on_redirect = rest.sign_on_redirect
        rest.sign_on_redirect = false
        begin
          rest.get_rest(file['url'])
        ensure
          rest.sign_on_redirect = true
        end
      end

      def rest
        parent.rest
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
knife-essentials-0.1.1 lib/chef_fs/file_system/cookbook_file.rb
knife-essentials-0.1 lib/chef_fs/file_system/cookbook_file.rb