deploy_log 0.2.0 → 0.2.1a

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +22 -0
  4. data/_config.yml +1 -0
  5. data/bin/deploy_log +7 -1
  6. data/deploy_log.gemspec +1 -1
  7. data/docs/CODE_OF_CONDUCT_md.html +162 -0
  8. data/docs/DeployLog/Calendar.html +154 -0
  9. data/docs/DeployLog/Error.html +103 -0
  10. data/docs/DeployLog/Github/Deploys.html +388 -0
  11. data/docs/DeployLog/Github/Helper.html +314 -0
  12. data/docs/DeployLog/Github.html +96 -0
  13. data/docs/DeployLog.html +112 -0
  14. data/docs/DeployLogTest.html +117 -0
  15. data/docs/Gemfile.html +98 -0
  16. data/docs/LICENSE_txt.html +104 -0
  17. data/docs/README_md.html +219 -0
  18. data/docs/Rakefile.html +107 -0
  19. data/docs/_config.yml +1 -0
  20. data/docs/bin/setup.html +100 -0
  21. data/docs/created.rid +30 -0
  22. data/docs/css/fonts.css +167 -0
  23. data/docs/css/rdoc.css +590 -0
  24. data/docs/deploy_log_gemspec.html +125 -0
  25. data/docs/fonts/Lato-Light.ttf +0 -0
  26. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  27. data/docs/fonts/Lato-Regular.ttf +0 -0
  28. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  29. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  30. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  31. data/docs/images/add.png +0 -0
  32. data/docs/images/arrow_up.png +0 -0
  33. data/docs/images/brick.png +0 -0
  34. data/docs/images/brick_link.png +0 -0
  35. data/docs/images/bug.png +0 -0
  36. data/docs/images/bullet_black.png +0 -0
  37. data/docs/images/bullet_toggle_minus.png +0 -0
  38. data/docs/images/bullet_toggle_plus.png +0 -0
  39. data/docs/images/date.png +0 -0
  40. data/docs/images/delete.png +0 -0
  41. data/docs/images/find.png +0 -0
  42. data/docs/images/loadingAnimation.gif +0 -0
  43. data/docs/images/macFFBgHack.png +0 -0
  44. data/docs/images/package.png +0 -0
  45. data/docs/images/page_green.png +0 -0
  46. data/docs/images/page_white_text.png +0 -0
  47. data/docs/images/page_white_width.png +0 -0
  48. data/docs/images/plugin.png +0 -0
  49. data/docs/images/ruby.png +0 -0
  50. data/docs/images/tag_blue.png +0 -0
  51. data/docs/images/tag_green.png +0 -0
  52. data/docs/images/transparent.png +0 -0
  53. data/docs/images/wrench.png +0 -0
  54. data/docs/images/wrench_orange.png +0 -0
  55. data/docs/images/zoom.png +0 -0
  56. data/docs/index.html +117 -0
  57. data/docs/js/darkfish.js +161 -0
  58. data/docs/js/jquery.js +4 -0
  59. data/docs/js/navigation.js +141 -0
  60. data/docs/js/navigation.js.gz +0 -0
  61. data/docs/js/search.js +109 -0
  62. data/docs/js/search_index.js +1 -0
  63. data/docs/js/search_index.js.gz +0 -0
  64. data/docs/js/searcher.js +229 -0
  65. data/docs/js/searcher.js.gz +0 -0
  66. data/docs/table_of_contents.html +213 -0
  67. data/lib/deploy_log/github/deploys.rb +3 -1
  68. data/lib/deploy_log/github/helper.rb +30 -3
  69. data/lib/deploy_log/version.rb +1 -1
  70. metadata +65 -4
@@ -0,0 +1,213 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>Table of Contents - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/jquery.js"></script>
15
+ <script src="./js/darkfish.js"></script>
16
+
17
+ <link href="./css/fonts.css" rel="stylesheet">
18
+ <link href="./css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+
23
+ <body id="top" class="table-of-contents">
24
+ <main role="main">
25
+ <h1 class="class">Table of Contents - RDoc Documentation</h1>
26
+
27
+
28
+
29
+ <h2 id="pages">Pages</h2>
30
+ <ul>
31
+
32
+ <li class="file">
33
+ <a href="CODE_OF_CONDUCT_md.html">CODE_OF_CONDUCT</a>
34
+
35
+ <ul>
36
+
37
+ <li><a href="CODE_OF_CONDUCT_md.html#label-Contributor+Covenant+Code+of+Conduct">Contributor Covenant Code of Conduct</a>
38
+
39
+ <li><a href="CODE_OF_CONDUCT_md.html#label-Our+Pledge">Our Pledge</a>
40
+
41
+ <li><a href="CODE_OF_CONDUCT_md.html#label-Our+Standards">Our Standards</a>
42
+
43
+ <li><a href="CODE_OF_CONDUCT_md.html#label-Our+Responsibilities">Our Responsibilities</a>
44
+
45
+ <li><a href="CODE_OF_CONDUCT_md.html#label-Scope">Scope</a>
46
+
47
+ <li><a href="CODE_OF_CONDUCT_md.html#label-Enforcement">Enforcement</a>
48
+
49
+ <li><a href="CODE_OF_CONDUCT_md.html#label-Attribution">Attribution</a>
50
+
51
+ </ul>
52
+
53
+ </li>
54
+
55
+ <li class="file">
56
+ <a href="Gemfile.html">Gemfile</a>
57
+
58
+ </li>
59
+
60
+ <li class="file">
61
+ <a href="LICENSE_txt.html">LICENSE</a>
62
+
63
+ </li>
64
+
65
+ <li class="file">
66
+ <a href="README_md.html">README</a>
67
+
68
+ <ul>
69
+
70
+ <li><a href="README_md.html#label-DeployLog">DeployLog</a>
71
+
72
+ <li><a href="README_md.html#label-Installation">Installation</a>
73
+
74
+ <li><a href="README_md.html#label-Usage">Usage</a>
75
+
76
+ <li><a href="README_md.html#label-Development">Development</a>
77
+
78
+ <li><a href="README_md.html#label-Contributing">Contributing</a>
79
+
80
+ <li><a href="README_md.html#label-License">License</a>
81
+
82
+ <li><a href="README_md.html#label-Code+of+Conduct">Code of Conduct</a>
83
+
84
+ </ul>
85
+
86
+ </li>
87
+
88
+ <li class="file">
89
+ <a href="Rakefile.html">Rakefile</a>
90
+
91
+ </li>
92
+
93
+ <li class="file">
94
+ <a href="bin/setup.html">setup</a>
95
+
96
+ </li>
97
+
98
+ <li class="file">
99
+ <a href="deploy_log_gemspec.html">deploy_log.gemspec</a>
100
+
101
+ </li>
102
+
103
+ </ul>
104
+
105
+
106
+ <h2 id="classes">Classes and Modules</h2>
107
+ <ul>
108
+
109
+ <li class="module">
110
+ <a href="DeployLog.html">DeployLog</a>
111
+
112
+ </li>
113
+
114
+ <li class="class">
115
+ <a href="DeployLog/Calendar.html">DeployLog::Calendar</a>
116
+
117
+ </li>
118
+
119
+ <li class="class">
120
+ <a href="DeployLog/Error.html">DeployLog::Error</a>
121
+
122
+ </li>
123
+
124
+ <li class="module">
125
+ <a href="DeployLog/Github.html">DeployLog::Github</a>
126
+
127
+ </li>
128
+
129
+ <li class="class">
130
+ <a href="DeployLog/Github/Deploys.html">DeployLog::Github::Deploys</a>
131
+
132
+ </li>
133
+
134
+ <li class="class">
135
+ <a href="DeployLog/Github/Helper.html">DeployLog::Github::Helper</a>
136
+
137
+ </li>
138
+
139
+ <li class="class">
140
+ <a href="DeployLogTest.html">DeployLogTest</a>
141
+
142
+ </li>
143
+
144
+ </ul>
145
+
146
+ <h2 id="methods">Methods</h2>
147
+ <ul>
148
+
149
+ <li class="method">
150
+ <a href="DeployLog/Github/Deploys.html#method-c-new">::new</a>
151
+ &mdash;
152
+ <span class="container">DeployLog::Github::Deploys</span>
153
+
154
+ <li class="method">
155
+ <a href="DeployLog/Github/Helper.html#method-c-new">::new</a>
156
+ &mdash;
157
+ <span class="container">DeployLog::Github::Helper</span>
158
+
159
+ <li class="method">
160
+ <a href="DeployLog/Github/Deploys.html#method-i-merged_between">#merged_between</a>
161
+ &mdash;
162
+ <span class="container">DeployLog::Github::Deploys</span>
163
+
164
+ <li class="method">
165
+ <a href="DeployLog/Github/Deploys.html#method-i-merged_during_week">#merged_during_week</a>
166
+ &mdash;
167
+ <span class="container">DeployLog::Github::Deploys</span>
168
+
169
+ <li class="method">
170
+ <a href="DeployLog/Github/Deploys.html#method-i-merged_on">#merged_on</a>
171
+ &mdash;
172
+ <span class="container">DeployLog::Github::Deploys</span>
173
+
174
+ <li class="method">
175
+ <a href="DeployLog/Github/Deploys.html#method-i-merged_today">#merged_today</a>
176
+ &mdash;
177
+ <span class="container">DeployLog::Github::Deploys</span>
178
+
179
+ <li class="method">
180
+ <a href="DeployLog/Github/Deploys.html#method-i-pr_for_branch">#pr_for_branch</a>
181
+ &mdash;
182
+ <span class="container">DeployLog::Github::Deploys</span>
183
+
184
+ <li class="method">
185
+ <a href="DeployLog/Github/Deploys.html#method-i-pr_title">#pr_title</a>
186
+ &mdash;
187
+ <span class="container">DeployLog::Github::Deploys</span>
188
+
189
+ <li class="method">
190
+ <a href="DeployLog/Github/Helper.html#method-i-pulls_in_timeframe">#pulls_in_timeframe</a>
191
+ &mdash;
192
+ <span class="container">DeployLog::Github::Helper</span>
193
+
194
+ <li class="method">
195
+ <a href="DeployLog/Github/Helper.html#method-i-search_pulls_by">#search_pulls_by</a>
196
+ &mdash;
197
+ <span class="container">DeployLog::Github::Helper</span>
198
+
199
+ <li class="method">
200
+ <a href="DeployLog/Calendar.html#method-i-week">#week</a>
201
+ &mdash;
202
+ <span class="container">DeployLog::Calendar</span>
203
+
204
+ </ul>
205
+ </main>
206
+
207
+
208
+ <footer id="validator-badges" role="contentinfo">
209
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
210
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
211
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
212
+ </footer>
213
+
@@ -3,8 +3,10 @@
3
3
  module DeployLog
4
4
  module Github
5
5
  class Deploys
6
+ attr_accessor :force
7
+
6
8
  def initialize
7
- @github = Helper.new(ARGV.first)
9
+ @github = Helper.new(ARGV.first, force)
8
10
  @calendar = DeployLog::Calendar.new
9
11
  end
10
12
 
@@ -1,18 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'octokit'
4
+ require 'fileutils'
4
5
 
5
6
  module DeployLog
6
7
  module Github
7
8
  class Helper
9
+ attr_accessor :force
10
+
8
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"
9
12
 
10
- def initialize(user_repo)
13
+ def initialize(user_repo, force)
11
14
  @client = ::Octokit::Client.new(login: ENV['GITHUB_USER'], password: ENV['GITHUB_TOKEN'])
12
15
  @repo_location = user_repo
16
+ @force = force
17
+ puts force.inspect
13
18
  end
14
19
 
15
20
  def pulls_in_timeframe(date_start = nil, date_end = nil)
21
+ cache = cache_file(date_start, date_end)
22
+ return cache[:contents] if should_show_cache(cache)
23
+
16
24
  @client.auto_paginate = true
17
25
  list = @client.pull_requests(@repo_location,
18
26
  state: :closed,
@@ -22,7 +30,7 @@ module DeployLog
22
30
 
23
31
  prs_covered = 0
24
32
 
25
- File.open('/tmp/github-deploys.log', 'w+') do |f|
33
+ File.open(cache[:path], 'w+') do |f|
26
34
  list.each do |pr|
27
35
  next unless (date_start..date_end).cover? pr.merged_at
28
36
 
@@ -52,13 +60,16 @@ module DeployLog
52
60
  end
53
61
 
54
62
  def search_pulls_by(value, field = :title)
63
+ cache = cache_file(value, field)
64
+ return cache[:contents] if should_show_cache(cache)
65
+
55
66
  list = @client.pull_requests(@repo_location,
56
67
  :state => :all,
57
68
  :per_page => 100
58
69
  )
59
70
  prs_covered = 0
60
71
 
61
- File.open('/tmp/github-deploys.log', 'w+') do |f|
72
+ File.open(cache[:path], 'w+') do |f|
62
73
  list.each do |pr|
63
74
  next unless nested_hash_value(pr, field).match?(/#{value}\b/)
64
75
 
@@ -101,6 +112,22 @@ module DeployLog
101
112
  end
102
113
  end
103
114
 
115
+ def cache_file(*args)
116
+ hash = Digest::MD5.hexdigest(@repo_location + args.join('|'))
117
+ path = FileUtils.touch "/tmp/github-deploys-#{hash}.log"
118
+
119
+ {
120
+ contents: system("cat #{path.first}"),
121
+ path: path.first
122
+ }
123
+ end
124
+
125
+ def should_show_cache(cache)
126
+ return false if @force
127
+
128
+ File.exist?(cache[:path]) && !File.size(cache[:path]).zero?
129
+ end
130
+
104
131
  def formatted_time(time, use_local_time = false)
105
132
  time = Time.now if time.nil?
106
133
  time = time.localtime if use_local_time
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeployLog
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1a'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploy_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe
@@ -95,16 +95,77 @@ files:
95
95
  - LICENSE.txt
96
96
  - README.md
97
97
  - Rakefile
98
+ - _config.yml
98
99
  - bin/console
99
100
  - bin/deploy_log
100
101
  - bin/setup
101
102
  - deploy_log.gemspec
103
+ - docs/CODE_OF_CONDUCT_md.html
104
+ - docs/DeployLog.html
105
+ - docs/DeployLog/Calendar.html
106
+ - docs/DeployLog/Error.html
107
+ - docs/DeployLog/Github.html
108
+ - docs/DeployLog/Github/Deploys.html
109
+ - docs/DeployLog/Github/Helper.html
110
+ - docs/DeployLogTest.html
111
+ - docs/Gemfile.html
112
+ - docs/LICENSE_txt.html
113
+ - docs/README_md.html
114
+ - docs/Rakefile.html
115
+ - docs/_config.yml
116
+ - docs/bin/setup.html
117
+ - docs/created.rid
118
+ - docs/css/fonts.css
119
+ - docs/css/rdoc.css
120
+ - docs/deploy_log_gemspec.html
121
+ - docs/fonts/Lato-Light.ttf
122
+ - docs/fonts/Lato-LightItalic.ttf
123
+ - docs/fonts/Lato-Regular.ttf
124
+ - docs/fonts/Lato-RegularItalic.ttf
125
+ - docs/fonts/SourceCodePro-Bold.ttf
126
+ - docs/fonts/SourceCodePro-Regular.ttf
127
+ - docs/images/add.png
128
+ - docs/images/arrow_up.png
129
+ - docs/images/brick.png
130
+ - docs/images/brick_link.png
131
+ - docs/images/bug.png
132
+ - docs/images/bullet_black.png
133
+ - docs/images/bullet_toggle_minus.png
134
+ - docs/images/bullet_toggle_plus.png
135
+ - docs/images/date.png
136
+ - docs/images/delete.png
137
+ - docs/images/find.png
138
+ - docs/images/loadingAnimation.gif
139
+ - docs/images/macFFBgHack.png
140
+ - docs/images/package.png
141
+ - docs/images/page_green.png
142
+ - docs/images/page_white_text.png
143
+ - docs/images/page_white_width.png
144
+ - docs/images/plugin.png
145
+ - docs/images/ruby.png
146
+ - docs/images/tag_blue.png
147
+ - docs/images/tag_green.png
148
+ - docs/images/transparent.png
149
+ - docs/images/wrench.png
150
+ - docs/images/wrench_orange.png
151
+ - docs/images/zoom.png
152
+ - docs/index.html
153
+ - docs/js/darkfish.js
154
+ - docs/js/jquery.js
155
+ - docs/js/navigation.js
156
+ - docs/js/navigation.js.gz
157
+ - docs/js/search.js
158
+ - docs/js/search_index.js
159
+ - docs/js/search_index.js.gz
160
+ - docs/js/searcher.js
161
+ - docs/js/searcher.js.gz
162
+ - docs/table_of_contents.html
102
163
  - lib/deploy_log.rb
103
164
  - lib/deploy_log/calendar.rb
104
165
  - lib/deploy_log/github/deploys.rb
105
166
  - lib/deploy_log/github/helper.rb
106
167
  - lib/deploy_log/version.rb
107
- homepage: https://github.com/aapis/deploy_log
168
+ homepage: https://aapis.github.io/deploy_log/
108
169
  licenses:
109
170
  - MIT
110
171
  metadata: {}
@@ -119,9 +180,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
180
  version: '0'
120
181
  required_rubygems_version: !ruby/object:Gem::Requirement
121
182
  requirements:
122
- - - ">="
183
+ - - ">"
123
184
  - !ruby/object:Gem::Version
124
- version: '0'
185
+ version: 1.3.1
125
186
  requirements: []
126
187
  rubygems_version: 3.0.1
127
188
  signing_key: