git-health-check 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -1,24 +1,44 @@
1
1
  # Git Health Check
2
2
 
3
- TODO: Write a gem description
3
+ This gem outputs a set of metrics for your Git repository which allows you to monitor its size over its lifetime.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Install the gem:
8
8
 
9
- gem 'git-health-check'
9
+ $ gem install git-health-check
10
10
 
11
- And then execute:
11
+ ## Usage
12
12
 
13
- $ bundle
13
+ Currently, the gem is best utilised as a post-build step and possibly outside of your push-triggered CI job depending on the size of your repository. Execution should take a couple of seconds for most people but for very large repositories with many thousands of commits - e.g. 1GB+ - it could take 10-15 minutes.
14
14
 
15
- Or install it yourself as:
15
+ To perform a default run (the history threshold is set at 0.5MB):
16
16
 
17
- $ gem install git-health-check
17
+ $ ghc
18
18
 
19
- ## Usage
19
+ To specify a threshold value (in MB) on the history reporting:
20
+
21
+ $ ghc -t 2
22
+
23
+ A report is generated at `healthcheck/report.html`
24
+
25
+ To view a list of available commands:
26
+
27
+ $ ghc -h
28
+
29
+ Usage: ghc [option]
30
+
31
+ Output metrics for your Git repository.
32
+
33
+ Examples:
34
+ ghc
35
+ ghc -t 10
36
+ ghc -t 0.2
20
37
 
21
- TODO: Write usage instructions here
38
+ Options:
39
+ -v, --version Displays the gem version
40
+ -h, --help Displays this help message
41
+ -t, --threshold THRESHOLD Specify history size threshold in MB (default 0.5)
22
42
 
23
43
  ## Contributing
24
44
 
@@ -31,7 +51,10 @@ TODO: Write usage instructions here
31
51
  # To Do:
32
52
 
33
53
  1. add timings
34
- 2. add CLI arguments
35
- 3. improve logic
36
- 4. improve reporting
37
- 5. use Thor instead of OptionParser
54
+ 2. add further CLI arguments (e.g. `-n` for number of results)
55
+ 3. improve general logic - especially git_health_check_command.rb
56
+ 4. improve reporting - something better than ERB
57
+ 5. explore the use of Thor instead of OptionParser
58
+ 6. output number of commits - `git shortlog | grep -E '^[ ]+\w+' | wc -l` *or* `git log --pretty=format:'' | wc -l`
59
+ 7. output total number of commits across all branches - `git rev-list --all | wc -l`
60
+ 8. output contributors - `git shortlog | grep -E '^[^ ]'` *or* `git shortlog -n -s`
@@ -20,7 +20,7 @@ module GitHealthCheck
20
20
  working_copy_output = working_copy.fast_find_in_working_copy
21
21
  history_output = history.search
22
22
 
23
- working_copy_report = Table("object sha", "size (KB)", "compressed (KB)", "path")
23
+ working_copy_report = Table("object sha", "size (kB)", "compressed (kB)", "path")
24
24
  history_report = Table("object sha", "size (MB)", "path", "commit details", "author")
25
25
 
26
26
  working_copy_output.each { |sha, (size, csize, path)| working_copy_report << [sha, size, csize, path] }
@@ -35,7 +35,7 @@ EOB
35
35
 
36
36
  @parser.on("-h", "--help", "Displays this help message") { @command_class = HelpCommand }
37
37
 
38
- @parser.on("-t", "--threshold THRESHOLD", Float, "Specify history size threshold in mB (default 0.5)") do |n|
38
+ @parser.on("-t", "--threshold THRESHOLD", Float, "Specify history size threshold in MB (default 0.5)") do |n|
39
39
  @threshold = n
40
40
  end
41
41
  end
@@ -61,13 +61,14 @@
61
61
  <li><strong>Number of <a href="http://git-scm.com/book/en/Git-Internals-Git-Objects">objects</a> in
62
62
  pack:</strong> <%= @packfile.pack_count[0] %></li>
63
63
 
64
- <li><strong>Total packfile size: </strong><%= @packfile.size_of_pack[0] %>
65
- <% if @packfile.size_of_pack[0].to_i >= 1073741824 %>
66
- <%= 'gb' %>
67
- <% elsif @packfile.size_of_pack[0].to_i >= 1048576 %>
68
- <%= 'mb' %>
64
+ <li><strong>Total packfile size: </strong>
65
+ <% size = @packfile.size_of_pack[0].to_f %>
66
+ <% if size >= 1048576 %>
67
+ <%= size / 1048576 %> GB
68
+ <% elsif size >= 1024 %>
69
+ <%= size / 1024 %> MB
69
70
  <% else %>
70
- <%= 'kB' %>
71
+ <%= size %> kB
71
72
  <% end %>
72
73
  </li>
73
74
  </ul>
@@ -1,3 +1,3 @@
1
1
  module GitHealthCheck
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-health-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
12
+ date: 2013-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruport
@@ -71,7 +71,6 @@ files:
71
71
  - lib/git-health-check/report/report.erb
72
72
  - lib/git-health-check/version.rb
73
73
  - lib/git-health-check/working_copy.rb
74
- - test_client.rb
75
74
  homepage: http://wwww.bensnape.com
76
75
  licenses: []
77
76
  post_install_message:
data/test_client.rb DELETED
@@ -1,6 +0,0 @@
1
- require 'git-health-check'
2
-
3
- ARGV << '-t'
4
- ARGV << '10'
5
-
6
- GitHealthCheck::Cli::Application.new(ARGV).execute