Class: Commit
- Inherits:
-
Array
- Object
- Array
- Commit
- Defined in:
- lib/commit.rb
Instance Method Summary collapse
- #add(command) ⇒ Object
-
#initialize ⇒ Commit
constructor
A new instance of Commit.
Constructor Details
#initialize ⇒ Commit
Returns a new instance of Commit.
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/commit.rb', line 3 def initialize if(Dir.exists?(".git")) if(!`git status`.include?('nothing to commit') || `git status`.include?('untracked files present')) if(File.exists?('commit.message') && File.read('commit.message').gsub(/\s+/, "").length > 0) self.add "git commit -a -v -m \"#{File.read('commit.message')}\"" self.add "<%File.open('commit.message','w'){|f|f.write('')}%>" else self.add 'git commit -a -v -m "commit all"' end end end end |
Instance Method Details
#add(command) ⇒ Object
16 17 18 |
# File 'lib/commit.rb', line 16 def add command self << command if(!include?(command)) end |