Module: ConditionalCapistrano::Capistrano::InstanceMethods

Defined in:
lib/conditional_capistrano/capistrano.rb

Instance Method Summary collapse

Instance Method Details

#execute_task_with_paths_check(task) ⇒ Object



15
16
17
18
19
# File 'lib/conditional_capistrano/capistrano.rb', line 15

def execute_task_with_paths_check(task)
  return if task.check_for_path_changes? && !trigger?(task)

  execute_task_without_paths_check task
end

#trigger?(task) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/conditional_capistrano/capistrano.rb', line 21

def trigger?(task)
  return false if task.paths_to_check.empty?

  changed_files_cache = changed_files_in_git
  task.paths_to_check.any? do |path|
    changed_files_cache.any? { |file| starts_with_path?(path, file) }
  end
rescue IndexError
  false
rescue NameError
  true
end