deploy_log 0.2.5 → 0.2.6
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.
- checksums.yaml +4 -4
- data/bin/deploy_log +1 -1
- data/lib/deploy_log/github/deploys.rb +12 -6
- data/lib/deploy_log/github/helper.rb +20 -15
- data/lib/deploy_log/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef93d5a2afbcc419b9f158b649025ead5cbed923937f8f3fd45fdacbb666e807
|
4
|
+
data.tar.gz: ab722cf7af7ce6b961b86e7710052f5baa314db360b26a341cbe966aaf9852f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1a856e43ad6c276ab50536de857027a8c8aaf45d1b9f7de4eff22fce267d333d41e1fda2d13b16ac6cf99140a3f2769acef8c0812722235b6e7d83989dd3c3
|
7
|
+
data.tar.gz: d955a037e8b3c149a79a03aa6dc48265bf696623eec01b4d132250b04e2d5cfdd96ae023b4627becb8a83a6fb9914447a3941c8596dd5cc4de65ffe23241e1a9
|
data/bin/deploy_log
CHANGED
@@ -13,14 +13,14 @@ module DeployLog
|
|
13
13
|
|
14
14
|
finish = Date.today.to_time + (24 * 60 * 60) - 1 if finish.nil?
|
15
15
|
|
16
|
-
@github.pulls_in_timeframe(start, finish)
|
16
|
+
render @github.pulls_in_timeframe(start, finish)
|
17
17
|
end
|
18
18
|
|
19
19
|
def merged_today
|
20
20
|
start = Date.today.to_time # 12:00AM this morning
|
21
21
|
finish = Date.today.to_time + (24 * 60 * 60) - 1 # 11:59PM tonight
|
22
22
|
|
23
|
-
@github.pulls_in_timeframe(start, finish)
|
23
|
+
render @github.pulls_in_timeframe(start, finish)
|
24
24
|
end
|
25
25
|
|
26
26
|
def merged_on(start)
|
@@ -28,7 +28,7 @@ module DeployLog
|
|
28
28
|
|
29
29
|
finish = start + 24 * 60 * 60 - 1
|
30
30
|
|
31
|
-
@github.pulls_in_timeframe(start, finish)
|
31
|
+
render @github.pulls_in_timeframe(start, finish)
|
32
32
|
end
|
33
33
|
|
34
34
|
def merged_during_week(week_num)
|
@@ -36,15 +36,21 @@ module DeployLog
|
|
36
36
|
|
37
37
|
week = @calendar.week(week_num.to_i)
|
38
38
|
|
39
|
-
@github.pulls_in_timeframe(week[:first], week[:last])
|
39
|
+
render @github.pulls_in_timeframe(week[:first], week[:last])
|
40
40
|
end
|
41
41
|
|
42
42
|
def pr_title(title)
|
43
|
-
@github.search_pulls_by(title, :title)
|
43
|
+
render @github.search_pulls_by(title, :title)
|
44
44
|
end
|
45
45
|
|
46
46
|
def pr_for_branch(branch)
|
47
|
-
@github.search_pulls_by(branch, :ref)
|
47
|
+
render @github.search_pulls_by(branch, :ref)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def render(data)
|
53
|
+
puts data
|
48
54
|
end
|
49
55
|
end
|
50
56
|
end
|
@@ -5,6 +5,8 @@ require 'fileutils'
|
|
5
5
|
|
6
6
|
module DeployLog
|
7
7
|
module Github
|
8
|
+
class FileNotFound < StandardError; end
|
9
|
+
|
8
10
|
class Helper
|
9
11
|
LINE_FORMAT = "%s (%s)\n - Created by %s\n - Branch: %s\n - Merged by %s on %s\n - Changes: %s\n -- %s\n\n"
|
10
12
|
|
@@ -14,8 +16,8 @@ module DeployLog
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def pulls_in_timeframe(date_start = nil, date_end = nil)
|
17
|
-
|
18
|
-
return
|
19
|
+
cache_path = cache(date_start, date_end)
|
20
|
+
return cat(cache_path) if should_show_cache(cache_path)
|
19
21
|
|
20
22
|
@client.auto_paginate = true
|
21
23
|
list = @client.pull_requests(@repo_location,
|
@@ -26,7 +28,7 @@ module DeployLog
|
|
26
28
|
|
27
29
|
prs_covered = 0
|
28
30
|
|
29
|
-
File.open(
|
31
|
+
File.open(cache_path, 'w+') do |f|
|
30
32
|
list.each do |pr|
|
31
33
|
next unless (date_start..date_end).cover? pr.merged_at
|
32
34
|
|
@@ -52,12 +54,12 @@ module DeployLog
|
|
52
54
|
|
53
55
|
return ::Notify.warning("No pull requests have been merged in the requested date range (#{date_start} - #{date_end})") if prs_covered.zero?
|
54
56
|
|
55
|
-
|
57
|
+
cat(cache_path)
|
56
58
|
end
|
57
59
|
|
58
60
|
def search_pulls_by(value, field = :title)
|
59
|
-
|
60
|
-
return
|
61
|
+
cache_path = cache_file(value, field)
|
62
|
+
return cat(cache_path) if should_show_cache(cache_path)
|
61
63
|
|
62
64
|
list = @client.pull_requests(@repo_location,
|
63
65
|
:state => :all,
|
@@ -65,7 +67,7 @@ module DeployLog
|
|
65
67
|
)
|
66
68
|
prs_covered = 0
|
67
69
|
|
68
|
-
File.open(
|
70
|
+
File.open(cache_path, 'w+') do |f|
|
69
71
|
list.each do |pr|
|
70
72
|
next unless nested_hash_value(pr, field).match?(/#{value}\b/)
|
71
73
|
|
@@ -91,7 +93,7 @@ module DeployLog
|
|
91
93
|
|
92
94
|
return ::Notify.warning("No pull requests match the requested term (#{value})") if prs_covered.zero?
|
93
95
|
|
94
|
-
|
96
|
+
cat(cache_path)
|
95
97
|
end
|
96
98
|
|
97
99
|
private
|
@@ -108,18 +110,21 @@ module DeployLog
|
|
108
110
|
end
|
109
111
|
end
|
110
112
|
|
111
|
-
def
|
113
|
+
def cache(*args)
|
112
114
|
hash = Digest::MD5.hexdigest(@repo_location + args.join('|'))
|
113
115
|
path = FileUtils.touch "/tmp/github-deploys-#{hash}.log"
|
114
116
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
117
|
+
path.first
|
118
|
+
end
|
119
|
+
|
120
|
+
def should_show_cache(cache_file_path)
|
121
|
+
File.exist?(cache_file_path) && !File.size(cache_file_path).zero?
|
119
122
|
end
|
120
123
|
|
121
|
-
def
|
122
|
-
|
124
|
+
def cat(path)
|
125
|
+
raise FileNotFound unless should_show_cache(path)
|
126
|
+
|
127
|
+
File.read(path)
|
123
128
|
end
|
124
129
|
|
125
130
|
def formatted_time(time, use_local_time = false)
|
data/lib/deploy_log/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deploy_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Priebe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|