Compare commits

...

15 Commits

Author SHA1 Message Date
Tomasz Gieniusz cb0af46e18
Merge pull request #98 from weeger/patch-1
Add missing library on install
2019-03-07 12:34:38 +01:00
Romain Weeger c35d2c5708
Add missing library on install
For people who have not every required packages, or working like me from a fresh docker container.
2019-02-18 15:56:19 +01:00
Tomasz Gieniusz 34a1d13ea0
Merge pull request #96 from kjivan/master
Add ruby-dev package to prereq install for ubuntu
2019-01-30 10:18:00 +01:00
Kavi Jivan 647c9624d0
Add ruby-dev package to prereq install for ubuntu 2019-01-12 00:06:13 -05:00
Tomasz Gieniusz 6a8078b14a
Merge pull request #84 from PeterDaveHello/update-travis-ci
Update ruby version used on Travis CI
2018-09-04 11:39:33 +02:00
Tomasz Gieniusz f3f068eed3
Merge pull request #85 from PeterDaveHello/improve-zh_tw
Improve zh_tw translation
2018-09-04 11:39:14 +02:00
Tomasz Gieniusz 87697be98d
Merge pull request #89 from flobee/patch-1
Adds hint for debian stable (9.*) installs
2018-09-04 11:38:41 +02:00
flobee 7e9ac9b10d
Update README.md 2018-08-13 21:31:11 +02:00
Peter Dave Hello fb234fecd9 Update ruby version used on Travis CI
- Use 2.2 instead of 2.2.5 for the latest v2.2.x
 - Add more versions including v2.3, v2.4
2018-01-09 11:52:15 +08:00
Peter Dave Hello 3f526580f5 Improve zh_tw translation 2018-01-09 11:20:17 +08:00
Tomasz Gieniusz a0be92949a
Bump to 1.0.17 2017-12-01 12:25:39 +01:00
Tomasz Gieniusz 8b92d912d2
Merge pull request #80 from tomgi/use_semantic_versioning_for_dependencies
Using semantic versioning for dependencies
2017-12-01 12:24:57 +01:00
Tomasz Gieniusz c55839a62b
Using semantic versioning for dependencies 2017-12-01 12:18:28 +01:00
Tomasz Gieniusz 920514a1c6
Merge pull request #79 from tomgi/switch_short_commit_sha_to_full_sha_to_remove_ambiguity
Switched short commit SHA to full SHA to remove ambiguity
2017-12-01 12:13:01 +01:00
Tomasz Gieniusz 58a8cca955
Switched short commit SHA to full SHA to remove ambiguity 2017-12-01 11:57:53 +01:00
14 changed files with 83 additions and 52 deletions

View File

@ -1,6 +1,8 @@
language: ruby
rvm:
- "2.2.5"
- 2.2
- 2.3
- 2.4
- ruby-head
script:
- bundle exec rake

View File

@ -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

View File

@ -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

View File

@ -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: 增加行數的日期分佈

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
# -*- encoding : utf-8 -*-
module GitStats
VERSION = "1.0.16"
VERSION = "1.0.17"
end

View File

@ -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

View File

@ -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

View File

@ -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",

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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