cykl 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -5
- data/bin/cykl +1 -1
- data/cykl.gemspec +3 -7
- data/lib/cykl.rb +1 -49
- data/lib/cykl/initializer.rb +75 -0
- data/lib/cykl/issues.rb +5 -4
- data/lib/cykl/version.rb +1 -1
- metadata +19 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c99ae9d7e779ef2a320a87ffcb3e1aef9de0d05
|
4
|
+
data.tar.gz: 3334785aeb7e86a06eb94d9518737a8e3b0ac41e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a3c1f622558e13bdcda749654c902de8e7e7ea369d7659835f44ab21dcbec021f2c586df31ed1418044316195d54f337f2d26faf6f8a6780b3f87cfbf4366b6
|
7
|
+
data.tar.gz: e63c0fd8a3a8213a0904c58e507f6378a9b5588bb447eeb519662375f6c03a2ca5b1ee10dd3490faef5f22d2fa996722dd771e71a1a8ee3363e6382e88bc42de
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ board (if the board is connected to Github)
|
|
15
15
|
Add this line to your application's Gemfile:
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
gem 'cykl', '~> 0.1.
|
18
|
+
gem 'cykl', '~> 0.1.4'
|
19
19
|
```
|
20
20
|
|
21
21
|
And then execute:
|
@@ -30,12 +30,19 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
First, be sure to have your Github login details in a `.netrc` in your root directory
|
32
32
|
|
33
|
-
- Just call `cykl` with no arguments to return
|
34
|
-
closed issues assigned to you
|
33
|
+
- Just call `cykl` with no arguments to return at least the
|
34
|
+
last 50 closed issues assigned to you
|
35
35
|
|
36
|
-
- Or `cykl 'owner/repo'` to return
|
37
|
-
from a specific repository
|
36
|
+
- Or `cykl 'owner/repo'` to return at least the last 50
|
37
|
+
closed issues from a specific repository
|
38
38
|
|
39
|
+
#### Options
|
40
|
+
|
41
|
+
`--label`
|
42
|
+
|
43
|
+
- You can provide a label to scope your return to issues only
|
44
|
+
containing the given label, like so: `--label '<your repo label>'`.
|
45
|
+
You can also pass `-l`
|
39
46
|
|
40
47
|
## Contributing
|
41
48
|
|
data/bin/cykl
CHANGED
data/cykl.gemspec
CHANGED
@@ -9,13 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Brandon Burton']
|
10
10
|
spec.email = ['brandon.anthony.burton@gmail.com']
|
11
11
|
|
12
|
-
spec.
|
13
|
-
spec.
|
14
|
-
Cykl uses the Github API to pull information on the last 100 issues in your repo.
|
15
|
-
Currently you can track the average lifetime of your issues, and soon you'll be
|
16
|
-
able to see how long they've spent in a particular column on your project board
|
17
|
-
(if the board is connected to Github).
|
18
|
-
}
|
12
|
+
spec.description = "Track the cycle-time of your repo's issues"
|
13
|
+
spec.summary = spec.description
|
19
14
|
spec.homepage = 'https://github.com/Baron-burton/cykl'
|
20
15
|
spec.license = 'MIT'
|
21
16
|
|
@@ -27,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
27
22
|
|
28
23
|
spec.add_dependency 'netrc', '~> 0.11'
|
29
24
|
spec.add_dependency 'octokit', '~> 4.7'
|
25
|
+
spec.add_dependency 'thor', '~> 0.19.1'
|
30
26
|
|
31
27
|
spec.add_development_dependency 'bundler', '~> 1.15'
|
32
28
|
spec.add_development_dependency 'byebug', '~> 9.0'
|
data/lib/cykl.rb
CHANGED
@@ -1,51 +1,3 @@
|
|
1
1
|
require 'cykl/issues'
|
2
2
|
require 'cykl/version'
|
3
|
-
|
4
|
-
module Cykl
|
5
|
-
class << self
|
6
|
-
attr_reader :cycle_time
|
7
|
-
private :cycle_time
|
8
|
-
|
9
|
-
def time(repo = nil)
|
10
|
-
puts_and_flush "Pulling in your issues, please wait..."
|
11
|
-
issues = Issues.new.list_issues(repo)
|
12
|
-
@cycle_time = average_cycle_time(issues)
|
13
|
-
|
14
|
-
puts_and_flush(cycle_time_message)
|
15
|
-
rescue Octokit::NotFound
|
16
|
-
puts_and_flush('Sorry, Github couldn\'t find anything')
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def cycle_time_message
|
22
|
-
"Your average cycle time is #{cycle_time}" +
|
23
|
-
(cycle_time == 1.00 ? 'day' : 'days')
|
24
|
-
end
|
25
|
-
|
26
|
-
def average_cycle_time(issues)
|
27
|
-
lifetimes = []
|
28
|
-
|
29
|
-
issues.each do |issue|
|
30
|
-
lifetimes << ((issue.closed_at - issue.created_at) / seconds_in_a_day)
|
31
|
-
end
|
32
|
-
|
33
|
-
calculate_average(lifetimes)
|
34
|
-
end
|
35
|
-
|
36
|
-
def calculate_average(data)
|
37
|
-
total = data.inject(:+)
|
38
|
-
|
39
|
-
(total / data.count).round(2)
|
40
|
-
end
|
41
|
-
|
42
|
-
def seconds_in_a_day
|
43
|
-
(24 * 60 * 60)
|
44
|
-
end
|
45
|
-
|
46
|
-
def puts_and_flush(msg)
|
47
|
-
puts msg
|
48
|
-
STDOUT.flush
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
3
|
+
require 'cykl/initializer'
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Cykl
|
4
|
+
class Initializer < Thor
|
5
|
+
attr_reader :cycle_time
|
6
|
+
private :cycle_time
|
7
|
+
|
8
|
+
|
9
|
+
desc 'time REPO', 'returns the average cycle time for your repo'
|
10
|
+
method_option(
|
11
|
+
:label,
|
12
|
+
type: :string,
|
13
|
+
aliases: '-l',
|
14
|
+
lazy_default: '',
|
15
|
+
desc: 'search for repositories with a given label'
|
16
|
+
)
|
17
|
+
|
18
|
+
def time(repo = nil)
|
19
|
+
initializer_message(repo, options)
|
20
|
+
list_of_issues(repo, options)
|
21
|
+
|
22
|
+
puts_and_flush(cycle_time_message)
|
23
|
+
rescue Octokit::NotFound
|
24
|
+
puts_and_flush('Sorry, Github couldn\'t find anything')
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def list_of_issues(repo, options)
|
30
|
+
issues = Issues.new.list_issues(repo, options)
|
31
|
+
@cycle_time = average_cycle_time(issues)
|
32
|
+
end
|
33
|
+
|
34
|
+
def cycle_time_message
|
35
|
+
"\nYour average cycle time is #{cycle_time}" +
|
36
|
+
(cycle_time == 1.00 ? 'day' : 'days')
|
37
|
+
end
|
38
|
+
|
39
|
+
def average_cycle_time(issues)
|
40
|
+
lifetimes = []
|
41
|
+
|
42
|
+
issues.each do |issue|
|
43
|
+
lifetimes << ((issue.closed_at - issue.created_at) / seconds_in_a_day)
|
44
|
+
end
|
45
|
+
|
46
|
+
calculate_average(lifetimes)
|
47
|
+
end
|
48
|
+
|
49
|
+
def calculate_average(data)
|
50
|
+
total = data.inject(:+)
|
51
|
+
|
52
|
+
(total / data.count).round(2)
|
53
|
+
end
|
54
|
+
|
55
|
+
def seconds_in_a_day
|
56
|
+
(24 * 60 * 60)
|
57
|
+
end
|
58
|
+
|
59
|
+
def initializer_message(repo, options)
|
60
|
+
if options.any? && !options[:label].empty?
|
61
|
+
puts_and_flush(
|
62
|
+
"Attempting to pull in your #{options[:label]} issues \n" +
|
63
|
+
"from #{repo}, please wait..."
|
64
|
+
)
|
65
|
+
else
|
66
|
+
puts_and_flush("Pulling in your issues from #{repo}, please wait...")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def puts_and_flush(msg)
|
71
|
+
puts msg
|
72
|
+
STDOUT.flush
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/lib/cykl/issues.rb
CHANGED
@@ -12,24 +12,25 @@ module Cykl
|
|
12
12
|
)
|
13
13
|
end
|
14
14
|
|
15
|
-
def list_issues(repo = nil)
|
15
|
+
def list_issues(repo = nil, options)
|
16
16
|
pr_free_issues = []
|
17
17
|
counter = 1
|
18
18
|
|
19
19
|
while pr_free_issues.count < 50
|
20
|
-
issues = get_issues(repo, counter)
|
20
|
+
issues = get_issues(repo, counter, options)
|
21
21
|
issues.select { |issue| pr_free_issues << issue if issue.pull_request == nil }
|
22
22
|
counter += 1
|
23
23
|
end
|
24
24
|
pr_free_issues
|
25
25
|
end
|
26
26
|
|
27
|
-
def get_issues(repo = nil,
|
27
|
+
def get_issues(repo = nil, page, options)
|
28
28
|
client.issues(
|
29
29
|
repo,
|
30
30
|
state: 'closed',
|
31
31
|
per_page: 100,
|
32
|
-
page:
|
32
|
+
page: page,
|
33
|
+
labels: options[:label]
|
33
34
|
)
|
34
35
|
end
|
35
36
|
end
|
data/lib/cykl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cykl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Burton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: netrc
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,11 +108,7 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '3.0'
|
97
|
-
description:
|
98
|
-
on the last 100 issues in your repo.\n Currently you can
|
99
|
-
track the average lifetime of your issues, and soon you'll be\n able
|
100
|
-
to see how long they've spent in a particular column on your project board\n (if
|
101
|
-
the board is connected to Github).\n "
|
111
|
+
description: Track the cycle-time of your repo's issues
|
102
112
|
email:
|
103
113
|
- brandon.anthony.burton@gmail.com
|
104
114
|
executables:
|
@@ -116,6 +126,7 @@ files:
|
|
116
126
|
- bin/setup
|
117
127
|
- cykl.gemspec
|
118
128
|
- lib/cykl.rb
|
129
|
+
- lib/cykl/initializer.rb
|
119
130
|
- lib/cykl/issues.rb
|
120
131
|
- lib/cykl/version.rb
|
121
132
|
homepage: https://github.com/Baron-burton/cykl
|
@@ -141,5 +152,5 @@ rubyforge_project:
|
|
141
152
|
rubygems_version: 2.4.5.1
|
142
153
|
signing_key:
|
143
154
|
specification_version: 4
|
144
|
-
summary:
|
155
|
+
summary: Track the cycle-time of your repo's issues
|
145
156
|
test_files: []
|