dailycrap 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -10
- data/exe/dailycrap +15 -2
- data/lib/dailycrap/version.rb +1 -1
- data/lib/dailycrap.rb +16 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 230fd37ad2ef9e336edf480b205b8b093f3f9f5d
|
4
|
+
data.tar.gz: e409e455379301f1f329939b7e4c9bfcab9790f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dbd1423f6a09079e9bb37299ed052379641e11d4c30fc0d43fbc766af31bcef9cefa1c8f3b2f8db88ebff53b8b53f14c9865ed5f6b2b18a3df563bebaf02bfd
|
7
|
+
data.tar.gz: 88fc0b8a14a3dcf0f8029796db0218f718a38c5cef40433075cfc07b5d90310b3aac50bdc3002d0e2c16831ce4687b83f31e6859fb380b920a33f02e898053d9
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Dailycrap
|
2
2
|
|
3
|
-
Welcome to Dailycrap, the solution to micro management!
|
4
|
-
Your company is using scrum and force you to do that daily meeting?
|
5
|
-
Dailycrap is here to generate that daily meeting for you.
|
6
|
-
Because engineers use automated tools when they can.
|
3
|
+
Welcome to Dailycrap, the solution to micro management!
|
4
|
+
Your company is using scrum and force you to do that daily meeting?
|
5
|
+
Dailycrap is here to generate that daily meeting for you.
|
6
|
+
Because engineers use automated tools when they can.
|
7
7
|
|
8
|
-
Note: This has been done in a few hours and may have some bugs, feel free to report those
|
8
|
+
Note: This has been done in a few hours and may have some bugs, feel free to report those.
|
9
9
|
Expect a lot of breaking changes, it's alpha.
|
10
10
|
|
11
11
|
## Installation
|
@@ -14,10 +14,11 @@ gem install dailycrap
|
|
14
14
|
```
|
15
15
|
|
16
16
|
## Usage
|
17
|
-
Dailycrap assumes your in progress PRs/issues have the label "in progress"
|
18
|
-
It also assumes you are not working on weekends, so Yesterday becomes Friday when you run the script on Monday.
|
19
|
-
|
20
|
-
|
17
|
+
Dailycrap assumes your in progress PRs/issues have the label "in progress"
|
18
|
+
It also assumes you are not working on weekends, so Yesterday becomes Friday when you run the script on Monday.
|
19
|
+
You can always use --day '2017-01-01' to specify a specific date (supports formats supported by Date.parse in ruby)
|
20
|
+
Nothing else should matter
|
21
|
+
You need a file containing only your github token see https://github.com/settings/tokens
|
21
22
|
|
22
23
|
```
|
23
24
|
$> dailycrap -h
|
@@ -25,9 +26,11 @@ $> dailycrap -h
|
|
25
26
|
-t, --token-file=<s> File containing your github token (https://github.com/settings/tokens)
|
26
27
|
-r, --repository=<s> The repository you are working on
|
27
28
|
-o, --organization=<s> Your organization name
|
29
|
+
-d, --day=<s> The day you want to generate a report for (default is yesterday or last friday if monday)
|
30
|
+
-e, --edit send generated report to your $EDITOR
|
28
31
|
-h, --help Show this message
|
29
32
|
|
30
|
-
$> dailycrap --token-file=.github_token --organization your_github_orgname --repository your_repo
|
33
|
+
$> dailycrap --token-file=.github_token --organization your_github_orgname --repository your_repo --edit
|
31
34
|
|
32
35
|
Yesterday
|
33
36
|
Worked on:
|
data/exe/dailycrap
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'dailycrap'
|
4
4
|
require 'date'
|
5
5
|
require 'trollop'
|
6
|
+
require 'tempfile'
|
6
7
|
|
7
8
|
opts = Trollop::options do
|
8
9
|
banner <<-EOS
|
@@ -12,11 +13,23 @@ opts = Trollop::options do
|
|
12
13
|
opt :token_file, "File containing your github token (https://github.com/settings/tokens)", required: true, type: :string
|
13
14
|
opt :repository, "The repository you are working on", required: true, type: :string
|
14
15
|
opt :organization, "Your organization name", default: nil, type: :string
|
16
|
+
opt :day, "The day you want to generate a report for (default is yesterday or last friday if monday)", type: :string
|
17
|
+
opt :edit, "Send generated report to your $EDITOR", default: false
|
15
18
|
end
|
16
19
|
|
17
20
|
crap = Dailycrap::Dailycrap.new(File.read(opts[:token_file]).strip,
|
18
|
-
date: Date.today.monday? ? Date.today - 3 : Date.today - 1,
|
21
|
+
date: opts[:day] ? Date.parse(opts[:day]) : (Date.today.monday? ? Date.today - 3 : Date.today - 1),
|
19
22
|
repo: opts[:repository],
|
20
23
|
organization: opts[:organization])
|
21
24
|
|
22
|
-
|
25
|
+
report = crap.daily
|
26
|
+
puts report
|
27
|
+
|
28
|
+
if opts[:edit]
|
29
|
+
file = Tempfile.new('dailycrap')
|
30
|
+
file.write(report)
|
31
|
+
file.close
|
32
|
+
pid = spawn("#{ENV['EDITOR']} #{file.path}")
|
33
|
+
Process.wait(pid)
|
34
|
+
file.unlink
|
35
|
+
end
|
data/lib/dailycrap/version.rb
CHANGED
data/lib/dailycrap.rb
CHANGED
@@ -23,7 +23,7 @@ module Dailycrap
|
|
23
23
|
closed_prs = []
|
24
24
|
reviewed_prs = []
|
25
25
|
|
26
|
-
in_progress_issues =
|
26
|
+
in_progress_issues = iterate(github.issues) do |iterator|
|
27
27
|
iterator.list(user: @organization, repo: @repo, state: 'open', labels: 'in progress')
|
28
28
|
end.select{|x| x.assignee.login == @user }.map{|x| x.title}
|
29
29
|
|
@@ -54,7 +54,7 @@ module Dailycrap
|
|
54
54
|
|
55
55
|
def events(date)
|
56
56
|
events = github.activity.events.performed(@user)
|
57
|
-
|
57
|
+
iterate(events, date: date, behavior: :at_date) do |iterator|
|
58
58
|
iterator.body
|
59
59
|
end.select{|x| x.repo.name.split('/').last == @repo}
|
60
60
|
end
|
@@ -65,22 +65,22 @@ module Dailycrap
|
|
65
65
|
%Q{
|
66
66
|
#{@date.monday? ? 'Friday' : 'Yesterday'}
|
67
67
|
\tWorked on:
|
68
|
-
\t\t#{worked_on_prs.map{|x| x[:title]}.join("\n\t\t")}
|
68
|
+
\t\t#{worked_on_prs.map{|x| x[:title]}.uniq.join("\n\t\t")}
|
69
69
|
|
70
70
|
\tClosed:
|
71
|
-
\t\t#{closed_prs.join("\n\t\t")}
|
71
|
+
\t\t#{closed_prs.uniq.join("\n\t\t")}
|
72
72
|
|
73
73
|
\tReviewed:
|
74
|
-
\t\t#{reviewed_prs.join("\n\t\t")}
|
74
|
+
\t\t#{reviewed_prs.uniq.join("\n\t\t")}
|
75
75
|
|
76
76
|
Today:
|
77
77
|
\tIn progress:
|
78
|
-
\t\t#{in_progress.join("\n\t\t")}
|
78
|
+
\t\t#{in_progress.uniq.join("\n\t\t")}
|
79
79
|
}.gsub(/^ +/, '')
|
80
80
|
end
|
81
81
|
|
82
82
|
def pr_from_ref(ref)
|
83
|
-
prs =
|
83
|
+
prs = iterate(github.pull_requests, date: @date, behavior: :from_date) do |iterator|
|
84
84
|
iterator.list(user: @organization, repo: @repo, state: 'all')
|
85
85
|
end.map{|x| {ref: x.head.ref, title: x.title, created_at: x.created_at, merged_at: x.merged_at, href: x['_links']['self']['href'] }}
|
86
86
|
prs.find{|x| x[:ref] == ref.gsub('refs/heads/', '')}
|
@@ -94,7 +94,7 @@ module Dailycrap
|
|
94
94
|
@_github ||= Github.new oauth_token: @token
|
95
95
|
end
|
96
96
|
|
97
|
-
def
|
97
|
+
def iterate(iterator, date: nil, behavior: :at_date)
|
98
98
|
total_events = []
|
99
99
|
begin
|
100
100
|
data = yield(iterator)
|
@@ -102,19 +102,14 @@ module Dailycrap
|
|
102
102
|
break if date && data.any?{|x| Date.parse(x.updated_at || x.created_at) < date}
|
103
103
|
iterator = iterator.try(:next_page)
|
104
104
|
end while iterator && iterator.has_next_page?
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
break if date && data.any?{|x| Date.parse(x.updated_at || x.created_at) < date}
|
114
|
-
iterator = iterator.try(:next_page)
|
115
|
-
end while iterator && iterator.has_next_page?
|
116
|
-
date ? total_events.select{ |x| Date.parse(x.updated_at || x.created_at) >= date } : total_events
|
105
|
+
if date
|
106
|
+
if behavior == :at_date
|
107
|
+
total_events.select!{ |x| Date.parse(x.updated_at || x.created_at) == date }
|
108
|
+
elsif behavior == :from_date
|
109
|
+
total_events.select!{ |x| Date.parse(x.updated_at || x.created_at) >= date }
|
110
|
+
end
|
111
|
+
end
|
112
|
+
total_events
|
117
113
|
end
|
118
|
-
|
119
114
|
end
|
120
115
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dailycrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Hagege
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
165
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.
|
166
|
+
rubygems_version: 2.5.1
|
167
167
|
signing_key:
|
168
168
|
specification_version: 4
|
169
169
|
summary: A ruby gem for people who prefer tools over meetings. If you hate scrum this
|