git_analysis 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 96aa1e47bf70c3dfbe05d1c9d1b496ca7caa2c44
4
+ data.tar.gz: 01b16034ded697b0c1d8d986d65691f087696f9e
5
+ SHA512:
6
+ metadata.gz: 638a9b859eccb3076eef73a36c70e55600e7c05894097b8ad08142109caabd1990b963b4da5b53fa1b937d440629af612779eec3a3bd2721f69c16d86d395350
7
+ data.tar.gz: 94d74d2e063e0d46a073ffcf3f711107122774b979b5444a290e83004f9f1907dae2c1d686fd8f0fa9754bef4af1fd78573da7b2b0e9cad4317574b3c4aea8c1
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in git_analysis.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 volanja
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # GitAnalysis
2
+
3
+ Analysis Git-Project
4
+
5
+ ## Installation
6
+
7
+ Install it yourself as:
8
+
9
+ $ gem install git_analysis
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ Commands:
15
+ git-analysis count [-d] # count(email domain only)
16
+ git-analysis help [COMMAND] # Describe available commands or one specific command
17
+ git-analysis version # show version
18
+ ```
19
+
20
+ ### Count E-mail Domain
21
+
22
+ (v0.0.1 is this mode only)
23
+ Count Author's Email Domain. In order to investigate the companies that are participating in this project.
24
+ If most domain is "gmail", this project is developed by private developers.
25
+
26
+ ```sample
27
+ $ git clone git@github.com:volanja/git_analysis.git
28
+ $ cd git_analysis
29
+ $ git-analysis count -d |jq '.'
30
+ {
31
+ "gmail.com": 5
32
+ }
33
+ ```
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/volanja/git_analysis/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/git-analysis ADDED
@@ -0,0 +1,34 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require 'git_analysis'
5
+ require 'rubygems'
6
+ require 'thor'
7
+
8
+ class Cli < Thor
9
+
10
+ desc "count [-d]", "count(email domain only)"
11
+ option :"domain", :type => :boolean, :aliases => '-d', :desc => "count e-mail domain. export json"
12
+ def count
13
+ if options[:domain]
14
+ GitAnalysis.count_domain
15
+ else
16
+ puts "[MUST] Use -d on ver0.0.1"
17
+ end
18
+ end
19
+
20
+ #desc "export", "export"
21
+ #def export
22
+ # GitAnalysis.export
23
+ #end
24
+
25
+ desc "version", "show version"
26
+ def version
27
+ puts GitAnalysis::VERSION
28
+ end
29
+
30
+ end
31
+
32
+ Cli.start
33
+
34
+ exit 0
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'git_analysis/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "git_analysis"
8
+ spec.version = GitAnalysis::VERSION
9
+ spec.authors = ["volanja"]
10
+ spec.email = ["wandervogel.erde@gmail.com"]
11
+ spec.summary = %q{Analysis data by git log}
12
+ spec.description = %q{Analysis data by git log}
13
+ spec.homepage = "https://github.com/volanja"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6' ,'>= 1.6.2'
22
+ spec.add_development_dependency 'rake', '~> 10.3', '>= 10.3.2'
23
+ spec.add_development_dependency 'thor', '~> 0.19', '>= 0.19.1'
24
+ spec.add_development_dependency 'ruport', '~> 1.6', '>= 1.6.3'
25
+ spec.add_development_dependency 'rugged', '~> 0.21', '>= 0.21.0'
26
+ spec.add_development_dependency 'oj', '~> 2.9', '>= 2.9.9'
27
+
28
+ spec.add_runtime_dependency 'thor', '~> 0.19', '>= 0.19.1'
29
+ spec.add_runtime_dependency 'ruport', '~> 1.6', '>= 1.6.3'
30
+ spec.add_runtime_dependency 'rugged', '~> 0.21', '>= 0.21.0'
31
+ spec.add_runtime_dependency 'oj', '~> 2.9', '>= 2.9.9'
32
+ end
@@ -0,0 +1,53 @@
1
+ require "git_analysis/version"
2
+ require "rugged"
3
+ require "fileutils"
4
+ require "pp"
5
+ require "oj"
6
+
7
+ module GitAnalysis
8
+
9
+ # count domain
10
+ def self.count_domain()
11
+ repo = load_repo()
12
+ commits = repo.walk(repo.last_commit).to_a
13
+ domain = Array.new
14
+ commits.each do |c|
15
+ domain << c.author[:email].match(/([a-zA-Z0-9\_\-\.]+$)/)
16
+ end
17
+ count = Hash.new(0)
18
+ domain.each do |elem|
19
+ count[elem] += 1
20
+ end
21
+ puts Oj.dump(count, :mode => :compat)
22
+ end
23
+
24
+ # export
25
+ def self.export()
26
+ repo = load_repo()
27
+ commits = repo.walk(repo.last_commit).to_a
28
+ list = Hash.new
29
+ domain = Array.new
30
+ commits.each do |c|
31
+ log = Hash.new
32
+ log[:sha] = c.oid
33
+ log[:message] = c.message
34
+ log[:time] = c.time
35
+ log[:name] = c.author[:name]
36
+ log[:email] = c.author[:email]
37
+ log[:domain] = c.author[:email].match(/([a-zA-Z0-9\_\-\.]+$)/)[1]
38
+ list["#{c.oid}"] = log
39
+ end
40
+ puts Oj.dump(list, :mode => :compat)
41
+ end
42
+
43
+ # 以降はプライベートメソッド
44
+ private
45
+
46
+ def self.load_repo()
47
+ repo ||= Rugged::Repository.new(Dir::pwd)
48
+ rescue Rugged::RepositoryError, Rugged::OSError
49
+ p 'Rugged::RepositoryError or Rugged::OSError'
50
+ exit 1
51
+ end
52
+
53
+ end
@@ -0,0 +1,3 @@
1
+ module GitAnalysis
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,254 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git_analysis
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - volanja
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 1.6.2
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.6'
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 1.6.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '10.3'
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: 10.3.2
43
+ type: :development
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: '10.3'
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: 10.3.2
53
+ - !ruby/object:Gem::Dependency
54
+ name: thor
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ version: '0.19'
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.19.1
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '0.19'
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: 0.19.1
73
+ - !ruby/object:Gem::Dependency
74
+ name: ruport
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: '1.6'
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.6.3
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '1.6'
90
+ - - '>='
91
+ - !ruby/object:Gem::Version
92
+ version: 1.6.3
93
+ - !ruby/object:Gem::Dependency
94
+ name: rugged
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: '0.21'
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: 0.21.0
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '0.21'
110
+ - - '>='
111
+ - !ruby/object:Gem::Version
112
+ version: 0.21.0
113
+ - !ruby/object:Gem::Dependency
114
+ name: oj
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ~>
118
+ - !ruby/object:Gem::Version
119
+ version: '2.9'
120
+ - - '>='
121
+ - !ruby/object:Gem::Version
122
+ version: 2.9.9
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ~>
128
+ - !ruby/object:Gem::Version
129
+ version: '2.9'
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: 2.9.9
133
+ - !ruby/object:Gem::Dependency
134
+ name: thor
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ~>
138
+ - !ruby/object:Gem::Version
139
+ version: '0.19'
140
+ - - '>='
141
+ - !ruby/object:Gem::Version
142
+ version: 0.19.1
143
+ type: :runtime
144
+ prerelease: false
145
+ version_requirements: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: '0.19'
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: 0.19.1
153
+ - !ruby/object:Gem::Dependency
154
+ name: ruport
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ version: '1.6'
160
+ - - '>='
161
+ - !ruby/object:Gem::Version
162
+ version: 1.6.3
163
+ type: :runtime
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ~>
168
+ - !ruby/object:Gem::Version
169
+ version: '1.6'
170
+ - - '>='
171
+ - !ruby/object:Gem::Version
172
+ version: 1.6.3
173
+ - !ruby/object:Gem::Dependency
174
+ name: rugged
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ~>
178
+ - !ruby/object:Gem::Version
179
+ version: '0.21'
180
+ - - '>='
181
+ - !ruby/object:Gem::Version
182
+ version: 0.21.0
183
+ type: :runtime
184
+ prerelease: false
185
+ version_requirements: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ~>
188
+ - !ruby/object:Gem::Version
189
+ version: '0.21'
190
+ - - '>='
191
+ - !ruby/object:Gem::Version
192
+ version: 0.21.0
193
+ - !ruby/object:Gem::Dependency
194
+ name: oj
195
+ requirement: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - ~>
198
+ - !ruby/object:Gem::Version
199
+ version: '2.9'
200
+ - - '>='
201
+ - !ruby/object:Gem::Version
202
+ version: 2.9.9
203
+ type: :runtime
204
+ prerelease: false
205
+ version_requirements: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ~>
208
+ - !ruby/object:Gem::Version
209
+ version: '2.9'
210
+ - - '>='
211
+ - !ruby/object:Gem::Version
212
+ version: 2.9.9
213
+ description: Analysis data by git log
214
+ email:
215
+ - wandervogel.erde@gmail.com
216
+ executables:
217
+ - git-analysis
218
+ extensions: []
219
+ extra_rdoc_files: []
220
+ files:
221
+ - .gitignore
222
+ - Gemfile
223
+ - LICENSE.txt
224
+ - README.md
225
+ - Rakefile
226
+ - bin/git-analysis
227
+ - git_analysis.gemspec
228
+ - lib/git_analysis.rb
229
+ - lib/git_analysis/version.rb
230
+ homepage: https://github.com/volanja
231
+ licenses:
232
+ - MIT
233
+ metadata: {}
234
+ post_install_message:
235
+ rdoc_options: []
236
+ require_paths:
237
+ - lib
238
+ required_ruby_version: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - '>='
241
+ - !ruby/object:Gem::Version
242
+ version: '0'
243
+ required_rubygems_version: !ruby/object:Gem::Requirement
244
+ requirements:
245
+ - - '>='
246
+ - !ruby/object:Gem::Version
247
+ version: '0'
248
+ requirements: []
249
+ rubyforge_project:
250
+ rubygems_version: 2.1.11
251
+ signing_key:
252
+ specification_version: 4
253
+ summary: Analysis data by git log
254
+ test_files: []