Class: CommitHookr
- Inherits:
-
Object
- Object
- CommitHookr
- Defined in:
- lib/commit_hookr.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#message_file ⇒ Object
Returns the value of attribute message_file.
Class Method Summary collapse
Instance Method Summary collapse
- #abort! ⇒ Object
- #commit! ⇒ Object
-
#initialize(message_file) ⇒ CommitHookr
constructor
A new instance of CommitHookr.
- #original_message ⇒ Object
- #run ⇒ Object
- #ui ⇒ Object
- #write(message) ⇒ Object
Constructor Details
#initialize(message_file) ⇒ CommitHookr
13 14 15 16 |
# File 'lib/commit_hookr.rb', line 13 def initialize() self. = self. = "" end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
11 12 13 |
# File 'lib/commit_hookr.rb', line 11 def end |
#message_file ⇒ Object
Returns the value of attribute message_file.
11 12 13 |
# File 'lib/commit_hookr.rb', line 11 def end |
Class Method Details
.call(&block) ⇒ Object
7 8 9 |
# File 'lib/commit_hookr.rb', line 7 def self.call(&block) @@hook = block end |
Instance Method Details
#abort! ⇒ Object
32 33 34 |
# File 'lib/commit_hookr.rb', line 32 def abort! exit 1 end |
#commit! ⇒ Object
36 37 38 |
# File 'lib/commit_hookr.rb', line 36 def commit! exit 0 end |
#original_message ⇒ Object
18 19 20 |
# File 'lib/commit_hookr.rb', line 18 def File.read() end |
#run ⇒ Object
22 23 24 25 26 |
# File 'lib/commit_hookr.rb', line 22 def run STDIN.reopen '/dev/tty' unless STDIN.tty? instance_eval &@@hook exit 0 end |
#ui ⇒ Object
28 29 30 |
# File 'lib/commit_hookr.rb', line 28 def ui @highline ||= HighLine.new end |
#write(message) ⇒ Object
40 41 42 43 44 |
# File 'lib/commit_hookr.rb', line 40 def write() File.open(, "w+") do |f| f.write end end |