Class: HookManager
- Inherits:
-
Object
- Object
- HookManager
- Defined in:
- lib/sfb_scripts/hook_manager.rb
Instance Attribute Summary collapse
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ HookManager
constructor
A new instance of HookManager.
- #install! ⇒ Object
- #is_installed? ⇒ Boolean
Constructor Details
#initialize(env) ⇒ HookManager
Returns a new instance of HookManager.
9 10 11 12 |
# File 'lib/sfb_scripts/hook_manager.rb', line 9 def initialize(env) @shell = env[:shell] @repo = env[:repo] end |
Instance Attribute Details
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
7 8 9 |
# File 'lib/sfb_scripts/hook_manager.rb', line 7 def repo @repo end |
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
7 8 9 |
# File 'lib/sfb_scripts/hook_manager.rb', line 7 def shell @shell end |
Class Method Details
.install!(env) ⇒ Object
3 4 5 |
# File 'lib/sfb_scripts/hook_manager.rb', line 3 def self.install!(env) new(env).install! end |
Instance Method Details
#install! ⇒ Object
18 19 20 21 22 23 |
# File 'lib/sfb_scripts/hook_manager.rb', line 18 def install! return if is_installed? create_file make_executable end |
#is_installed? ⇒ Boolean
14 15 16 |
# File 'lib/sfb_scripts/hook_manager.rb', line 14 def is_installed? File.file?('.git/hooks/pre-push') end |