Created
September 21, 2011 13:21
-
-
Save tuttinator/1232019 to your computer and use it in GitHub Desktop.
Grit example methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'grit' | |
repo = Grit::Repo.new("/Users/Caleb/Documents/Rails Projects/welcomemat") | |
# loop through all git commits | |
puts repo.commits.each do |commit| | |
puts commit.author #author | |
puts commit.authored_date #datestamp | |
puts commit.message #git commit message | |
end | |
# loop through the file structure | |
repo.tree.contents.each { |item| puts item.name } | |
# get all files | |
all_files = repo.status.map { |stat_file| stat_file.path } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment