Class: Opsk::CommitGit
- Inherits:
-
Object
- Object
- Opsk::CommitGit
- Defined in:
- lib/opskeleton/uncommited.rb
Instance Method Summary collapse
- #changed? ⇒ Boolean
-
#initialize(d, options, thor) ⇒ CommitGit
constructor
A new instance of CommitGit.
- #master_commit(d) ⇒ Object
- #report ⇒ Object
Constructor Details
#initialize(d, options, thor) ⇒ CommitGit
5 6 7 8 9 |
# File 'lib/opskeleton/uncommited.rb', line 5 def initialize(d,,thor) @g = Git.init(d) = @thor = thor end |
Instance Method Details
#changed? ⇒ Boolean
11 12 13 |
# File 'lib/opskeleton/uncommited.rb', line 11 def changed? @g.status.changed.keys.length > 0 end |
#master_commit(d) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/opskeleton/uncommited.rb', line 25 def master_commit(d) resp = @thor.yes? "Commit the changes under #{d}? (y/n)" unless ['all'] if(['all'] or resp) @g.checkout('master') if ['message'] @g.commit_all(['message']) else @thor.say 'Commit message:' @g.commit_all(STDIN.gets.chomp) end end end |
#report ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/opskeleton/uncommited.rb', line 15 def report i(changed added untracked).each do |state| @thor.say "#{state} files:\n\n" @g.status.send(state).each do |k,v| @thor.say "- #{k}" end @thor.say "\n" end end |