gitstrider 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 058a36e04c125458280dac0752458ca54c32567e
4
- data.tar.gz: cb1044ea65d0f47a316d012327672a7877a194e9
3
+ metadata.gz: 699caf6f45dbcdc819929a8b3004d6c2020dbca7
4
+ data.tar.gz: 12f1c6c18d232c058e280269f775a0673745cdf0
5
5
  SHA512:
6
- metadata.gz: acd9f63ec0b4b0fac76b9dafa1d7425447d30220e9205618c173db48175d5a526e3b2e40a88973b4dd423a91881bf2130e1c86899aa002ae2e8499669e1eda48
7
- data.tar.gz: 8a73a39d354d53725a01e2171743cc985893d755cdc8d30d1a0f12c13a6a9d142e0cd4ecc9a412b096754132c5317a8e95274a02687a2fbe10b157c5471b2aa0
6
+ metadata.gz: 80ca7bfe0339bfdcb641e0e9441e30d372c86a428d00b5f29d26f31149bebf05734717d1c80ccc44bbf13445367b6e02dd34e43f4fbeb2a673777a97b77bc08e
7
+ data.tar.gz: e146c4dc623c0d8772d54959ca12a1c45741f640520e0141a2a3d37b7edb936938fbfc267ff3d27523aee6248c5d03f0508a0b9f163d4ac51f0255bd05c725b6
@@ -8,16 +8,16 @@ class GitStrider
8
8
 
9
9
  def initialize(workspace, processes_threads, report_path = "CodeQualityReports/GitStrider/git_contribution.html")
10
10
  @root = workspace
11
- in_threads = processes_threads[:max_threads]
12
- in_processes = 1 # processes_threads[:processes]
11
+ in_threads = 20
12
+ in_processes = processes_threads[:max_threads]
13
13
 
14
14
  @config = Hash.new
15
15
  if in_processes and in_threads
16
- puts "Running in #{in_processes}:#{in_threads} processes"
16
+ puts "Running in #{in_processes} threads"
17
17
  @config = {:in_processes => in_processes, :in_threads => in_threads}
18
18
  else
19
- puts "Running in _1:8_ threads"
20
- @config = {:in_processes => 1, :in_threads => 8}
19
+ puts "Running in 20 threads"
20
+ @config = {:in_processes => 20, :in_threads => 20}
21
21
  end
22
22
 
23
23
  @report_path = report_path
@@ -64,9 +64,11 @@ class GitStrider
64
64
  files.add(i)
65
65
  end
66
66
 
67
+ FileUtils.mkdir_p "#{@root}/gs_temp"
67
68
  Parallel.each(files, :in_processes => @config[:in_processes]) do |path|
68
69
  process_file(html_composer, path)
69
70
  end
71
+ FileUtils.rm_r "#{@root}/gs_temp"
70
72
 
71
73
  # closing the html file
72
74
  html_composer.write_html_footer
@@ -81,13 +83,17 @@ class GitStrider
81
83
  private
82
84
  def process_file(html_composer, path)
83
85
  puts " => Processing #{File.basename(path)}"
86
+ temp_file = "#{@root}/gs_temp/gs_temp_#{File.basename(path)}"
87
+
88
+ # taking committers data and storing them temporarily
89
+ `git blame --line-porcelain \"#{path}\" | sed -n 's/^author //p' | sort | uniq -c | sort -rn > #{temp_file}`
84
90
 
85
91
  users_data = Hash.new
86
92
  total_file_lines = File.foreach(path).count.to_f
87
-
93
+
88
94
  Parallel.each(@committers, :in_threads => @config[:in_threads]) do |committer|
89
95
  committer.strip!
90
- user_commits = `git blame master \"#{path}\" | grep -cow \"#{committer}\"`.chomp.to_f
96
+ user_commits = `cat #{temp_file} | grep \"#{committer}\" | sed -n 's/[a-zA-Z].*//p'`.chomp.to_f
91
97
 
92
98
  users_data[committer] = { :commits => user_commits,
93
99
  :file_lines => total_file_lines }
@@ -101,7 +101,7 @@ class HtmlComposer
101
101
  file.write(
102
102
  " </table>
103
103
  <div class=\"footer pull-right\">
104
- <p>visit <a href=\"https://github.com/hadibadjian/git_strider\">GitStrider Github</a></p>
104
+ <p>visit <a href=\"https://github.com/hadibadjian/gitstrider\">GitStrider Github</a></p>
105
105
  </div>
106
106
  </body>
107
107
  </html>")
@@ -1,3 +1,3 @@
1
1
  module GitStrider
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitstrider
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hadi Badjian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-15 00:00:00.000000000 Z
11
+ date: 2014-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description: GitStrider provides a contribution report for a git enabled project.
@@ -50,17 +50,17 @@ require_paths:
50
50
  - lib
51
51
  required_ruby_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.9'
56
56
  required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 2.0.3
63
+ rubygems_version: 2.1.11
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: GitStrider provides a contribution report for a git enabled project. This