Class: Tol::Git
- Inherits:
-
Object
- Object
- Tol::Git
- Defined in:
- lib/tol/git.rb
Instance Attribute Summary collapse
-
#terminal_columns ⇒ Object
Returns the value of attribute terminal_columns.
Instance Method Summary collapse
- #commit ⇒ Object
-
#initialize ⇒ Git
constructor
A new instance of Git.
Constructor Details
#initialize ⇒ Git
Returns a new instance of Git.
10 11 12 13 |
# File 'lib/tol/git.rb', line 10 def initialize size = HighLine::SystemExtensions.terminal_size self.terminal_columns = size[0] end |
Instance Attribute Details
#terminal_columns ⇒ Object
Returns the value of attribute terminal_columns.
8 9 10 |
# File 'lib/tol/git.rb', line 8 def terminal_columns @terminal_columns end |
Instance Method Details
#commit ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/tol/git.rb', line 15 def commit puts Rainbow("Committing").foreground(:green) category = nil icon = nil choose do || .prompt = "Category:" .choice "Bug" do category = "bug" icon = ":heavy_exclamation_mark:" end .choice "Enhancement" do category = "enhancement" icon = ":lipstick:" end .choice "Feature" do category = "feature" icon = ":rocket:" end .choice "WIP" do category = "wip" icon = ":construction:" end .choice "Performance" do category = "performance" icon = ":racehorse:" end .choice "Housekeeping" do category = "housekeeping" icon = ":wrench:" end .choice "Cleanup (Code Deletion)" do category = "cleanup" icon = ":bathtub:" end end puts "Message: " = STDIN.gets.gsub("\n", "") branch = `git rev-parse --abbrev-ref HEAD`.gsub("\n", "") = "#{icon} #{}" `git add -u .` `git add .` `git commit -m '#{}'` `git push origin #{branch}` end |