project-health 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 +62 -9
- data/bin/project-health +10 -3
- data/lib/project-health.rb +0 -1
- data/lib/project-health/config.rb +2 -6
- data/lib/project-health/project.rb +2 -2
- data/lib/project-health/report/basic.rb +20 -3
- data/lib/project-health/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -24,13 +24,61 @@ gem install project-health
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
+
### From command line:
|
28
|
+
|
29
|
+
Set GitHub username/password to increase API rates
|
30
|
+
|
31
|
+
```bash
|
32
|
+
export GITHUB_USERNAME=username
|
33
|
+
export GITHUB_PASSWORD=password
|
34
|
+
```
|
35
|
+
|
36
|
+
```bash
|
37
|
+
project-health capistrano/capistrano
|
38
|
+
```
|
39
|
+
|
40
|
+
Result
|
41
|
+
|
42
|
+
```
|
43
|
+
Showing project health for capistrano/capistrano
|
44
|
+
|
45
|
+
Basic
|
46
|
+
┌─────────────┬─────────────────────────────────────┐
|
47
|
+
│ Name ╎ capistrano/capistrano │
|
48
|
+
│ Description ╎ Remote multi-server automation tool │
|
49
|
+
│ Created ╎ 2009-02-26T16:14:04Z │
|
50
|
+
│ Last push ╎ 2012-11-09T07:48:26Z │
|
51
|
+
│ Language ╎ Ruby │
|
52
|
+
│ Stars ╎ 2853 │
|
53
|
+
└─────────────┴─────────────────────────────────────┘
|
54
|
+
|
55
|
+
Pull Requests
|
56
|
+
┌────────────────────────────────┬───────┐
|
57
|
+
│ All ╎ 142 │
|
58
|
+
│ Open ╎ 8 │
|
59
|
+
│ Closed ╎ 134 │
|
60
|
+
│ Open % ╎ 5.63 │
|
61
|
+
│ Closed % ╎ 94.37 │
|
62
|
+
│ Open/Closed % ratio ╎ 0.06 │
|
63
|
+
│ Open time in days ╎ 804 │
|
64
|
+
│ Min open time in days ╎ 6 │
|
65
|
+
│ Max open time in days ╎ 390 │
|
66
|
+
│ Average days request is opened ╎ 100 │
|
67
|
+
│ Health ╎ Good │
|
68
|
+
└────────────────────────────────┴───────┘
|
69
|
+
|
70
|
+
```
|
71
|
+
|
72
|
+
### From code:
|
73
|
+
|
27
74
|
```ruby
|
28
75
|
require 'pp'
|
29
76
|
require 'project-health'
|
30
77
|
|
31
|
-
|
32
|
-
|
33
|
-
#
|
78
|
+
# Set GitHub username/password to increase API rates
|
79
|
+
ProjectHealth.config do |c|
|
80
|
+
#c.login = '' # use your github name
|
81
|
+
#c.password = '' # use your github password
|
34
82
|
end
|
35
83
|
|
36
84
|
project = ProjectHealth.new('capistrano/capistrano')
|
@@ -42,7 +90,13 @@ Result
|
|
42
90
|
|
43
91
|
```ruby
|
44
92
|
{"Project"=>
|
45
|
-
{"
|
93
|
+
{"Basic"=>
|
94
|
+
{"Name"=>"capistrano/capistrano",
|
95
|
+
"Description"=>"Remote multi-server automation tool",
|
96
|
+
"Created"=>"2009-02-26T16:14:04Z",
|
97
|
+
"Last push"=>"2012-11-09T07:48:26Z",
|
98
|
+
"Language"=>"Ruby",
|
99
|
+
"Stars"=>2853},
|
46
100
|
"Pull Requests"=>
|
47
101
|
{"All"=>142,
|
48
102
|
"Open"=>8,
|
@@ -50,14 +104,13 @@ Result
|
|
50
104
|
"Open %"=>5.63,
|
51
105
|
"Closed %"=>94.37,
|
52
106
|
"Open/Closed % ratio"=>0.06,
|
53
|
-
"Open time in days"=>
|
54
|
-
"Min open time in days"=>
|
55
|
-
"Max open time in days"=>
|
56
|
-
"Average
|
107
|
+
"Open time in days"=>804,
|
108
|
+
"Min open time in days"=>6,
|
109
|
+
"Max open time in days"=>390,
|
110
|
+
"Average days request is opened"=>100,
|
57
111
|
"Health"=>"Good"}}}
|
58
112
|
```
|
59
113
|
|
60
|
-
|
61
114
|
## Contributing
|
62
115
|
|
63
116
|
1. Fork it
|
data/bin/project-health
CHANGED
@@ -15,13 +15,20 @@ end
|
|
15
15
|
|
16
16
|
def show_project_stats(repo)
|
17
17
|
extend Hirb::Console
|
18
|
+
|
19
|
+
ProjectHealth.config do |c|
|
20
|
+
c.login = ENV["GITHUB_USERNAME"]
|
21
|
+
c.password = ENV["GITHUB_PASSWORD"]
|
22
|
+
end
|
18
23
|
project = ProjectHealth.new(repo)
|
19
24
|
puts "Project Health Version: #{ProjectHealth::VERSION}"
|
20
25
|
puts
|
21
26
|
puts "Showing project health for #{repo}"
|
22
|
-
|
23
|
-
|
24
|
-
|
27
|
+
project.stats['Project'].each do |c|
|
28
|
+
puts
|
29
|
+
puts c.first
|
30
|
+
table(c.last, headers: false, unicode: true, description: false)
|
31
|
+
end
|
25
32
|
puts
|
26
33
|
end
|
27
34
|
|
data/lib/project-health.rb
CHANGED
@@ -5,8 +5,8 @@ module ProjectHealth
|
|
5
5
|
|
6
6
|
def initialize(name)
|
7
7
|
@oct = Octokit::Client.new(:auto_traversal => true,
|
8
|
-
:per_page => 500, :login =>
|
9
|
-
:password=>
|
8
|
+
:per_page => 500, :login => ProjectHealth.config.login,
|
9
|
+
:password=> ProjectHealth.config.password)
|
10
10
|
@name = name
|
11
11
|
@reports = []
|
12
12
|
add_report :basic
|
@@ -1,14 +1,31 @@
|
|
1
1
|
module ProjectHealth
|
2
2
|
class BasicReport
|
3
3
|
|
4
|
-
attr_reader :name
|
4
|
+
attr_reader :name, :title, :language, :stars,
|
5
|
+
:created, :last_push, :description
|
5
6
|
|
6
7
|
def initialize(oct, name)
|
7
|
-
@name
|
8
|
+
@name = name
|
9
|
+
repo = oct.repo(name)
|
10
|
+
@language = repo["language"]
|
11
|
+
@stars = repo["watchers_count"]
|
12
|
+
@created = repo["created_at"]
|
13
|
+
@last_push = repo["pushed_at"]
|
14
|
+
@description = repo["description"]
|
8
15
|
end
|
9
16
|
|
10
17
|
def stats
|
11
|
-
{
|
18
|
+
{
|
19
|
+
"Basic" =>
|
20
|
+
{
|
21
|
+
"Name" => name,
|
22
|
+
"Description" => description,
|
23
|
+
"Created" => created,
|
24
|
+
"Last push" => last_push,
|
25
|
+
"Language" => language,
|
26
|
+
"Stars" => stars
|
27
|
+
}
|
28
|
+
}
|
12
29
|
end
|
13
30
|
end
|
14
31
|
end
|