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 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
- ProjectHealth.configure do |config|
32
- #config.login = '' # use your github name
33
- #config.password = '' # use your github password
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
- {"Name"=>"capistrano/capistrano",
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"=>801,
54
- "Min open time in days"=>5,
55
- "Max open time in days"=>389,
56
- "Average open time in days per request"=>100,
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
- puts
23
- project.stats['Project'].each{|c| table c.last}
24
- puts
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
 
@@ -5,7 +5,6 @@ require 'project-health/project'
5
5
 
6
6
  module ProjectHealth
7
7
  class << self
8
- include Config
9
8
  def new(*args)
10
9
  ProjectHealth::Project.new(*args)
11
10
  end
@@ -8,10 +8,6 @@ class Numeric
8
8
  end
9
9
 
10
10
  module ProjectHealth
11
- module Config
12
- mattr_accessor :login, :password
13
- def configure
14
- yield self
15
- end
16
- end
11
+ include ActiveSupport::Configurable
12
+ config_accessor :login, :password
17
13
  end
@@ -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 => Config.login,
9
- :password=> Config.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 = 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
- { "Name" => name }
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
@@ -1,3 +1,3 @@
1
1
  module ProjectHealth
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: project-health
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: