Sha256: ce3fcb24a6110c3970aed4687a69e5649f2df0ca223e3591a4199e76fcfa9cd8

Contents?: true

Size: 1.83 KB

Versions: 6

Compression:

Stored size: 1.83 KB

Contents

# -*- encoding: utf-8 -*-
#
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
#
# Copyright (C) 2013, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'chef/client'
require 'chef/providers'
require 'chef/resources'
require 'chef/cookbook_version'

# Monkey patches to Chef core classes to allow for chef-apply functionality.
class Chef

  # Backwards compatible shim for older Chef clients.
  class Client
    attr_reader :events
  end

  # Chef::CookbookVersion, monkey patched to use simpler file source
  # paths (always uses local files instead of manifest records).
  #
  # Implementation from the sandwich project at:
  # https://github.com/sometimesfood/sandwich
  #
  class CookbookVersion
    # Determines the absolute source filename on disk for various file
    # resources from their relative path
    #
    # @param [Chef::Node] node the node object, ignored
    # @param [Symbol] segment the segment of the current resource, ignored
    # @param [String] source the source file path
    # @param [String] target the target file path, ignored
    # @return [String] the preferred source filename
    def preferred_filename_on_disk_location(node, segment, source, target = nil)
      # keep absolute paths, convert relative paths into absolute paths
      source.start_with?('/') ? source : File.join(Dir.getwd, source)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
busser-0.5.0 lib/busser/chef_ext.rb
busser-0.4.1 lib/busser/chef_ext.rb
busser-0.4.0 lib/busser/chef_ext.rb
busser-0.3.2 lib/busser/chef_ext.rb
busser-0.3.1 lib/busser/chef_ext.rb
busser-0.3.0 lib/busser/chef_ext.rb