Class: FolderTemplate::SetupFolderCmd
- Inherits:
-
Object
- Object
- FolderTemplate::SetupFolderCmd
- Defined in:
- lib/folder_template/setup_folder_cmd.rb
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
-
#target_path ⇒ Object
readonly
Returns the value of attribute target_path.
-
#template_name ⇒ Object
readonly
Returns the value of attribute template_name.
-
#template_path ⇒ Object
readonly
Returns the value of attribute template_path.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ SetupFolderCmd
constructor
A new instance of SetupFolderCmd.
- #run(**env) ⇒ Object
Constructor Details
#initialize(*args) ⇒ SetupFolderCmd
Returns a new instance of SetupFolderCmd.
20 21 22 23 24 |
# File 'lib/folder_template/setup_folder_cmd.rb', line 20 def initialize( *args ) parse_args( args.flatten ) @registry = TemplateRegistry.registry_with_default_locations() @template_path = registry.path_for_template( template_name ) end |
Instance Attribute Details
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
17 18 19 |
# File 'lib/folder_template/setup_folder_cmd.rb', line 17 def registry @registry end |
#target_path ⇒ Object (readonly)
Returns the value of attribute target_path.
13 14 15 |
# File 'lib/folder_template/setup_folder_cmd.rb', line 13 def target_path @target_path end |
#template_name ⇒ Object (readonly)
Returns the value of attribute template_name.
14 15 16 |
# File 'lib/folder_template/setup_folder_cmd.rb', line 14 def template_name @template_name end |
#template_path ⇒ Object (readonly)
Returns the value of attribute template_path.
18 19 20 |
# File 'lib/folder_template/setup_folder_cmd.rb', line 18 def template_path @template_path end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
15 16 17 |
# File 'lib/folder_template/setup_folder_cmd.rb', line 15 def variables @variables end |
Class Method Details
.run(*args, **env) ⇒ Object
26 27 28 |
# File 'lib/folder_template/setup_folder_cmd.rb', line 26 def self.run( *args, **env ) self.new( args ).run( env ) end |
Instance Method Details
#run(**env) ⇒ Object
31 32 33 34 35 |
# File 'lib/folder_template/setup_folder_cmd.rb', line 31 def run( **env ) template = FolderTemplate::TemplateFolder.new( template_path ) fs = FolderTemplate::FsAdapter.new( target_path, verbose:true ) template.generate( fs, variables.merge( target_path:target_path ).merge( env ) ) end |