Sha256: 986db6c65a353cb3f07c34d13e0a7808eccf6e0edd62f3e2f823b1136455e9a5

Contents?: true

Size: 720 Bytes

Versions: 4

Compression:

Stored size: 720 Bytes

Contents

require 'chef_fs/file_system/base_fs_dir'

# TODO: take environment into account

module ChefFS
  module FileSystem
    class CookbookSubdir < BaseFSDir
      def initialize(name, parent, ruby_only, recursive)
        super(name, parent)
        @children = []
        @ruby_only = ruby_only
        @recursive = recursive
      end

      attr_reader :versions
      attr_reader :children

      def add_child(child)
        @children << child
      end

      def can_have_child?(name, is_dir)
        if is_dir
          return false if !@recursive
        else
          return false if @ruby_only && name !~ /\.rb$/
        end
        true
      end

      def rest
        parent.rest
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
knife-essentials-0.3.1 lib/chef_fs/file_system/cookbook_subdir.rb
knife-essentials-0.3 lib/chef_fs/file_system/cookbook_subdir.rb
knife-essentials-0.2.1 lib/chef_fs/file_system/cookbook_subdir.rb
knife-essentials-0.2 lib/chef_fs/file_system/cookbook_subdir.rb