mirror of https://github.com/tomgi/git_stats.git
Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
Tomasz Gieniusz | cb0af46e18 | |
Romain Weeger | c35d2c5708 | |
Tomasz Gieniusz | 34a1d13ea0 | |
Kavi Jivan | 647c9624d0 | |
Tomasz Gieniusz | 6a8078b14a | |
Tomasz Gieniusz | f3f068eed3 | |
Tomasz Gieniusz | 87697be98d | |
flobee | 7e9ac9b10d | |
Peter Dave Hello | fb234fecd9 | |
Peter Dave Hello | 3f526580f5 | |
Tomasz Gieniusz | a0be92949a | |
Tomasz Gieniusz | 8b92d912d2 | |
Tomasz Gieniusz | c55839a62b | |
Tomasz Gieniusz | 920514a1c6 | |
Tomasz Gieniusz | 58a8cca955 |
|
@ -1,6 +1,8 @@
|
|||
language: ruby
|
||||
rvm:
|
||||
- "2.2.5"
|
||||
- 2.2
|
||||
- 2.3
|
||||
- 2.4
|
||||
- ruby-head
|
||||
script:
|
||||
- bundle exec rake
|
||||
|
|
9
Gemfile
9
Gemfile
|
@ -2,12 +2,3 @@ source 'https://rubygems.org'
|
|||
|
||||
# Specify your gem's dependencies in git_stats.gemspec
|
||||
gemspec
|
||||
|
||||
|
||||
group :test do
|
||||
gem 'rake'
|
||||
gem 'pry'
|
||||
gem 'rspec'
|
||||
gem 'factory_girl'
|
||||
gem 'simplecov'
|
||||
end
|
|
@ -17,10 +17,15 @@ It browses the repository and outputs html page with statistics.
|
|||
### Existing ruby/gem environment
|
||||
|
||||
$ gem install git_stats
|
||||
|
||||
### debian stretch (9.*)
|
||||
|
||||
# apt-get install ruby ruby-nokogiri ruby-nokogiri-diff ruby-nokogumbo
|
||||
# gem install git_stats
|
||||
|
||||
### Ubuntu
|
||||
|
||||
$ sudo apt-get install ruby
|
||||
$ sudo apt-get install ruby ruby-dev gcc zlib1g-dev make
|
||||
$ sudo gem install git_stats
|
||||
|
||||
## Usage
|
||||
|
|
|
@ -7,13 +7,13 @@ zh_tw:
|
|||
report_period: 報告分析範圍
|
||||
total_files: 總檔案數量
|
||||
total_lines: 文字總行數
|
||||
total_commits: 總commits數量
|
||||
total_commits: 總 commit 數量
|
||||
authors: 作者資訊及數量
|
||||
commits: Commits
|
||||
commits_by_hour: Commits數量
|
||||
commits_by_hour: Commit 數量
|
||||
files: 檔案數量
|
||||
lines: 文字行數
|
||||
comments: 說明、註解
|
||||
comments: 註解
|
||||
files_by_date: 檔案數量的日期分佈
|
||||
lines_by_date: 行數的日期分佈
|
||||
comments_by_date: 說明、註解的日期分佈
|
||||
|
@ -28,34 +28,34 @@ zh_tw:
|
|||
month: 月份
|
||||
month_of_year: 月份分佈
|
||||
year_month: 年/月分佈
|
||||
commits_by_wday: Commits數量
|
||||
commits_by_month: Commits數量
|
||||
commits_by_year_month: Commits數量
|
||||
commits_by_month_of_year: Commits數量
|
||||
commits_by_wday: Commit 數量
|
||||
commits_by_month: Commit 數量
|
||||
commits_by_year_month: Commit 數量
|
||||
commits_by_month_of_year: Commit 數量
|
||||
year: 年份分佈
|
||||
commits_by_year: Commits數量
|
||||
commits_by_year: Commit 數量
|
||||
activity: 活躍程度
|
||||
activity_by_date: 活躍日期
|
||||
commits_by_date: Commits的日期分佈
|
||||
commits_by_date: Commit 日期分佈
|
||||
insertions_by_author: 該作者新增的行數
|
||||
deletions_by_author: 該作者刪除的行數
|
||||
changed_lines_by_author: 該作者變更的行數
|
||||
best_authors_shown: 個最活躍的作者
|
||||
commits_count_by_author: 該作者commits數量
|
||||
commits_sum_by_author_by_date: Commits數量的日期分佈
|
||||
commits_count_by_author: 該作者 commit 數量
|
||||
commits_sum_by_author_by_date: Commit 數量的日期分佈
|
||||
insertions_by_author_by_date: 增加行數的日期分佈
|
||||
deletions_by_author_by_date: 刪除行數的日期分佈
|
||||
changed_lines_by_author_by_date: 變更行數的日期分佈
|
||||
best_authors: 作者排行
|
||||
insertions: 新增行數
|
||||
deletions: 刪除行數
|
||||
first_commit: 最早的commit
|
||||
last_commit: 最近一次commit
|
||||
first_commit: 最早的 commit
|
||||
last_commit: 最近一次 commit
|
||||
author: 作者
|
||||
show_more: 更多
|
||||
close: 關閉
|
||||
binary: 二進位檔
|
||||
text: 文字檔
|
||||
text: 純文字檔
|
||||
general: 一般資訊
|
||||
details: 細節
|
||||
insertions_by_date: 增加行數的日期分佈
|
||||
|
|
|
@ -19,12 +19,18 @@ Gem::Specification.new do |gem|
|
|||
|
||||
gem.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
|
||||
|
||||
gem.add_dependency('activesupport', '>= 4.0')
|
||||
gem.add_dependency('actionpack', '>= 4.0')
|
||||
gem.add_dependency('tilt', '>= 1.4')
|
||||
gem.add_dependency('haml', '>= 4.0')
|
||||
gem.add_dependency('lazy_high_charts', '>= 1.4')
|
||||
gem.add_dependency('i18n')
|
||||
gem.add_dependency('thor')
|
||||
gem.add_dependency('json_pure')
|
||||
gem.add_dependency('actionpack', '~> 4.2')
|
||||
gem.add_dependency('activesupport', '~> 4.2')
|
||||
gem.add_dependency('haml', '~> 5.0')
|
||||
gem.add_dependency('i18n', '~> 0.8')
|
||||
gem.add_dependency('json_pure', '~> 2.1')
|
||||
gem.add_dependency('lazy_high_charts', '~> 1.5')
|
||||
gem.add_dependency('thor', '~> 0.20')
|
||||
gem.add_dependency('tilt', '~> 2.0')
|
||||
|
||||
gem.add_development_dependency('factory_girl', '~> 4.7')
|
||||
gem.add_development_dependency('pry', '~> 0.11')
|
||||
gem.add_development_dependency('rake', '~> 12.0')
|
||||
gem.add_development_dependency('rspec', '~> 3.4')
|
||||
gem.add_development_dependency('simplecov', '~> 0.11')
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ module GitStats
|
|||
end
|
||||
|
||||
def commits
|
||||
@commits ||= run_and_parse("git rev-list --pretty=format:'%h|%at|%ai|%aE' #{commit_range} #{tree_path} | grep -v commit").map do |commit_line|
|
||||
@commits ||= run_and_parse("git rev-list --pretty=format:'%H|%at|%ai|%aE' #{commit_range} #{tree_path} | grep -v commit").map do |commit_line|
|
||||
Commit.new(
|
||||
repo: self,
|
||||
sha: commit_line[:sha],
|
||||
|
@ -116,7 +116,7 @@ module GitStats
|
|||
end
|
||||
|
||||
def project_version
|
||||
@project_version ||= run("git rev-parse --short #{commit_range}").strip
|
||||
@project_version ||= run("git rev-parse #{commit_range}").strip
|
||||
end
|
||||
|
||||
def project_name
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
module GitStats
|
||||
VERSION = "1.0.16"
|
||||
VERSION = "1.0.17"
|
||||
end
|
||||
|
|
|
@ -33,12 +33,12 @@ describe GitStats::GitData::Repo do
|
|||
end
|
||||
|
||||
it 'should affect commits command' do
|
||||
repo.should_receive(:run).with("git rev-list --pretty=format:'%h|%at|%ai|%aE' abc..def . | grep -v commit").and_return("")
|
||||
repo.should_receive(:run).with("git rev-list --pretty=format:'%H|%at|%ai|%aE' abc..def . | grep -v commit").and_return("")
|
||||
repo.commits
|
||||
end
|
||||
|
||||
it 'should affect project version command' do
|
||||
repo.should_receive(:run).with('git rev-parse --short abc..def').and_return("")
|
||||
repo.should_receive(:run).with('git rev-parse abc..def').and_return("")
|
||||
repo.project_version
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ describe GitStats::GitData::Repo do
|
|||
end
|
||||
|
||||
it 'should parse git revlist output to date sorted commits array' do
|
||||
repo.should_receive(:run).with("git rev-list --pretty=format:'%h|%at|%ai|%aE' HEAD . | grep -v commit").and_return(
|
||||
repo.should_receive(:run).with("git rev-list --pretty=format:'%H|%at|%ai|%aE' HEAD . | grep -v commit").and_return(
|
||||
"e4412c3|1348603824|2012-09-25 22:10:24 +0200|john.doe@gmail.com
|
||||
ce34874|1347482927|2012-09-12 22:48:47 +0200|joe.doe@gmail.com
|
||||
5eab339|1345835073|2012-08-24 21:04:33 +0200|john.doe@gmail.com
|
||||
|
@ -39,7 +39,7 @@ ce34874|1347482927|2012-09-12 22:48:47 +0200|joe.doe@gmail.com
|
|||
end
|
||||
end
|
||||
it 'should parse git rev-parse command to project version' do
|
||||
repo.should_receive(:run).with('git rev-parse --short HEAD').and_return('xyz')
|
||||
repo.should_receive(:run).with('git rev-parse HEAD').and_return('xyz')
|
||||
repo.project_version.should == 'xyz'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ describe GitStats::GitData::Tree do
|
|||
|
||||
it 'should parse git revlist output to date sorted commits array' do
|
||||
repo_tree.should_receive(:run).
|
||||
with("git rev-list --pretty=format:'%h|%at|%ai|%aE' HEAD ./subdir_with_1_commit | grep -v commit").
|
||||
with("git rev-list --pretty=format:'%H|%at|%ai|%aE' HEAD ./subdir_with_1_commit | grep -v commit").
|
||||
and_return("10d1814|1395407506|2014-03-21 14:11:46 +0100|israelrevert@gmail.com")
|
||||
repo_tree.commits.should ==
|
||||
[ GitStats::GitData::Commit.new( repo: repo, sha: "10d1814", stamp: "1395407506",
|
||||
|
|
|
@ -8,8 +8,17 @@ describe GitStats::GitData::Activity do
|
|||
let(:jd) { repo.authors.first! { |a| a.email == 'john.doe@gmail.com' } }
|
||||
|
||||
it 'should filter commits to author' do
|
||||
tg.commits.map(&:sha).should =~ %w(b3b4f81 d60b5ec ab47ef8 2c11f5e c87ecf9 b621a5d 4e7d0e9 872955c)
|
||||
jd.commits.map(&:sha).should =~ %w(fd66657 81e8bef)
|
||||
tg.commits.map(&:sha).should =~ %w(
|
||||
2c11f5e5224dd7d2fab27de0fca2a9a1d0ca4038
|
||||
4e7d0e9e58e27e33d47f94faf4079a49a75931da
|
||||
872955c3a6a4be4d7ae9b2dd4bea659979f0b457
|
||||
ab47ef832c59837afcb626bfe22f0b8f0dc3717e
|
||||
b3b4f819041eb66922abe79ee2513d5ddfb64691
|
||||
b621a5df78e2953a040128191e47a24be9514b5c
|
||||
c87ecf9c0bbdca29d73def8ed442cebf48178d92
|
||||
d60b5eccf4513621bdbd65f408a0d28ff6fa9f5b
|
||||
)
|
||||
jd.commits.map(&:sha).should =~ %w(fd66657521139b1af6fde2927c4a383ecd6508fa 81e8bef75eaa93d772f2ce11d2a266ada1292741)
|
||||
end
|
||||
|
||||
context 'activity' do
|
||||
|
|
|
@ -9,7 +9,7 @@ describe GitStats::GitData::Repo do
|
|||
end
|
||||
|
||||
it 'should retrieve correct file content for old file' do
|
||||
repo.commits.first! { |c| c.sha == 'c87ecf9' }.files.first! { |f| f.filename == 'test.txt' }.content.should == "bb
|
||||
repo.commits.first! { |c| c.sha == 'c87ecf9c0bbdca29d73def8ed442cebf48178d92' }.files.first! { |f| f.filename == 'test.txt' }.content.should == "bb
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,18 @@ describe GitStats::GitData::Repo do
|
|||
end
|
||||
|
||||
it 'should gather all commits sorted by date' do
|
||||
repo.commits.map(&:sha).should =~ %w(b3b4f81 d60b5ec ab47ef8 2c11f5e c87ecf9 b621a5d fd66657 81e8bef 4e7d0e9 872955c)
|
||||
repo.commits.map(&:sha).should =~ %w(
|
||||
2c11f5e5224dd7d2fab27de0fca2a9a1d0ca4038
|
||||
4e7d0e9e58e27e33d47f94faf4079a49a75931da
|
||||
81e8bef75eaa93d772f2ce11d2a266ada1292741
|
||||
872955c3a6a4be4d7ae9b2dd4bea659979f0b457
|
||||
ab47ef832c59837afcb626bfe22f0b8f0dc3717e
|
||||
b3b4f819041eb66922abe79ee2513d5ddfb64691
|
||||
b621a5df78e2953a040128191e47a24be9514b5c
|
||||
c87ecf9c0bbdca29d73def8ed442cebf48178d92
|
||||
d60b5eccf4513621bdbd65f408a0d28ff6fa9f5b
|
||||
fd66657521139b1af6fde2927c4a383ecd6508fa
|
||||
)
|
||||
end
|
||||
|
||||
it 'should return project name from dir' do
|
||||
|
@ -21,7 +32,7 @@ describe GitStats::GitData::Repo do
|
|||
end
|
||||
|
||||
it 'should return project version as last commit hash' do
|
||||
repo.project_version.should == '872955c'
|
||||
repo.project_version.should == '872955c3a6a4be4d7ae9b2dd4bea659979f0b457'
|
||||
end
|
||||
|
||||
it 'should count files in repo' do
|
||||
|
|
|
@ -14,7 +14,11 @@ describe GitStats::GitData::Tree do
|
|||
end
|
||||
|
||||
it 'should gather all commits sorted by date' do
|
||||
repo.commits.map(&:sha).should =~ %w(10d1814 435e0ef 5fd0f5e)
|
||||
repo.commits.map(&:sha).should =~ %w(
|
||||
10d1814b1c4acf1496ba76d40ee4954a2e3908fb
|
||||
435e0ef41e7c4917e4ba635bb44c7d36c5c7b7ad
|
||||
5fd0f5ea90e0ef34a0214ec9c170728913525ff4
|
||||
)
|
||||
end
|
||||
|
||||
it 'should return project name from dir' do
|
||||
|
@ -22,7 +26,7 @@ describe GitStats::GitData::Tree do
|
|||
end
|
||||
|
||||
it 'should return project version as last commit hash' do
|
||||
repo.project_version.should == '5fd0f5e'
|
||||
repo.project_version.should == '5fd0f5ea90e0ef34a0214ec9c170728913525ff4'
|
||||
end
|
||||
|
||||
it 'should count files in repo' do
|
||||
|
@ -79,7 +83,7 @@ describe GitStats::GitData::Tree do
|
|||
end
|
||||
|
||||
it 'should gather all commits sorted by date' do
|
||||
repo.commits.map(&:sha).should =~ %w(10d1814)
|
||||
repo.commits.map(&:sha).should =~ %w(10d1814b1c4acf1496ba76d40ee4954a2e3908fb)
|
||||
end
|
||||
|
||||
it 'should return project name from dir' do
|
||||
|
@ -87,7 +91,7 @@ describe GitStats::GitData::Tree do
|
|||
end
|
||||
|
||||
it 'should return project version as last commit hash' do
|
||||
repo.project_version.should == '5fd0f5e'
|
||||
repo.project_version.should == '5fd0f5ea90e0ef34a0214ec9c170728913525ff4'
|
||||
end
|
||||
|
||||
it 'should count files in repo' do
|
||||
|
@ -144,7 +148,10 @@ describe GitStats::GitData::Tree do
|
|||
end
|
||||
|
||||
it 'should gather all commits sorted by date' do
|
||||
repo.commits.map(&:sha).should =~ %w(435e0ef 5fd0f5e)
|
||||
repo.commits.map(&:sha).should =~ %w(
|
||||
435e0ef41e7c4917e4ba635bb44c7d36c5c7b7ad
|
||||
5fd0f5ea90e0ef34a0214ec9c170728913525ff4
|
||||
)
|
||||
end
|
||||
|
||||
it 'should return project name from dir' do
|
||||
|
@ -152,7 +159,7 @@ describe GitStats::GitData::Tree do
|
|||
end
|
||||
|
||||
it 'should return project version as last commit hash' do
|
||||
repo.project_version.should == '5fd0f5e'
|
||||
repo.project_version.should == '5fd0f5ea90e0ef34a0214ec9c170728913525ff4'
|
||||
end
|
||||
|
||||
it 'should count files in repo' do
|
||||
|
|
Loading…
Reference in New Issue