Class: Achoo::VCS::Git
- Inherits:
-
Object
- Object
- Achoo::VCS::Git
- Defined in:
- lib/achoo/vcs/git.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(dir) ⇒ Git
constructor
A new instance of Git.
- #log_for(date) ⇒ Object
Constructor Details
#initialize(dir) ⇒ Git
Returns a new instance of Git.
9 10 11 |
# File 'lib/achoo/vcs/git.rb', line 9 def initialize(dir) @dir = dir end |
Class Method Details
.repository?(dir) ⇒ Boolean
5 6 7 |
# File 'lib/achoo/vcs/git.rb', line 5 def self.repository?(dir) File.exists?("#{dir}/.git") end |
Instance Method Details
#log_for(date) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/achoo/vcs/git.rb', line 13 def log_for(date) today = date.strftime('%Y-%m-%d') tomorrow = date.next.strftime('%Y-%m-%d') `cd #@dir; git log --author=#{ENV['USER']} --oneline --after=#{today} --before=#{tomorrow} | cut -d ' ' -f 2-` end |