Sha256: 85a860124317a17cc08b57d85131efba85e44a6e9acac59ab50bd73f40865c4a
Contents?: true
Size: 704 Bytes
Versions: 5
Compression:
Stored size: 704 Bytes
Contents
require 'git' class Pig WORKING_DIR = File.join(File.dirname(File.expand_path(__FILE__)), "..") NUMBER_OF_COMMITS = 10 def root_dir if defined? Rails Rails.root else WORKING_DIR end end def repository Git.open(root_dir) end def history results = "" commits = repository.log(NUMBER_OF_COMMITS) || [] commits.each do |commit| results << format(commit) end results end def format(commit) "#{commit.to_s} #{commit.author.date.strftime("%Y-%m-%d")} #{commit.author.name}\n" end def call(env) rack_response_template << [history] end def rack_response_template [200, {"Content-Type" => "text/plain"}] end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
pig-0.0.6 | lib/pig.rb |
pig-0.0.5 | lib/pig.rb |
pig-0.0.4 | lib/pig.rb |
pig-0.0.3 | lib/pig.rb |
pig-0.0.2 | lib/pig.rb |