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 21 22 |
# File 'lib/achoo/vcs/git.rb', line 15 def log_for(date) format = '%Y-%m-%dT00:00:00' from = date.strftime(format) to = (date+1).strftime(format) cmd = "cd #@dir; git log --author=#{ENV['USER']} --oneline --after=#{from} --before=#{to} | cut -d ' ' -f 2-" `#{cmd}` end |