Class: Rabal::PluginTree

Inherits:
DirectoryTree show all
Includes:
Util
Defined in:
lib/rabal/plugin_tree.rb

Overview

Represents the root of a plugin directory structure. This plugin could also only represent a single FileTree by having the ‘directory’ it represents being ‘.’

Instance Attribute Summary collapse

Attributes inherited from DirectoryTree

#dir_name, #parent_dir

Attributes inherited from Tree

#children, #name, #parameters, #parent

Instance Method Summary collapse

Methods included from Util

#replace_known_words

Methods inherited from DirectoryTree

#action, #after_action, #before_action

Methods inherited from ActionTree

#action, #after_action, #before_action, #process

Methods inherited from Tree

#<<, #add_at_path, #current_path, #depth, #each, #find_subtree, #has_subtree?, #is_leaf?, #is_root?, #method_missing, #root, #size, #tree_at_path, #walk

Constructor Details

#initialize(options, src_directory, dest_directory = ".") ⇒ PluginTree

create a new Plugin Tree based upon a source directory. This ‘mounts’ the src_directory into the dest_directory in the project. The dest_directory defaults to “.” . The options are a hash that are propogated to the parameters member variable.



21
22
23
24
25
# File 'lib/rabal/plugin_tree.rb', line 21

def initialize(options,src_directory,dest_directory= ".")
    super(dest_directory)
    @src_directory = src_directory
    @parameters = OpenStruct.new(options)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rabal::Tree

Instance Attribute Details

#src_directoryObject

the source directory from which the project is generated



14
15
16
# File 'lib/rabal/plugin_tree.rb', line 14

def src_directory
  @src_directory
end

Instance Method Details

#post_addObject

populating the tree needs to take place after the PluginTree has been added to the Tree, but before the processing of the tree takes place



32
33
34
# File 'lib/rabal/plugin_tree.rb', line 32

def post_add
    populate_tree(src_directory)
end