Module: RakeGitCrypt::Mixins::Support

Defined in:
lib/rake_git/mixins/support.rb

Instance Method Summary collapse

Instance Method Details

#ensure_task_with_name_available(task, name) ⇒ Object



14
15
16
# File 'lib/rake_git/mixins/support.rb', line 14

def ensure_task_with_name_available(task, name)
  raise_task_undefined(name) unless task_defined?(task, name)
end

#invoke_and_reenable_task_with_name(task, name, args) ⇒ Object



28
29
30
31
# File 'lib/rake_git/mixins/support.rb', line 28

def invoke_and_reenable_task_with_name(task, name, args)
  invoke_task_with_name(task, name, args)
  reenable_task_with_name(task, name)
end

#invoke_task_with_name(task, name, args) ⇒ Object



18
19
20
21
# File 'lib/rake_git/mixins/support.rb', line 18

def invoke_task_with_name(task, name, args)
  ensure_task_with_name_available(task, name)
  task_by_name(task, name).invoke(*args)
end

#raise_task_undefined(name) ⇒ Object

Raises:

  • (RakeFactory::DependencyTaskMissing)


33
34
35
36
37
38
# File 'lib/rake_git/mixins/support.rb', line 33

def raise_task_undefined(name)
  raise(
    RakeFactory::DependencyTaskMissing,
    "The task with name #{name} does not exist."
  )
end

#reenable_task_with_name(task, name) ⇒ Object



23
24
25
26
# File 'lib/rake_git/mixins/support.rb', line 23

def reenable_task_with_name(task, name)
  ensure_task_with_name_available(task, name)
  task_by_name(task, name).reenable
end

#task_by_name(task, name) ⇒ Object



6
7
8
# File 'lib/rake_git/mixins/support.rb', line 6

def task_by_name(task, name)
  task.application.lookup(name, task.scope)
end

#task_defined?(task, name) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/rake_git/mixins/support.rb', line 10

def task_defined?(task, name)
  !task_by_name(task, name).nil?
end