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.
11 12 13 |
# File 'lib/achoo/vcs/git.rb', line 11 def initialize(dir) @dir = dir end |
Class Method Details
.repository?(dir) ⇒ Boolean
7 8 9 |
# File 'lib/achoo/vcs/git.rb', line 7 def self.repository?(dir) File.exists?("#{dir}/.git") end |
Instance Method Details
#log_for(date) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/achoo/vcs/git.rb', line 15 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 |