Sha256: 53b4a255bd2720a22ab113c4420060aab7b951811b60a32bcd8e148efd922619

Contents?: true

Size: 985 Bytes

Versions: 28

Compression:

Stored size: 985 Bytes

Contents

=begin rdoc
== ChefAttributesFile

Allows for an attributes file to be added to the chef recipe.

== Usage

  has_chef_attributes_file "full_path_to_attributes_file"

== Options

* <tt>file</tt> The location of the attributes file

== Examples

  has_chef_attributes_file PoolParty.lib_dir/"vendor"/"chef"/"apache2"/"attributes"/"apache.rb"
=end
module PoolParty
  module Resources
    
    class ChefAttributesFile < Resource
      
      default_options(
        :file    => nil
      )
      
      def valid?
        f = (file || name)
        raise PoolPartyError.create("ChefAttributesFileError", "You must specify a file that exists for a chef_attributes_file: #{f}") unless File.file?(full_path)
      end
      
      def path
        @path ||= file || name
      end
      
      def full_path
        File.expand_path(path)
      end
      
      def content
        open(path).read
      end
      
      def print_to_chef
        ""
      end
      
    end
    
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.1 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.10 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.11 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.12 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.13 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.14 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.15 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.16 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.17 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.2 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.3 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.4 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.5 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.6 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.7 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
auser-poolparty-1.3.8 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
fairchild-poolparty-1.3.17 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
fairchild-poolparty-1.3.5 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb
poolparty-1.3.15 lib/dependency_resolvers/chef/resources/chef_attributes_file.rb