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

Class Method Details

.apply_common_replacementsObject

Apply common token replacements used when templating text files



45
# File 'sig/kettle/dev/template_helpers.rbs', line 45

def self.apply_common_replacements: (

.askBoolean

Simple yes/no prompt.

Parameters:

  • prompt (String)
  • default (Boolean)

Returns:

  • (Boolean)


15
# File 'sig/kettle/dev/template_helpers.rbs', line 15

def self.ask: (String prompt, bool default) -> bool

.copy_dir_with_promptvoid

This method returns an undefined value.

Copy a directory tree, prompting before creating or overwriting.

Parameters:

  • src_dir (String)
  • dest_dir (String)


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_promptObject

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.

Parameters:

  • root: (String)
  • task_label: (String)


31
# File 'sig/kettle/dev/template_helpers.rbs', line 31

def self.ensure_clean_git!: (root: String, task_label: String) -> void

.gem_checkout_rootString

Root of this gem's checkout (repository root when working from source)

Returns:

  • (String)


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.

Parameters:

  • root (String)

Returns:

  • ({)


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

Parameters:

  • dest_path (String)

Returns:

  • (Boolean)


27
# File 'sig/kettle/dev/template_helpers.rbs', line 27

def self.modified_by_template?: (String dest_path) -> bool

.project_rootString

Root of the host project where Rake was invoked

Returns:

  • (String)


9
# File 'sig/kettle/dev/template_helpers.rbs', line 9

def self.project_root: () -> String

.record_template_resultvoid

This method returns an undefined value.

Record a template action for a destination path

Parameters:

  • dest_path (String)
  • action (template_action)


21
# File 'sig/kettle/dev/template_helpers.rbs', line 21

def self.record_template_result: (String dest_path, template_action action) -> void

.template_resultsHash[String, { action: template_action, timestamp: ::Time }]

Access all template results (read-only clone)

Returns:

  • (Hash[String, { action: template_action, timestamp: ::Time }])


24
# File 'sig/kettle/dev/template_helpers.rbs', line 24

def self.template_results: () -> Hash[String, { action: template_action, timestamp: ::Time }]

.write_filevoid

This method returns an undefined value.

Write file content creating directories as needed

Parameters:

  • dest_path (String)
  • content (String)


18
# File 'sig/kettle/dev/template_helpers.rbs', line 18

def self.write_file: (String dest_path, String content) -> void