Class: Dotsync::HookRunner

Inherits:
Object
  • Object
show all
Includes:
PathUtils
Defined in:
lib/dotsync/utils/hook_runner.rb

Constant Summary

Constants included from PathUtils

PathUtils::ENV_VARS_COLOR

Instance Method Summary collapse

Methods included from PathUtils

#colorize_env_vars, #expand_env_vars, #extract_env_vars, #path_is_parent_or_same?, #relative_to_absolute, #sanitize_path, #translate_tmp_path

Constructor Details

#initialize(mapping:, changed_files:, logger:) ⇒ HookRunner

Returns a new instance of HookRunner.



10
11
12
13
14
# File 'lib/dotsync/utils/hook_runner.rb', line 10

def initialize(mapping:, changed_files:, logger:)
  @mapping = mapping
  @changed_files = changed_files
  @logger = logger
end

Instance Method Details

#executeObject



16
17
18
19
20
21
# File 'lib/dotsync/utils/hook_runner.rb', line 16

def execute
  @mapping.hooks.map do |command|
    expanded = expand_template(command)
    run_command(expanded)
  end
end

#previewObject



23
24
25
# File 'lib/dotsync/utils/hook_runner.rb', line 23

def preview
  @mapping.hooks.map { |command| expand_template(command) }
end