Class: FeaturesReport::Git
- Inherits:
-
Object
- Object
- FeaturesReport::Git
- Defined in:
- lib/features_report/git.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Class Method Summary collapse
Instance Method Summary collapse
- #git_dir ⇒ Object
-
#initialize(files) ⇒ Git
constructor
A new instance of Git.
- #last_commit(feature) ⇒ Object
Constructor Details
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
29 30 31 |
# File 'lib/features_report/git.rb', line 29 def files @files end |
Class Method Details
.git_repo?(filename) ⇒ Boolean
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/features_report/git.rb', line 4 def self.git_repo?(filename) path = File.(filename) while path and path != "" if File.exist?(path + "/.git") return path end path = path.split("/")[0..-2].join("/") end false end |
Instance Method Details
#git_dir ⇒ Object
20 21 22 |
# File 'lib/features_report/git.rb', line 20 def git_dir @repo.path.split("/")[0..-2].join("/") end |
#last_commit(feature) ⇒ Object
24 25 26 27 |
# File 'lib/features_report/git.rb', line 24 def last_commit(feature) filename = File.(feature.file, git_dir).gsub(/^#{Regexp.escape(git_dir)}\//, "") commit = @repo.log(@repo.head.name, filename).first end |