Class: PrePushHook
- Inherits:
-
Object
- Object
- PrePushHook
- Defined in:
- lib/sfb_scripts/hooks/pre_push_hook.rb
Instance Attribute Summary collapse
-
#push_command ⇒ Object
readonly
Returns the value of attribute push_command.
-
#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
- #check ⇒ Object
-
#initialize(command, env) ⇒ PrePushHook
constructor
A new instance of PrePushHook.
Constructor Details
#initialize(command, env) ⇒ PrePushHook
Returns a new instance of PrePushHook.
8 9 10 11 12 |
# File 'lib/sfb_scripts/hooks/pre_push_hook.rb', line 8 def initialize(command, env) @shell = env[:shell] @repo = env[:repo] @push_command = command end |
Instance Attribute Details
#push_command ⇒ Object (readonly)
Returns the value of attribute push_command.
7 8 9 |
# File 'lib/sfb_scripts/hooks/pre_push_hook.rb', line 7 def push_command @push_command end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
7 8 9 |
# File 'lib/sfb_scripts/hooks/pre_push_hook.rb', line 7 def repo @repo end |
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
7 8 9 |
# File 'lib/sfb_scripts/hooks/pre_push_hook.rb', line 7 def shell @shell end |
Class Method Details
.check(command, env) ⇒ Object
3 4 5 |
# File 'lib/sfb_scripts/hooks/pre_push_hook.rb', line 3 def self.check(command, env) new(command, env).check end |
Instance Method Details
#check ⇒ Object
14 15 16 17 18 19 |
# File 'lib/sfb_scripts/hooks/pre_push_hook.rb', line 14 def check if affects_master? && is_destructive? shell.warn "[Policy] Don't force push or delete master. (Denied by pre-push hook)" exit 1 end end |