git_stats 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/README.md +3 -3
- data/bin/git_stats +1 -1
- data/git_stats.gemspec +1 -0
- data/lib/git_stats/base.rb +1 -0
- data/lib/git_stats/cli.rb +17 -5
- data/lib/git_stats/generator.rb +3 -3
- data/lib/git_stats/git_data/repo.rb +2 -2
- data/lib/git_stats/validator.rb +10 -0
- data/lib/git_stats/version.rb +1 -1
- data/spec/git_data/generator_spec.rb +2 -2
- metadata +20 -21
- data/spec/git_data/cli_spec.rb +0 -20
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YWUyMDZmNTY4MTdhMmYwY2Q0ZDY5ZmYyZTNhMTkzY2U5MjU1ODhhZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjVkNGNjODZhOTlkZmIxMTZlOTc5ZGNjZjljMzJkNjBlZWIwY2ZkNQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YjFkYmJmMDBhMmViMjFlZjAxMzA0NDBiMmFhYTdmZmJiMGE3Y2Q2YjhjMDEx
|
10
|
+
YjI0Y2ZjYWJkYTRkMTZiOTY5NmJhODQ4Nzc3NjdiN2ExNzIzYmM1M2FhZDFh
|
11
|
+
MGNkODc4N2I3YTdlMmJkYmQ3ZmYwYWU3Mjk2Zjk3YTIzZTMwMTI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NGUyYjVkYzkwMzYyYjIyMTM5MjUwYmJmYzVhMTQwNDEyOGRkMDBmOTUyYjhj
|
14
|
+
OGJjYjBmN2NiOGFmNDFjYjE4YjAzOTUzMTk0ZmY0MTUyMmZmNzcyYzhiZWMy
|
15
|
+
MzBiMTk1Y2NlN2EzY2I2OWZmYWQ4M2QyNTcxY2Y2YTViZTJjZTU=
|
data/README.md
CHANGED
@@ -20,12 +20,12 @@ It browses the repository and outputs html page with statistics.
|
|
20
20
|
|
21
21
|
### Generator
|
22
22
|
|
23
|
-
$ git_stats
|
24
|
-
|
23
|
+
$ git_stats
|
24
|
+
<follow instructions on the screen>
|
25
25
|
|
26
26
|
### API usage example
|
27
27
|
|
28
|
-
> repo = GitStats::GitData::Repo.new(path: '.')
|
28
|
+
> repo = GitStats::GitData::Repo.new(path: '.', first_commit_sha: 'abcd1234', last_commit_sha: 'HEAD')
|
29
29
|
> repo.authors
|
30
30
|
=> [...]
|
31
31
|
> repo.commits
|
data/bin/git_stats
CHANGED
data/git_stats.gemspec
CHANGED
data/lib/git_stats/base.rb
CHANGED
data/lib/git_stats/cli.rb
CHANGED
@@ -1,15 +1,27 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require "git_stats"
|
3
|
+
require "highline/import"
|
3
4
|
|
4
5
|
class GitStats::CLI
|
5
6
|
|
6
|
-
def start
|
7
|
-
raise "Wrong number of arguments\nUsage: git_stats repo_path output_path <output_lang>" unless [2, 3].include? args.size
|
7
|
+
def start
|
8
8
|
|
9
|
-
repo_path
|
10
|
-
|
9
|
+
repo_path = ask("Repo path? ") { |q|
|
10
|
+
q.default = "."
|
11
|
+
q.validate = lambda { |p| GitStats::Validator.new.valid_repo_path?(p) }
|
12
|
+
q.responses[:not_valid] = "Given path is not a git repository, try again"
|
13
|
+
}
|
11
14
|
|
12
|
-
|
15
|
+
out_path = ask("Output dir? ") { |q| q.default = "./git_stats" }
|
16
|
+
I18n.locale = ask("Language? ") { |q| q.default = "en"; q.answer_type = Symbol }
|
17
|
+
specify_range = agree("Want to specify commits range? ") { |q| q.default = "no" }
|
18
|
+
|
19
|
+
if specify_range
|
20
|
+
first_commit_sha = ask("Starting commit sha? ") { |q| q.default = nil }
|
21
|
+
last_commit_sha = ask("Ending commit sha? ") { |q| q.default = "HEAD" }
|
22
|
+
end
|
23
|
+
|
24
|
+
GitStats::Generator.new(repo_path, out_path, first_commit_sha, last_commit_sha) { |g|
|
13
25
|
g.add_command_observer { |command, result| puts "#{command}" }
|
14
26
|
}.render_all
|
15
27
|
end
|
data/lib/git_stats/generator.rb
CHANGED
@@ -4,10 +4,10 @@ module GitStats
|
|
4
4
|
delegate :add_command_observer, to: :@repo
|
5
5
|
delegate :render_all, to: :@view
|
6
6
|
|
7
|
-
def initialize(repo_path, out_path)
|
7
|
+
def initialize(repo_path, out_path, first_commit_sha = nil, last_commit_sha = "HEAD")
|
8
8
|
validate_repo_path(repo_path)
|
9
9
|
|
10
|
-
@repo = GitData::Repo.new(path: repo_path)
|
10
|
+
@repo = GitData::Repo.new(path: repo_path, first_commit_sha: first_commit_sha, last_commit_sha: last_commit_sha)
|
11
11
|
view_data = StatsView::ViewData.new(@repo)
|
12
12
|
@view = StatsView::View.new(view_data, out_path)
|
13
13
|
|
@@ -18,7 +18,7 @@ module GitStats
|
|
18
18
|
|
19
19
|
|
20
20
|
def validate_repo_path(repo_path)
|
21
|
-
raise ArgumentError, "#{repo_path} is not a git repository" unless
|
21
|
+
raise ArgumentError, "#{repo_path} is not a git repository" unless Validator.new.valid_repo_path?(repo_path)
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
@@ -6,7 +6,7 @@ module GitStats
|
|
6
6
|
class Repo
|
7
7
|
include HashInitializable
|
8
8
|
|
9
|
-
attr_reader :path
|
9
|
+
attr_reader :path, :first_commit_sha, :last_commit_sha
|
10
10
|
|
11
11
|
delegate :files, :files_by_extension, :files_by_extension_count, :lines_by_extension,
|
12
12
|
:files_count, :binary_files, :text_files, :lines_count, to: :last_commit
|
@@ -68,7 +68,7 @@ module GitStats
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def commit_range
|
71
|
-
@first_commit_sha ? "#@first_commit_sha..#{last_commit_sha}"
|
71
|
+
@first_commit_sha.blank? ? last_commit_sha : "#@first_commit_sha..#{last_commit_sha}"
|
72
72
|
end
|
73
73
|
|
74
74
|
def last_commit_sha
|
data/lib/git_stats/version.rb
CHANGED
@@ -15,7 +15,7 @@ describe GitStats::Generator do
|
|
15
15
|
|
16
16
|
it 'should pass command observer to repo' do
|
17
17
|
repo = double('repo')
|
18
|
-
GitStats::GitData::Repo.should_receive(:new).with(path: repo_path).and_return(repo)
|
18
|
+
GitStats::GitData::Repo.should_receive(:new).with(path: repo_path, first_commit_sha: nil, last_commit_sha: "HEAD").and_return(repo)
|
19
19
|
|
20
20
|
generator = GitStats::Generator.new(repo_path, out_path)
|
21
21
|
|
@@ -27,7 +27,7 @@ describe GitStats::Generator do
|
|
27
27
|
|
28
28
|
it 'should render all templates with view data for this repo' do
|
29
29
|
repo = double('repo')
|
30
|
-
GitStats::GitData::Repo.should_receive(:new).with(path: repo_path).and_return(repo)
|
30
|
+
GitStats::GitData::Repo.should_receive(:new).with(path: repo_path, first_commit_sha: nil, last_commit_sha: "HEAD").and_return(repo)
|
31
31
|
|
32
32
|
view_data = double('view_data')
|
33
33
|
GitStats::StatsView::ViewData.should_receive(:new).with(repo).and_return(view_data)
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tomasz Gieniusz
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-04-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: actionpack
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: tilt
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: haml
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: lazy_high_charts
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ! '>='
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ! '>='
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: i18n
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ! '>='
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,20 @@ dependencies:
|
|
102
90
|
type: :runtime
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: highline
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
107
|
requirements:
|
107
108
|
- - ! '>='
|
108
109
|
- !ruby/object:Gem::Version
|
@@ -153,13 +154,13 @@ files:
|
|
153
154
|
- lib/git_stats/stats_view/template.rb
|
154
155
|
- lib/git_stats/stats_view/view.rb
|
155
156
|
- lib/git_stats/stats_view/view_data.rb
|
157
|
+
- lib/git_stats/validator.rb
|
156
158
|
- lib/git_stats/version.rb
|
157
159
|
- spec/by_field_finder_spec.rb
|
158
160
|
- spec/factories.rb
|
159
161
|
- spec/git_data/activity_spec.rb
|
160
162
|
- spec/git_data/author_spec.rb
|
161
163
|
- spec/git_data/blob_spec.rb
|
162
|
-
- spec/git_data/cli_spec.rb
|
163
164
|
- spec/git_data/command_observer_spec.rb
|
164
165
|
- spec/git_data/commit_range_spec.rb
|
165
166
|
- spec/git_data/commit_spec.rb
|
@@ -213,27 +214,26 @@ files:
|
|
213
214
|
- templates/static/index.html
|
214
215
|
homepage: https://github.com/tomgi/git_stats
|
215
216
|
licenses: []
|
217
|
+
metadata: {}
|
216
218
|
post_install_message:
|
217
219
|
rdoc_options: []
|
218
220
|
require_paths:
|
219
221
|
- lib
|
220
222
|
required_ruby_version: !ruby/object:Gem::Requirement
|
221
|
-
none: false
|
222
223
|
requirements:
|
223
224
|
- - ! '>='
|
224
225
|
- !ruby/object:Gem::Version
|
225
226
|
version: 1.9.2
|
226
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
|
-
none: false
|
228
228
|
requirements:
|
229
229
|
- - ! '>='
|
230
230
|
- !ruby/object:Gem::Version
|
231
231
|
version: '0'
|
232
232
|
requirements: []
|
233
233
|
rubyforge_project:
|
234
|
-
rubygems_version:
|
234
|
+
rubygems_version: 2.0.3
|
235
235
|
signing_key:
|
236
|
-
specification_version:
|
236
|
+
specification_version: 4
|
237
237
|
summary: HTML statistics generator from git repository
|
238
238
|
test_files:
|
239
239
|
- spec/by_field_finder_spec.rb
|
@@ -241,7 +241,6 @@ test_files:
|
|
241
241
|
- spec/git_data/activity_spec.rb
|
242
242
|
- spec/git_data/author_spec.rb
|
243
243
|
- spec/git_data/blob_spec.rb
|
244
|
-
- spec/git_data/cli_spec.rb
|
245
244
|
- spec/git_data/command_observer_spec.rb
|
246
245
|
- spec/git_data/commit_range_spec.rb
|
247
246
|
- spec/git_data/commit_spec.rb
|
data/spec/git_data/cli_spec.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe GitStats::CLI do
|
5
|
-
let(:repo_path) { 'repo_path' }
|
6
|
-
let(:out_path) { 'out_path' }
|
7
|
-
|
8
|
-
it 'should invoke generator with console arguments given' do
|
9
|
-
generator = double('generator')
|
10
|
-
GitStats::Generator.should_receive(:new).with(repo_path, out_path).and_return(generator)
|
11
|
-
generator.should_receive(:render_all)
|
12
|
-
|
13
|
-
subject.start(repo_path, out_path)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should raise error when 2 arguments are not given' do
|
17
|
-
expect { subject.start("only one argument") }.to raise_error
|
18
|
-
expect { subject.start("too", "much", "arguments") }.to raise_error
|
19
|
-
end
|
20
|
-
end
|