Module: Kettle::Dev::TemplateHelpers
- Defined in:
- sig/kettle/dev/template_helpers.rbs
Overview
Helpers shared by kettle:dev Rake tasks for templating and file ops.
Class Method Summary collapse
-
.apply_common_replacements ⇒ Object
Apply common token replacements used when templating text files.
-
.ask ⇒ Boolean
Simple yes/no prompt.
-
.copy_dir_with_prompt ⇒ void
Copy a directory tree, prompting before creating or overwriting.
-
.copy_file_with_prompt ⇒ Object
Copy a single file with interactive prompts for create/replace.
-
.ensure_clean_git! ⇒ void
Ensure git working tree is clean before making changes in a task.
-
.gem_checkout_root ⇒ String
Root of this gem's checkout (repository root when working from source).
-
.gemspec_metadata ⇒ {
Parse gemspec metadata and derive useful strings When no gemspec is present, gemspec_path may be nil; gh_org/gh_repo may be nil when not derivable.
-
.modified_by_template? ⇒ Boolean
Returns true if the given path was created or replaced by the template task in this run.
-
.project_root ⇒ String
Root of the host project where Rake was invoked.
-
.record_template_result ⇒ void
Record a template action for a destination path.
-
.template_results ⇒ Hash[String, { action: template_action, timestamp: ::Time }]
Access all template results (read-only clone).
-
.write_file ⇒ void
Write file content creating directories as needed.
Class Method Details
.apply_common_replacements ⇒ Object
Apply common token replacements used when templating text files
45 |
# File 'sig/kettle/dev/template_helpers.rbs', line 45
def self.apply_common_replacements: (
|
.ask ⇒ Boolean
Simple yes/no prompt.
15 |
# File 'sig/kettle/dev/template_helpers.rbs', line 15
def self.ask: (String prompt, bool default) -> bool
|
.copy_dir_with_prompt ⇒ void
This method returns an undefined value.
Copy a directory tree, prompting before creating or overwriting.
42 |
# File 'sig/kettle/dev/template_helpers.rbs', line 42
def self.copy_dir_with_prompt: (String src_dir, String dest_dir) -> void
|
.copy_file_with_prompt ⇒ Object
Copy a single file with interactive prompts for create/replace.
34 |
# File 'sig/kettle/dev/template_helpers.rbs', line 34
def self.copy_file_with_prompt: (
|
.ensure_clean_git! ⇒ void
This method returns an undefined value.
Ensure git working tree is clean before making changes in a task. If not a git repo, this is a no-op.
31 |
# File 'sig/kettle/dev/template_helpers.rbs', line 31
def self.ensure_clean_git!: (root: String, task_label: String) -> void
|
.gem_checkout_root ⇒ String
Root of this gem's checkout (repository root when working from source)
12 |
# File 'sig/kettle/dev/template_helpers.rbs', line 12
def self.gem_checkout_root: () -> String
|
.gemspec_metadata ⇒ {
Parse gemspec metadata and derive useful strings When no gemspec is present, gemspec_path may be nil; gh_org/gh_repo may be nil when not derivable.
58 |
# File 'sig/kettle/dev/template_helpers.rbs', line 58
def self.gemspec_metadata: (?String root) -> {
|
.modified_by_template? ⇒ Boolean
Returns true if the given path was created or replaced by the template task in this run
27 |
# File 'sig/kettle/dev/template_helpers.rbs', line 27
def self.modified_by_template?: (String dest_path) -> bool
|
.project_root ⇒ String
Root of the host project where Rake was invoked
9 |
# File 'sig/kettle/dev/template_helpers.rbs', line 9
def self.project_root: () -> String
|
.record_template_result ⇒ void
This method returns an undefined value.
Record a template action for a destination path
21 |
# File 'sig/kettle/dev/template_helpers.rbs', line 21
def self.record_template_result: (String dest_path, template_action action) -> void
|
.template_results ⇒ Hash[String, { action: template_action, timestamp: ::Time }]
Access all template results (read-only clone)
24 |
# File 'sig/kettle/dev/template_helpers.rbs', line 24
def self.template_results: () -> Hash[String, { action: template_action, timestamp: ::Time }]
|
.write_file ⇒ void
This method returns an undefined value.
Write file content creating directories as needed
18 |
# File 'sig/kettle/dev/template_helpers.rbs', line 18
def self.write_file: (String dest_path, String content) -> void
|