Module: RakeGitCrypt::Mixins::Support
- Included in:
- Tasks::AddUser, Tasks::AddUsers, Tasks::Install, Tasks::Reinstall, Tasks::Uninstall
- Defined in:
- lib/rake_git_crypt/mixins/support.rb
Instance Method Summary collapse
- #ensure_task_with_name_available(task, name) ⇒ Object
- #invoke_and_reenable_task_with_name(task, name, args) ⇒ Object
- #invoke_task_with_name(task, name, args) ⇒ Object
- #raise_task_undefined(name) ⇒ Object
- #reenable_task_with_name(task, name) ⇒ Object
- #task_by_name(task, name) ⇒ Object
- #task_defined?(task, name) ⇒ Boolean
Instance Method Details
#ensure_task_with_name_available(task, name) ⇒ Object
14 15 16 |
# File 'lib/rake_git_crypt/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_crypt/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_crypt/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
33 34 35 36 37 38 |
# File 'lib/rake_git_crypt/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_crypt/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_crypt/mixins/support.rb', line 6 def task_by_name(task, name) task.application.lookup(name, task.scope) end |
#task_defined?(task, name) ⇒ Boolean
10 11 12 |
# File 'lib/rake_git_crypt/mixins/support.rb', line 10 def task_defined?(task, name) !task_by_name(task, name).nil? end |