blackbox 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 810118aa98cd056ba965219fcd5726f4f7438676
4
- data.tar.gz: b10a58a90683c460c3d9295ec4ce273b86ea3670
3
+ metadata.gz: 7c6938a08003ce8bfe1ff81152fd39b7bd35fafa
4
+ data.tar.gz: 6d92017a1820d601966baebae96ce8aad36428f2
5
5
  SHA512:
6
- metadata.gz: 7e3f0f366ef72e8784fe9108f7342650fcf51ed28aabb03ee9c0cdd9cbb59627a51b9bafe044c65e72fee217b7de0d6688f6e0c44718a1ef291c6e1a586d15c2
7
- data.tar.gz: 65421ce04c2f71d1b4a3f1b95c47339c67e458ea4a2da03e5c71ce9e95501cc9e62b3da4d2f2bbfde1b2e039e711fba9de68ff86c73f98c425d416e1df7df8b5
6
+ metadata.gz: 35acb7134141ea40be1e66d9ec7db51f7682e848e7b5ec2dea0984dd9e195976941fcac8a92d65f28ea045ea54dfdc89d75cb1c7181858fb223e8591ce19c591
7
+ data.tar.gz: ac8aa950a727bb53336b59713ffd2119afc7a0946eaa0669a35e8e8ad61d0626ad60e7264b593ca7299c42ddd704e0f3db9952ee8c92f484780ebceaffa690a0
@@ -2,10 +2,10 @@ AllCops:
2
2
  TargetRubyVersion: 2.3
3
3
 
4
4
  Metrics/AbcSize:
5
- Max: 50
5
+ Max: 53
6
6
 
7
7
  Metrics/CyclomaticComplexity:
8
- Max: 10
8
+ Max: 12
9
9
 
10
10
  Metrics/LineLength:
11
11
  Max: 133
@@ -14,7 +14,7 @@ Metrics/MethodLength:
14
14
  Max: 50
15
15
 
16
16
  Metrics/PerceivedComplexity:
17
- Max: 11
17
+ Max: 12
18
18
 
19
19
  Style/FormatString:
20
20
  Exclude:
@@ -0,0 +1 @@
1
+ 2.3.1
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.1
@@ -122,7 +122,7 @@
122
122
  null,
123
123
  null,
124
124
  1,
125
- 3,
125
+ 8,
126
126
  null,
127
127
  null,
128
128
  null,
@@ -132,43 +132,49 @@
132
132
  null,
133
133
  null,
134
134
  null,
135
- 3,
136
- 12,
135
+ 8,
136
+ 32,
137
137
  null,
138
138
  null,
139
- 3,
140
- 3,
139
+ 8,
140
+ 8,
141
141
  null,
142
- 3,
142
+ 8,
143
143
  null,
144
144
  null,
145
145
  null,
146
146
  null,
147
- 3,
148
- 3,
149
- 3,
147
+ 8,
148
+ 8,
149
+ 8,
150
+ 1,
150
151
  1,
152
+ null,
153
+ null,
154
+ 7,
155
+ 7,
156
+ 7,
157
+ null,
158
+ 7,
159
+ null,
160
+ 7,
161
+ 7,
162
+ 7,
163
+ null,
151
164
  1,
152
165
  null,
153
166
  null,
154
- 2,
155
- 2,
156
- 2,
167
+ 7,
157
168
  null,
158
- 2,
159
169
  null,
160
- 2,
161
- 2,
162
- 2,
163
170
  null,
164
- 2,
165
171
  null,
166
- 2,
172
+ 7,
167
173
  null,
168
- 2,
169
- 2,
174
+ 6,
175
+ 6,
170
176
  null,
171
- 2,
177
+ 6,
172
178
  null,
173
179
  null,
174
180
  null,
@@ -176,9 +182,9 @@
176
182
  null,
177
183
  null,
178
184
  null,
179
- 2,
185
+ 6,
180
186
  null,
181
- 2,
187
+ 6,
182
188
  null,
183
189
  null,
184
190
  null,
@@ -439,6 +445,6 @@
439
445
  null
440
446
  ]
441
447
  },
442
- "timestamp": 1463253674
448
+ "timestamp": 1463256622
443
449
  }
444
450
  }
@@ -14,7 +14,7 @@
14
14
  <img src="./assets/0.10.0/loading.gif" alt="loading"/>
15
15
  </div>
16
16
  <div id="wrapper" style="display:none;">
17
- <div class="timestamp">Generated <abbr class="timeago" title="2016-05-14T21:21:14+02:00">2016-05-14T21:21:14+02:00</abbr></div>
17
+ <div class="timestamp">Generated <abbr class="timeago" title="2016-05-14T22:10:22+02:00">2016-05-14T22:10:22+02:00</abbr></div>
18
18
  <ul class="group_tabs"></ul>
19
19
 
20
20
  <div id="content">
@@ -25,15 +25,15 @@
25
25
  covered at
26
26
  <span class="covered_strength">
27
27
  <span class="green">
28
- 62.74
28
+ 63.22
29
29
  </span>
30
30
  </span> hits/line)
31
31
  </h2>
32
32
  <a name="AllFiles"></a>
33
33
  <div>
34
34
  <b>5</b> files in total.
35
- <b>130</b> relevant lines.
36
- <span class="green"><b>130</b> lines covered</span> and
35
+ <b>131</b> relevant lines.
36
+ <span class="green"><b>131</b> lines covered</span> and
37
37
  <span class="red"><b>0</b> lines missed </span>
38
38
  </div>
39
39
  <table class="file_list">
@@ -63,11 +63,11 @@
63
63
  <tr>
64
64
  <td class="strong"><a href="#192e300fd7769b750c82567439ee016f85516f3d" class="src_link" title="lib/blackbox/gem.rb">lib/blackbox/gem.rb</a></td>
65
65
  <td class="green strong">100.0 %</td>
66
- <td>82</td>
67
- <td>29</td>
68
- <td>29</td>
66
+ <td>88</td>
67
+ <td>30</td>
68
+ <td>30</td>
69
69
  <td>0</td>
70
- <td>2.4</td>
70
+ <td>6.5</td>
71
71
  </tr>
72
72
 
73
73
  <tr>
@@ -721,8 +721,8 @@
721
721
  <h3>lib/blackbox/gem.rb</h3>
722
722
  <h4><span class="green">100.0 %</span> covered</h4>
723
723
  <div>
724
- <b>29</b> relevant lines.
725
- <span class="green"><b>29</b> lines covered</span> and
724
+ <b>30</b> relevant lines.
725
+ <span class="green"><b>30</b> lines covered</span> and
726
726
  <span class="red"><b>0</b> lines missed.</span>
727
727
  </div>
728
728
  </div>
@@ -856,8 +856,8 @@
856
856
  <code class="ruby"> def version_info(*_, **opts)</code>
857
857
  </li>
858
858
 
859
- <li class="covered" data-hits="3" data-linenumber="22">
860
- <span class="hits">3</span>
859
+ <li class="covered" data-hits="8" data-linenumber="22">
860
+ <span class="hits">8</span>
861
861
 
862
862
  <code class="ruby"> ret = {</code>
863
863
  </li>
@@ -916,14 +916,14 @@
916
916
  <code class="ruby"></code>
917
917
  </li>
918
918
 
919
- <li class="covered" data-hits="3" data-linenumber="32">
920
- <span class="hits">3</span>
919
+ <li class="covered" data-hits="8" data-linenumber="32">
920
+ <span class="hits">8</span>
921
921
 
922
922
  <code class="ruby"> spec = ::Gem::Specification.find do |s|</code>
923
923
  </li>
924
924
 
925
- <li class="covered" data-hits="12" data-linenumber="33">
926
- <span class="hits">12</span>
925
+ <li class="covered" data-hits="32" data-linenumber="33">
926
+ <span class="hits">32</span>
927
927
 
928
928
  <code class="ruby"> File.fnmatch(File.join(s.full_gem_path, &#39;*&#39;), __FILE__)</code>
929
929
  </li>
@@ -940,14 +940,14 @@
940
940
  <code class="ruby"></code>
941
941
  </li>
942
942
 
943
- <li class="covered" data-hits="3" data-linenumber="36">
944
- <span class="hits">3</span>
943
+ <li class="covered" data-hits="8" data-linenumber="36">
944
+ <span class="hits">8</span>
945
945
 
946
946
  <code class="ruby"> ret[:gem_installed_version] = spec&amp;.version.to_s || :unknown</code>
947
947
  </li>
948
948
 
949
- <li class="covered" data-hits="3" data-linenumber="37">
950
- <span class="hits">3</span>
949
+ <li class="covered" data-hits="8" data-linenumber="37">
950
+ <span class="hits">8</span>
951
951
 
952
952
  <code class="ruby"> ret[:gem_name] = spec&amp;.name || :unknown</code>
953
953
  </li>
@@ -958,8 +958,8 @@
958
958
  <code class="ruby"></code>
959
959
  </li>
960
960
 
961
- <li class="covered" data-hits="3" data-linenumber="39">
962
- <span class="hits">3</span>
961
+ <li class="covered" data-hits="8" data-linenumber="39">
962
+ <span class="hits">8</span>
963
963
 
964
964
  <code class="ruby"> opts = { # defaults</code>
965
965
  </li>
@@ -988,20 +988,20 @@
988
988
  <code class="ruby"></code>
989
989
  </li>
990
990
 
991
- <li class="covered" data-hits="3" data-linenumber="44">
992
- <span class="hits">3</span>
991
+ <li class="covered" data-hits="8" data-linenumber="44">
992
+ <span class="hits">8</span>
993
993
 
994
994
  <code class="ruby"> return ret if ret[:gem_name] == :unknown</code>
995
995
  </li>
996
996
 
997
- <li class="covered" data-hits="3" data-linenumber="45">
998
- <span class="hits">3</span>
997
+ <li class="covered" data-hits="8" data-linenumber="45">
998
+ <span class="hits">8</span>
999
999
 
1000
1000
  <code class="ruby"> return ret if ret[:gem_installed_version] == :unknown</code>
1001
1001
  </li>
1002
1002
 
1003
- <li class="covered" data-hits="3" data-linenumber="46">
1004
- <span class="hits">3</span>
1003
+ <li class="covered" data-hits="8" data-linenumber="46">
1004
+ <span class="hits">8</span>
1005
1005
 
1006
1006
  <code class="ruby"> if opts[:disabling_env_var] &amp;&amp; ENV.include?(opts[:disabling_env_var])</code>
1007
1007
  </li>
@@ -1030,20 +1030,20 @@
1030
1030
  <code class="ruby"></code>
1031
1031
  </li>
1032
1032
 
1033
- <li class="covered" data-hits="2" data-linenumber="51">
1034
- <span class="hits">2</span>
1033
+ <li class="covered" data-hits="7" data-linenumber="51">
1034
+ <span class="hits">7</span>
1035
1035
 
1036
1036
  <code class="ruby"> require &#39;gem_update_checker&#39;</code>
1037
1037
  </li>
1038
1038
 
1039
- <li class="covered" data-hits="2" data-linenumber="52">
1040
- <span class="hits">2</span>
1039
+ <li class="covered" data-hits="7" data-linenumber="52">
1040
+ <span class="hits">7</span>
1041
1041
 
1042
1042
  <code class="ruby"> require &#39;tmpdir&#39;</code>
1043
1043
  </li>
1044
1044
 
1045
- <li class="covered" data-hits="2" data-linenumber="53">
1046
- <span class="hits">2</span>
1045
+ <li class="covered" data-hits="7" data-linenumber="53">
1046
+ <span class="hits">7</span>
1047
1047
 
1048
1048
  <code class="ruby"> require &#39;fileutils&#39;</code>
1049
1049
  </li>
@@ -1054,8 +1054,8 @@
1054
1054
  <code class="ruby"></code>
1055
1055
  </li>
1056
1056
 
1057
- <li class="covered" data-hits="2" data-linenumber="55">
1058
- <span class="hits">2</span>
1057
+ <li class="covered" data-hits="7" data-linenumber="55">
1058
+ <span class="hits">7</span>
1059
1059
 
1060
1060
  <code class="ruby"> statefile_path = File.join(Dir.tmpdir, &quot;#{ret[:gem_name]}-#{ret[:gem_installed_version]}.last_update_check&quot;)</code>
1061
1061
  </li>
@@ -1066,20 +1066,20 @@
1066
1066
  <code class="ruby"></code>
1067
1067
  </li>
1068
1068
 
1069
- <li class="covered" data-hits="2" data-linenumber="57">
1070
- <span class="hits">2</span>
1069
+ <li class="covered" data-hits="7" data-linenumber="57">
1070
+ <span class="hits">7</span>
1071
1071
 
1072
1072
  <code class="ruby"> last_check_at = nil</code>
1073
1073
  </li>
1074
1074
 
1075
- <li class="covered" data-hits="2" data-linenumber="58">
1076
- <span class="hits">2</span>
1075
+ <li class="covered" data-hits="7" data-linenumber="58">
1076
+ <span class="hits">7</span>
1077
1077
 
1078
1078
  <code class="ruby"> begin</code>
1079
1079
  </li>
1080
1080
 
1081
- <li class="covered" data-hits="2" data-linenumber="59">
1082
- <span class="hits">2</span>
1081
+ <li class="covered" data-hits="7" data-linenumber="59">
1082
+ <span class="hits">7</span>
1083
1083
 
1084
1084
  <code class="ruby"> last_check_at = File.stat(statefile_path).mtime</code>
1085
1085
  </li>
@@ -1090,8 +1090,8 @@
1090
1090
  <code class="ruby"> rescue</code>
1091
1091
  </li>
1092
1092
 
1093
- <li class="covered" data-hits="2" data-linenumber="61">
1094
- <span class="hits">2</span>
1093
+ <li class="covered" data-hits="1" data-linenumber="61">
1094
+ <span class="hits">1</span>
1095
1095
 
1096
1096
  <code class="ruby"> last_check_at = Time.at(0)</code>
1097
1097
  </li>
@@ -1102,121 +1102,157 @@
1102
1102
  <code class="ruby"> end</code>
1103
1103
  </li>
1104
1104
 
1105
- <li class="covered" data-hits="2" data-linenumber="63">
1106
- <span class="hits">2</span>
1105
+ <li class="never" data-hits="" data-linenumber="63">
1106
+
1107
1107
 
1108
- <code class="ruby"> return ret if last_check_at &gt; Time.now - opts[:check_interval]</code>
1108
+ <code class="ruby"></code>
1109
1109
  </li>
1110
1110
 
1111
- <li class="never" data-hits="" data-linenumber="64">
1111
+ <li class="covered" data-hits="7" data-linenumber="64">
1112
+ <span class="hits">7</span>
1113
+
1114
+ <code class="ruby"> ret.merge!(</code>
1115
+ </li>
1116
+
1117
+ <li class="never" data-hits="" data-linenumber="65">
1118
+
1119
+
1120
+ <code class="ruby"> last_checked_for_update: last_check_at,</code>
1121
+ </li>
1122
+
1123
+ <li class="never" data-hits="" data-linenumber="66">
1124
+
1125
+
1126
+ <code class="ruby"> next_check_for_update: last_check_at + opts[:check_interval]</code>
1127
+ </li>
1128
+
1129
+ <li class="never" data-hits="" data-linenumber="67">
1130
+
1131
+
1132
+ <code class="ruby"> )</code>
1133
+ </li>
1134
+
1135
+ <li class="never" data-hits="" data-linenumber="68">
1112
1136
 
1113
1137
 
1114
1138
  <code class="ruby"></code>
1115
1139
  </li>
1116
1140
 
1117
- <li class="covered" data-hits="2" data-linenumber="65">
1118
- <span class="hits">2</span>
1141
+ <li class="covered" data-hits="7" data-linenumber="69">
1142
+ <span class="hits">7</span>
1143
+
1144
+ <code class="ruby"> return ret if last_check_at + opts[:check_interval] &gt; Time.now &amp;&amp; !opts[:force_check]</code>
1145
+ </li>
1146
+
1147
+ <li class="never" data-hits="" data-linenumber="70">
1148
+
1149
+
1150
+ <code class="ruby"></code>
1151
+ </li>
1152
+
1153
+ <li class="covered" data-hits="6" data-linenumber="71">
1154
+ <span class="hits">6</span>
1119
1155
 
1120
1156
  <code class="ruby"> checker = GemUpdateChecker::Client.new(ret[:gem_name], ret[:gem_installed_version])</code>
1121
1157
  </li>
1122
1158
 
1123
- <li class="covered" data-hits="2" data-linenumber="66">
1124
- <span class="hits">2</span>
1159
+ <li class="covered" data-hits="6" data-linenumber="72">
1160
+ <span class="hits">6</span>
1125
1161
 
1126
1162
  <code class="ruby"> last_check_at = Time.now</code>
1127
1163
  </li>
1128
1164
 
1129
- <li class="never" data-hits="" data-linenumber="67">
1165
+ <li class="never" data-hits="" data-linenumber="73">
1130
1166
 
1131
1167
 
1132
1168
  <code class="ruby"></code>
1133
1169
  </li>
1134
1170
 
1135
- <li class="covered" data-hits="2" data-linenumber="68">
1136
- <span class="hits">2</span>
1171
+ <li class="covered" data-hits="6" data-linenumber="74">
1172
+ <span class="hits">6</span>
1137
1173
 
1138
1174
  <code class="ruby"> ret.merge!(</code>
1139
1175
  </li>
1140
1176
 
1141
- <li class="never" data-hits="" data-linenumber="69">
1177
+ <li class="never" data-hits="" data-linenumber="75">
1142
1178
 
1143
1179
 
1144
1180
  <code class="ruby"> gem_latest_version: checker.latest_version,</code>
1145
1181
  </li>
1146
1182
 
1147
- <li class="never" data-hits="" data-linenumber="70">
1183
+ <li class="never" data-hits="" data-linenumber="76">
1148
1184
 
1149
1185
 
1150
1186
  <code class="ruby"> last_checked_for_update: last_check_at,</code>
1151
1187
  </li>
1152
1188
 
1153
- <li class="never" data-hits="" data-linenumber="71">
1189
+ <li class="never" data-hits="" data-linenumber="77">
1154
1190
 
1155
1191
 
1156
1192
  <code class="ruby"> next_check_for_update: last_check_at + opts[:check_interval],</code>
1157
1193
  </li>
1158
1194
 
1159
- <li class="never" data-hits="" data-linenumber="72">
1195
+ <li class="never" data-hits="" data-linenumber="78">
1160
1196
 
1161
1197
 
1162
1198
  <code class="ruby"> installed_is_latest: ret[:gem_installed_version] == checker.latest_version,</code>
1163
1199
  </li>
1164
1200
 
1165
- <li class="never" data-hits="" data-linenumber="73">
1201
+ <li class="never" data-hits="" data-linenumber="79">
1166
1202
 
1167
1203
 
1168
1204
  <code class="ruby"> gem_update_available: checker.update_available</code>
1169
1205
  </li>
1170
1206
 
1171
- <li class="never" data-hits="" data-linenumber="74">
1207
+ <li class="never" data-hits="" data-linenumber="80">
1172
1208
 
1173
1209
 
1174
1210
  <code class="ruby"> )</code>
1175
1211
  </li>
1176
1212
 
1177
- <li class="never" data-hits="" data-linenumber="75">
1213
+ <li class="never" data-hits="" data-linenumber="81">
1178
1214
 
1179
1215
 
1180
1216
  <code class="ruby"></code>
1181
1217
  </li>
1182
1218
 
1183
- <li class="covered" data-hits="2" data-linenumber="76">
1184
- <span class="hits">2</span>
1219
+ <li class="covered" data-hits="6" data-linenumber="82">
1220
+ <span class="hits">6</span>
1185
1221
 
1186
- <code class="ruby"> FileUtils.touch(statefile_path) if ret[:installed_is_latest]</code>
1222
+ <code class="ruby"> FileUtils.touch(statefile_path, mtime: Time.now) if ret[:installed_is_latest] || opts[:force_check]</code>
1187
1223
  </li>
1188
1224
 
1189
- <li class="never" data-hits="" data-linenumber="77">
1225
+ <li class="never" data-hits="" data-linenumber="83">
1190
1226
 
1191
1227
 
1192
1228
  <code class="ruby"></code>
1193
1229
  </li>
1194
1230
 
1195
- <li class="covered" data-hits="2" data-linenumber="78">
1196
- <span class="hits">2</span>
1231
+ <li class="covered" data-hits="6" data-linenumber="84">
1232
+ <span class="hits">6</span>
1197
1233
 
1198
1234
  <code class="ruby"> ret</code>
1199
1235
  </li>
1200
1236
 
1201
- <li class="never" data-hits="" data-linenumber="79">
1237
+ <li class="never" data-hits="" data-linenumber="85">
1202
1238
 
1203
1239
 
1204
1240
  <code class="ruby"> end</code>
1205
1241
  </li>
1206
1242
 
1207
- <li class="never" data-hits="" data-linenumber="80">
1243
+ <li class="never" data-hits="" data-linenumber="86">
1208
1244
 
1209
1245
 
1210
1246
  <code class="ruby"> end</code>
1211
1247
  </li>
1212
1248
 
1213
- <li class="never" data-hits="" data-linenumber="81">
1249
+ <li class="never" data-hits="" data-linenumber="87">
1214
1250
 
1215
1251
 
1216
1252
  <code class="ruby"> end</code>
1217
1253
  </li>
1218
1254
 
1219
- <li class="never" data-hits="" data-linenumber="82">
1255
+ <li class="never" data-hits="" data-linenumber="88">
1220
1256
 
1221
1257
 
1222
1258
  <code class="ruby">end</code>
@@ -115,7 +115,7 @@
115
115
  <dt id="VERSION-constant" class="">VERSION =
116
116
 
117
117
  </dt>
118
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>3.1.1</span><span class='tstring_end'>&#39;</span></span></pre></dd>
118
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>3.1.2</span><span class='tstring_end'>&#39;</span></span></pre></dd>
119
119
 
120
120
  </dl>
121
121
 
@@ -131,9 +131,9 @@
131
131
  </div>
132
132
 
133
133
  <div id="footer">
134
- Generated on Sat May 14 21:21:15 2016 by
134
+ Generated on Sat May 14 22:10:23 2016 by
135
135
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
136
- 0.8.7.6 (ruby-2.3.0).
136
+ 0.8.7.6 (ruby-2.3.1).
137
137
  </div>
138
138
 
139
139
  </body>
@@ -1132,9 +1132,9 @@
1132
1132
  </div>
1133
1133
 
1134
1134
  <div id="footer">
1135
- Generated on Sat May 14 21:21:15 2016 by
1135
+ Generated on Sat May 14 22:10:23 2016 by
1136
1136
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1137
- 0.8.7.6 (ruby-2.3.0).
1137
+ 0.8.7.6 (ruby-2.3.1).
1138
1138
  </div>
1139
1139
 
1140
1140
  </body>
@@ -332,7 +332,13 @@ version?</p>
332
332
  76
333
333
  77
334
334
  78
335
- 79</pre>
335
+ 79
336
+ 80
337
+ 81
338
+ 82
339
+ 83
340
+ 84
341
+ 85</pre>
336
342
  </td>
337
343
  <td>
338
344
  <pre class="code"><span class="info file"># File 'lib/blackbox/gem.rb', line 21</span>
@@ -379,7 +385,13 @@ version?</p>
379
385
  <span class='kw'>rescue</span>
380
386
  <span class='id identifier rubyid_last_check_at'>last_check_at</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
381
387
  <span class='kw'>end</span>
382
- <span class='kw'>return</span> <span class='id identifier rubyid_ret'>ret</span> <span class='kw'>if</span> <span class='id identifier rubyid_last_check_at'>last_check_at</span> <span class='op'>&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:check_interval</span><span class='rbracket'>]</span>
388
+
389
+ <span class='id identifier rubyid_ret'>ret</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span>
390
+ <span class='label'>last_checked_for_update:</span> <span class='id identifier rubyid_last_check_at'>last_check_at</span><span class='comma'>,</span>
391
+ <span class='label'>next_check_for_update:</span> <span class='id identifier rubyid_last_check_at'>last_check_at</span> <span class='op'>+</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:check_interval</span><span class='rbracket'>]</span>
392
+ <span class='rparen'>)</span>
393
+
394
+ <span class='kw'>return</span> <span class='id identifier rubyid_ret'>ret</span> <span class='kw'>if</span> <span class='id identifier rubyid_last_check_at'>last_check_at</span> <span class='op'>+</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:check_interval</span><span class='rbracket'>]</span> <span class='op'>&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:force_check</span><span class='rbracket'>]</span>
383
395
 
384
396
  <span class='id identifier rubyid_checker'>checker</span> <span class='op'>=</span> <span class='const'>GemUpdateChecker</span><span class='op'>::</span><span class='const'>Client</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_ret'>ret</span><span class='lbracket'>[</span><span class='symbol'>:gem_name</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_ret'>ret</span><span class='lbracket'>[</span><span class='symbol'>:gem_installed_version</span><span class='rbracket'>]</span><span class='rparen'>)</span>
385
397
  <span class='id identifier rubyid_last_check_at'>last_check_at</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
@@ -392,7 +404,7 @@ version?</p>
392
404
  <span class='label'>gem_update_available:</span> <span class='id identifier rubyid_checker'>checker</span><span class='period'>.</span><span class='id identifier rubyid_update_available'>update_available</span>
393
405
  <span class='rparen'>)</span>
394
406
 
395
- <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_touch'>touch</span><span class='lparen'>(</span><span class='id identifier rubyid_statefile_path'>statefile_path</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_ret'>ret</span><span class='lbracket'>[</span><span class='symbol'>:installed_is_latest</span><span class='rbracket'>]</span>
407
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_touch'>touch</span><span class='lparen'>(</span><span class='id identifier rubyid_statefile_path'>statefile_path</span><span class='comma'>,</span> <span class='label'>mtime:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_ret'>ret</span><span class='lbracket'>[</span><span class='symbol'>:installed_is_latest</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:force_check</span><span class='rbracket'>]</span>
396
408
 
397
409
  <span class='id identifier rubyid_ret'>ret</span>
398
410
  <span class='kw'>end</span></pre>
@@ -406,9 +418,9 @@ version?</p>
406
418
  </div>
407
419
 
408
420
  <div id="footer">
409
- Generated on Sat May 14 21:21:15 2016 by
421
+ Generated on Sat May 14 22:10:23 2016 by
410
422
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
411
- 0.8.7.6 (ruby-2.3.0).
423
+ 0.8.7.6 (ruby-2.3.1).
412
424
  </div>
413
425
 
414
426
  </body>
@@ -432,9 +432,9 @@ BB::Hash.flatten_prop_style(input)
432
432
  </div>
433
433
 
434
434
  <div id="footer">
435
- Generated on Sat May 14 21:21:15 2016 by
435
+ Generated on Sat May 14 22:10:23 2016 by
436
436
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
437
- 0.8.7.6 (ruby-2.3.0).
437
+ 0.8.7.6 (ruby-2.3.1).
438
438
  </div>
439
439
 
440
440
  </body>
@@ -922,9 +922,9 @@ can customize the format in the <code>options</code> hash.</p>
922
922
  </div>
923
923
 
924
924
  <div id="footer">
925
- Generated on Sat May 14 21:21:15 2016 by
925
+ Generated on Sat May 14 22:10:23 2016 by
926
926
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
927
- 0.8.7.6 (ruby-2.3.0).
927
+ 0.8.7.6 (ruby-2.3.1).
928
928
  </div>
929
929
 
930
930
  </body>
@@ -231,9 +231,9 @@
231
231
  </div>
232
232
 
233
233
  <div id="footer">
234
- Generated on Sat May 14 21:21:15 2016 by
234
+ Generated on Sat May 14 22:10:23 2016 by
235
235
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
236
- 0.8.7.6 (ruby-2.3.0).
236
+ 0.8.7.6 (ruby-2.3.1).
237
237
  </div>
238
238
 
239
239
  </body>
@@ -176,9 +176,9 @@
176
176
  </div>
177
177
 
178
178
  <div id="footer">
179
- Generated on Sat May 14 21:21:15 2016 by
179
+ Generated on Sat May 14 22:10:23 2016 by
180
180
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
181
- 0.8.7.6 (ruby-2.3.0).
181
+ 0.8.7.6 (ruby-2.3.1).
182
182
  </div>
183
183
 
184
184
  </body>
@@ -95,9 +95,9 @@ BB::String.strip_ansi( ... )
95
95
  </div></div>
96
96
 
97
97
  <div id="footer">
98
- Generated on Sat May 14 21:21:15 2016 by
98
+ Generated on Sat May 14 22:10:23 2016 by
99
99
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
100
- 0.8.7.6 (ruby-2.3.0).
100
+ 0.8.7.6 (ruby-2.3.1).
101
101
  </div>
102
102
 
103
103
  </body>
@@ -95,9 +95,9 @@ BB::String.strip_ansi( ... )
95
95
  </div></div>
96
96
 
97
97
  <div id="footer">
98
- Generated on Sat May 14 21:21:15 2016 by
98
+ Generated on Sat May 14 22:10:23 2016 by
99
99
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
100
- 0.8.7.6 (ruby-2.3.0).
100
+ 0.8.7.6 (ruby-2.3.1).
101
101
  </div>
102
102
 
103
103
  </body>
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sat May 14 21:21:15 2016 by
106
+ Generated on Sat May 14 22:10:23 2016 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.7.6 (ruby-2.3.0).
108
+ 0.8.7.6 (ruby-2.3.1).
109
109
  </div>
110
110
 
111
111
  </body>
@@ -60,7 +60,13 @@ module BB
60
60
  rescue
61
61
  last_check_at = Time.at(0)
62
62
  end
63
- return ret if last_check_at > Time.now - opts[:check_interval]
63
+
64
+ ret.merge!(
65
+ last_checked_for_update: last_check_at,
66
+ next_check_for_update: last_check_at + opts[:check_interval]
67
+ )
68
+
69
+ return ret if last_check_at + opts[:check_interval] > Time.now && !opts[:force_check]
64
70
 
65
71
  checker = GemUpdateChecker::Client.new(ret[:gem_name], ret[:gem_installed_version])
66
72
  last_check_at = Time.now
@@ -73,7 +79,7 @@ module BB
73
79
  gem_update_available: checker.update_available
74
80
  )
75
81
 
76
- FileUtils.touch(statefile_path) if ret[:installed_is_latest]
82
+ FileUtils.touch(statefile_path, mtime: Time.now) if ret[:installed_is_latest] || opts[:force_check]
77
83
 
78
84
  ret
79
85
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module BB
3
- VERSION = '3.1.1'
3
+ VERSION = '3.1.2'
4
4
  end
@@ -5,26 +5,48 @@ require 'blackbox/gem'
5
5
 
6
6
  describe BB::Gem do
7
7
  describe '.version_info' do
8
+ before :each do
9
+ at = Time.parse('2015-10-21 00:00')
10
+ Timecop.freeze(at) do
11
+ BB::Gem.version_info(force_check: true)
12
+ end
13
+ end
14
+
8
15
  it 'returns a well-formed Hash' do
9
- retval = BB::Gem.version_info
10
-
11
- expect(retval).to be_a(Hash)
12
- expect(retval.keys).to contain_exactly(
13
- :gem_name,
14
- :gem_installed_version,
15
- :gem_latest_version,
16
- :last_checked_for_update,
17
- :next_check_for_update,
18
- :installed_is_latest,
19
- :gem_update_available
20
- )
21
-
22
- expect(retval).to include(
23
- gem_name: 'blackbox'
24
- )
25
-
26
- expect(retval[:gem_installed_version]).not_to eq(:unknown)
27
- expect(retval[:gem_latest_version]).not_to eq(:unknown)
16
+ at = Time.parse('2015-10-21 07:28')
17
+ Timecop.freeze(at) do
18
+ retval = BB::Gem.version_info
19
+
20
+ expect(retval).to be_a(Hash)
21
+ expect(retval.keys).to contain_exactly(
22
+ :gem_name,
23
+ :gem_installed_version,
24
+ :gem_latest_version,
25
+ :last_checked_for_update,
26
+ :next_check_for_update,
27
+ :installed_is_latest,
28
+ :gem_update_available
29
+ )
30
+
31
+ expect(retval).to include(
32
+ gem_name: 'blackbox'
33
+ )
34
+
35
+ expect(retval[:gem_installed_version]).not_to eq(:unknown)
36
+ expect(retval[:gem_latest_version]).not_to eq(:unknown)
37
+ end
38
+ end
39
+
40
+ it "does not run test before opt['check_interval'] has passed" do
41
+ at = Time.parse('2015-10-21 07:28')
42
+ Timecop.freeze(at) do
43
+ retval = BB::Gem.version_info(check_interval: 864_00)
44
+ expect(retval).to include(
45
+ next_check_for_update: Time.parse('2015-10-22 00:00'),
46
+ gem_latest_version: :unknown
47
+
48
+ )
49
+ end
28
50
  end
29
51
 
30
52
  it "schedules next check according to opt['check_interval']" do
@@ -39,10 +61,13 @@ describe BB::Gem do
39
61
 
40
62
  it 'schedules no check when disabled via env var' do
41
63
  ENV['BLACKBOX_DISABLE_VERSION_CHECK'] = '1'
42
- retval = BB::Gem.version_info(check_inverval: 60)
43
- expect(retval).to include(
44
- next_check_for_update: :never
45
- )
64
+ at = Time.parse('2015-10-21 07:28')
65
+ Timecop.freeze(at) do
66
+ retval = BB::Gem.version_info(check_inverval: 60)
67
+ expect(retval).to include(
68
+ next_check_for_update: :never
69
+ )
70
+ end
46
71
  end
47
72
  end
48
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moe
@@ -189,6 +189,8 @@ files:
189
189
  - ".gitignore"
190
190
  - ".rspec"
191
191
  - ".rubocop.yml"
192
+ - ".ruby-version"
193
+ - ".travis.yml"
192
194
  - Gemfile
193
195
  - Guardfile
194
196
  - LICENSE.txt