blackbox 3.1.2 → 3.1.4

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: 7c6938a08003ce8bfe1ff81152fd39b7bd35fafa
4
- data.tar.gz: 6d92017a1820d601966baebae96ce8aad36428f2
3
+ metadata.gz: ddd85991f6262894aa3f603b8016fa9224cd5438
4
+ data.tar.gz: e6346d3e45232ca2ede183bac0974adf23967a19
5
5
  SHA512:
6
- metadata.gz: 35acb7134141ea40be1e66d9ec7db51f7682e848e7b5ec2dea0984dd9e195976941fcac8a92d65f28ea045ea54dfdc89d75cb1c7181858fb223e8591ce19c591
7
- data.tar.gz: ac8aa950a727bb53336b59713ffd2119afc7a0946eaa0669a35e8e8ad61d0626ad60e7264b593ca7299c42ddd704e0f3db9952ee8c92f484780ebceaffa690a0
6
+ metadata.gz: b455d512adbf0ba9ed8fe80709cfbb9911ea61a862914ff84adf43e010ececd8c5318abaad6a673ba4d00f9d3e5a6855aca752a28c6a0a38e1cf02f648977ac5
7
+ data.tar.gz: 2b7ecfb983f4ad42b2f761e1f92645d0d9a7da3a16f0e534f3ef3884698540502abaa4db7dcb7b692f390fd642991bcbb725b0baebe98656dcfca77610d49fa7
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ AllCops:
2
2
  TargetRubyVersion: 2.3
3
3
 
4
4
  Metrics/AbcSize:
5
- Max: 53
5
+ Max: 57
6
6
 
7
7
  Metrics/CyclomaticComplexity:
8
8
  Max: 12
@@ -11,10 +11,10 @@ Metrics/LineLength:
11
11
  Max: 133
12
12
 
13
13
  Metrics/MethodLength:
14
- Max: 50
14
+ Max: 55
15
15
 
16
16
  Metrics/PerceivedComplexity:
17
- Max: 12
17
+ Max: 13
18
18
 
19
19
  Style/FormatString:
20
20
  Exclude:
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 100.0
3
+ "covered_percent": 99.25
4
4
  }
5
5
  }
@@ -133,6 +133,7 @@
133
133
  null,
134
134
  null,
135
135
  8,
136
+ 8,
136
137
  32,
137
138
  null,
138
139
  null,
@@ -161,7 +162,7 @@
161
162
  7,
162
163
  7,
163
164
  null,
164
- 1,
165
+ 0,
165
166
  null,
166
167
  null,
167
168
  7,
@@ -183,6 +184,10 @@
183
184
  null,
184
185
  null,
185
186
  6,
187
+ 4,
188
+ null,
189
+ 2,
190
+ null,
186
191
  null,
187
192
  6,
188
193
  null,
@@ -445,6 +450,6 @@
445
450
  null
446
451
  ]
447
452
  },
448
- "timestamp": 1463256622
453
+ "timestamp": 1463263126
449
454
  }
450
455
  }
data/coverage/index.html CHANGED
@@ -14,27 +14,27 @@
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-14T22:10:22+02:00">2016-05-14T22:10:22+02:00</abbr></div>
17
+ <div class="timestamp">Generated <abbr class="timeago" title="2016-05-14T23:58:46+02:00">2016-05-14T23:58:46+02:00</abbr></div>
18
18
  <ul class="group_tabs"></ul>
19
19
 
20
20
  <div id="content">
21
21
  <div class="file_list_container" id="AllFiles">
22
22
  <h2>
23
23
  <span class="group_name">All Files</span>
24
- (<span class="covered_percent"><span class="green">100.0%</span></span>
24
+ (<span class="covered_percent"><span class="green">99.25%</span></span>
25
25
  covered at
26
26
  <span class="covered_strength">
27
27
  <span class="green">
28
- 63.22
28
+ 61.9
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>131</b> relevant lines.
36
- <span class="green"><b>131</b> lines covered</span> and
37
- <span class="red"><b>0</b> lines missed </span>
35
+ <b>134</b> relevant lines.
36
+ <span class="green"><b>133</b> lines covered</span> and
37
+ <span class="red"><b>1</b> lines missed </span>
38
38
  </div>
39
39
  <table class="file_list">
40
40
  <thead>
@@ -62,12 +62,12 @@
62
62
 
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
- <td class="green strong">100.0 %</td>
66
- <td>88</td>
67
- <td>30</td>
68
- <td>30</td>
69
- <td>0</td>
70
- <td>6.5</td>
65
+ <td class="green strong">96.97 %</td>
66
+ <td>93</td>
67
+ <td>33</td>
68
+ <td>32</td>
69
+ <td>1</td>
70
+ <td>6.3</td>
71
71
  </tr>
72
72
 
73
73
  <tr>
@@ -719,11 +719,11 @@
719
719
  <div class="source_table" id="192e300fd7769b750c82567439ee016f85516f3d">
720
720
  <div class="header">
721
721
  <h3>lib/blackbox/gem.rb</h3>
722
- <h4><span class="green">100.0 %</span> covered</h4>
722
+ <h4><span class="green">96.97 %</span> covered</h4>
723
723
  <div>
724
- <b>30</b> relevant lines.
725
- <span class="green"><b>30</b> lines covered</span> and
726
- <span class="red"><b>0</b> lines missed.</span>
724
+ <b>33</b> relevant lines.
725
+ <span class="green"><b>32</b> lines covered</span> and
726
+ <span class="red"><b>1</b> lines missed.</span>
727
727
  </div>
728
728
  </div>
729
729
 
@@ -919,340 +919,370 @@
919
919
  <li class="covered" data-hits="8" data-linenumber="32">
920
920
  <span class="hits">8</span>
921
921
 
922
+ <code class="ruby"> calling_file = caller[0].split(&#39;:&#39;)[0]</code>
923
+ </li>
924
+
925
+ <li class="covered" data-hits="8" data-linenumber="33">
926
+ <span class="hits">8</span>
927
+
922
928
  <code class="ruby"> spec = ::Gem::Specification.find do |s|</code>
923
929
  </li>
924
930
 
925
- <li class="covered" data-hits="32" data-linenumber="33">
931
+ <li class="covered" data-hits="32" data-linenumber="34">
926
932
  <span class="hits">32</span>
927
933
 
928
- <code class="ruby"> File.fnmatch(File.join(s.full_gem_path, &#39;*&#39;), __FILE__)</code>
934
+ <code class="ruby"> File.fnmatch(File.join(s.full_gem_path, &#39;*&#39;), calling_file)</code>
929
935
  </li>
930
936
 
931
- <li class="never" data-hits="" data-linenumber="34">
937
+ <li class="never" data-hits="" data-linenumber="35">
932
938
 
933
939
 
934
940
  <code class="ruby"> end</code>
935
941
  </li>
936
942
 
937
- <li class="never" data-hits="" data-linenumber="35">
943
+ <li class="never" data-hits="" data-linenumber="36">
938
944
 
939
945
 
940
946
  <code class="ruby"></code>
941
947
  </li>
942
948
 
943
- <li class="covered" data-hits="8" data-linenumber="36">
949
+ <li class="covered" data-hits="8" data-linenumber="37">
944
950
  <span class="hits">8</span>
945
951
 
946
- <code class="ruby"> ret[:gem_installed_version] = spec&amp;.version.to_s || :unknown</code>
952
+ <code class="ruby"> ret[:gem_installed_version] = spec&amp;.version&amp;.to_s || :unknown</code>
947
953
  </li>
948
954
 
949
- <li class="covered" data-hits="8" data-linenumber="37">
955
+ <li class="covered" data-hits="8" data-linenumber="38">
950
956
  <span class="hits">8</span>
951
957
 
952
958
  <code class="ruby"> ret[:gem_name] = spec&amp;.name || :unknown</code>
953
959
  </li>
954
960
 
955
- <li class="never" data-hits="" data-linenumber="38">
961
+ <li class="never" data-hits="" data-linenumber="39">
956
962
 
957
963
 
958
964
  <code class="ruby"></code>
959
965
  </li>
960
966
 
961
- <li class="covered" data-hits="8" data-linenumber="39">
967
+ <li class="covered" data-hits="8" data-linenumber="40">
962
968
  <span class="hits">8</span>
963
969
 
964
970
  <code class="ruby"> opts = { # defaults</code>
965
971
  </li>
966
972
 
967
- <li class="never" data-hits="" data-linenumber="40">
973
+ <li class="never" data-hits="" data-linenumber="41">
968
974
 
969
975
 
970
976
  <code class="ruby"> check_interval: 3600,</code>
971
977
  </li>
972
978
 
973
- <li class="never" data-hits="" data-linenumber="41">
979
+ <li class="never" data-hits="" data-linenumber="42">
974
980
 
975
981
 
976
- <code class="ruby"> disabling_env_var: &quot;#{spec.name.upcase}_DISABLE_VERSION_CHECK&quot;</code>
982
+ <code class="ruby"> disabling_env_var: &quot;#{ret[:gem_name].upcase}_DISABLE_VERSION_CHECK&quot;</code>
977
983
  </li>
978
984
 
979
- <li class="never" data-hits="" data-linenumber="42">
985
+ <li class="never" data-hits="" data-linenumber="43">
980
986
 
981
987
 
982
988
  <code class="ruby"> }.merge(opts)</code>
983
989
  </li>
984
990
 
985
- <li class="never" data-hits="" data-linenumber="43">
991
+ <li class="never" data-hits="" data-linenumber="44">
986
992
 
987
993
 
988
994
  <code class="ruby"></code>
989
995
  </li>
990
996
 
991
- <li class="covered" data-hits="8" data-linenumber="44">
997
+ <li class="covered" data-hits="8" data-linenumber="45">
992
998
  <span class="hits">8</span>
993
999
 
994
1000
  <code class="ruby"> return ret if ret[:gem_name] == :unknown</code>
995
1001
  </li>
996
1002
 
997
- <li class="covered" data-hits="8" data-linenumber="45">
1003
+ <li class="covered" data-hits="8" data-linenumber="46">
998
1004
  <span class="hits">8</span>
999
1005
 
1000
1006
  <code class="ruby"> return ret if ret[:gem_installed_version] == :unknown</code>
1001
1007
  </li>
1002
1008
 
1003
- <li class="covered" data-hits="8" data-linenumber="46">
1009
+ <li class="covered" data-hits="8" data-linenumber="47">
1004
1010
  <span class="hits">8</span>
1005
1011
 
1006
1012
  <code class="ruby"> if opts[:disabling_env_var] &amp;&amp; ENV.include?(opts[:disabling_env_var])</code>
1007
1013
  </li>
1008
1014
 
1009
- <li class="covered" data-hits="1" data-linenumber="47">
1015
+ <li class="covered" data-hits="1" data-linenumber="48">
1010
1016
  <span class="hits">1</span>
1011
1017
 
1012
1018
  <code class="ruby"> ret[:next_check_for_update] = :never</code>
1013
1019
  </li>
1014
1020
 
1015
- <li class="covered" data-hits="1" data-linenumber="48">
1021
+ <li class="covered" data-hits="1" data-linenumber="49">
1016
1022
  <span class="hits">1</span>
1017
1023
 
1018
1024
  <code class="ruby"> return ret</code>
1019
1025
  </li>
1020
1026
 
1021
- <li class="never" data-hits="" data-linenumber="49">
1027
+ <li class="never" data-hits="" data-linenumber="50">
1022
1028
 
1023
1029
 
1024
1030
  <code class="ruby"> end</code>
1025
1031
  </li>
1026
1032
 
1027
- <li class="never" data-hits="" data-linenumber="50">
1033
+ <li class="never" data-hits="" data-linenumber="51">
1028
1034
 
1029
1035
 
1030
1036
  <code class="ruby"></code>
1031
1037
  </li>
1032
1038
 
1033
- <li class="covered" data-hits="7" data-linenumber="51">
1039
+ <li class="covered" data-hits="7" data-linenumber="52">
1034
1040
  <span class="hits">7</span>
1035
1041
 
1036
1042
  <code class="ruby"> require &#39;gem_update_checker&#39;</code>
1037
1043
  </li>
1038
1044
 
1039
- <li class="covered" data-hits="7" data-linenumber="52">
1045
+ <li class="covered" data-hits="7" data-linenumber="53">
1040
1046
  <span class="hits">7</span>
1041
1047
 
1042
1048
  <code class="ruby"> require &#39;tmpdir&#39;</code>
1043
1049
  </li>
1044
1050
 
1045
- <li class="covered" data-hits="7" data-linenumber="53">
1051
+ <li class="covered" data-hits="7" data-linenumber="54">
1046
1052
  <span class="hits">7</span>
1047
1053
 
1048
1054
  <code class="ruby"> require &#39;fileutils&#39;</code>
1049
1055
  </li>
1050
1056
 
1051
- <li class="never" data-hits="" data-linenumber="54">
1057
+ <li class="never" data-hits="" data-linenumber="55">
1052
1058
 
1053
1059
 
1054
1060
  <code class="ruby"></code>
1055
1061
  </li>
1056
1062
 
1057
- <li class="covered" data-hits="7" data-linenumber="55">
1063
+ <li class="covered" data-hits="7" data-linenumber="56">
1058
1064
  <span class="hits">7</span>
1059
1065
 
1060
1066
  <code class="ruby"> statefile_path = File.join(Dir.tmpdir, &quot;#{ret[:gem_name]}-#{ret[:gem_installed_version]}.last_update_check&quot;)</code>
1061
1067
  </li>
1062
1068
 
1063
- <li class="never" data-hits="" data-linenumber="56">
1069
+ <li class="never" data-hits="" data-linenumber="57">
1064
1070
 
1065
1071
 
1066
1072
  <code class="ruby"></code>
1067
1073
  </li>
1068
1074
 
1069
- <li class="covered" data-hits="7" data-linenumber="57">
1075
+ <li class="covered" data-hits="7" data-linenumber="58">
1070
1076
  <span class="hits">7</span>
1071
1077
 
1072
1078
  <code class="ruby"> last_check_at = nil</code>
1073
1079
  </li>
1074
1080
 
1075
- <li class="covered" data-hits="7" data-linenumber="58">
1081
+ <li class="covered" data-hits="7" data-linenumber="59">
1076
1082
  <span class="hits">7</span>
1077
1083
 
1078
1084
  <code class="ruby"> begin</code>
1079
1085
  </li>
1080
1086
 
1081
- <li class="covered" data-hits="7" data-linenumber="59">
1087
+ <li class="covered" data-hits="7" data-linenumber="60">
1082
1088
  <span class="hits">7</span>
1083
1089
 
1084
1090
  <code class="ruby"> last_check_at = File.stat(statefile_path).mtime</code>
1085
1091
  </li>
1086
1092
 
1087
- <li class="never" data-hits="" data-linenumber="60">
1093
+ <li class="never" data-hits="" data-linenumber="61">
1088
1094
 
1089
1095
 
1090
1096
  <code class="ruby"> rescue</code>
1091
1097
  </li>
1092
1098
 
1093
- <li class="covered" data-hits="1" data-linenumber="61">
1094
- <span class="hits">1</span>
1099
+ <li class="missed" data-hits="0" data-linenumber="62">
1100
+
1095
1101
 
1096
1102
  <code class="ruby"> last_check_at = Time.at(0)</code>
1097
1103
  </li>
1098
1104
 
1099
- <li class="never" data-hits="" data-linenumber="62">
1105
+ <li class="never" data-hits="" data-linenumber="63">
1100
1106
 
1101
1107
 
1102
1108
  <code class="ruby"> end</code>
1103
1109
  </li>
1104
1110
 
1105
- <li class="never" data-hits="" data-linenumber="63">
1111
+ <li class="never" data-hits="" data-linenumber="64">
1106
1112
 
1107
1113
 
1108
1114
  <code class="ruby"></code>
1109
1115
  </li>
1110
1116
 
1111
- <li class="covered" data-hits="7" data-linenumber="64">
1117
+ <li class="covered" data-hits="7" data-linenumber="65">
1112
1118
  <span class="hits">7</span>
1113
1119
 
1114
1120
  <code class="ruby"> ret.merge!(</code>
1115
1121
  </li>
1116
1122
 
1117
- <li class="never" data-hits="" data-linenumber="65">
1123
+ <li class="never" data-hits="" data-linenumber="66">
1118
1124
 
1119
1125
 
1120
1126
  <code class="ruby"> last_checked_for_update: last_check_at,</code>
1121
1127
  </li>
1122
1128
 
1123
- <li class="never" data-hits="" data-linenumber="66">
1129
+ <li class="never" data-hits="" data-linenumber="67">
1124
1130
 
1125
1131
 
1126
1132
  <code class="ruby"> next_check_for_update: last_check_at + opts[:check_interval]</code>
1127
1133
  </li>
1128
1134
 
1129
- <li class="never" data-hits="" data-linenumber="67">
1135
+ <li class="never" data-hits="" data-linenumber="68">
1130
1136
 
1131
1137
 
1132
1138
  <code class="ruby"> )</code>
1133
1139
  </li>
1134
1140
 
1135
- <li class="never" data-hits="" data-linenumber="68">
1141
+ <li class="never" data-hits="" data-linenumber="69">
1136
1142
 
1137
1143
 
1138
1144
  <code class="ruby"></code>
1139
1145
  </li>
1140
1146
 
1141
- <li class="covered" data-hits="7" data-linenumber="69">
1147
+ <li class="covered" data-hits="7" data-linenumber="70">
1142
1148
  <span class="hits">7</span>
1143
1149
 
1144
1150
  <code class="ruby"> return ret if last_check_at + opts[:check_interval] &gt; Time.now &amp;&amp; !opts[:force_check]</code>
1145
1151
  </li>
1146
1152
 
1147
- <li class="never" data-hits="" data-linenumber="70">
1153
+ <li class="never" data-hits="" data-linenumber="71">
1148
1154
 
1149
1155
 
1150
1156
  <code class="ruby"></code>
1151
1157
  </li>
1152
1158
 
1153
- <li class="covered" data-hits="6" data-linenumber="71">
1159
+ <li class="covered" data-hits="6" data-linenumber="72">
1154
1160
  <span class="hits">6</span>
1155
1161
 
1156
1162
  <code class="ruby"> checker = GemUpdateChecker::Client.new(ret[:gem_name], ret[:gem_installed_version])</code>
1157
1163
  </li>
1158
1164
 
1159
- <li class="covered" data-hits="6" data-linenumber="72">
1165
+ <li class="covered" data-hits="6" data-linenumber="73">
1160
1166
  <span class="hits">6</span>
1161
1167
 
1162
1168
  <code class="ruby"> last_check_at = Time.now</code>
1163
1169
  </li>
1164
1170
 
1165
- <li class="never" data-hits="" data-linenumber="73">
1171
+ <li class="never" data-hits="" data-linenumber="74">
1166
1172
 
1167
1173
 
1168
1174
  <code class="ruby"></code>
1169
1175
  </li>
1170
1176
 
1171
- <li class="covered" data-hits="6" data-linenumber="74">
1177
+ <li class="covered" data-hits="6" data-linenumber="75">
1172
1178
  <span class="hits">6</span>
1173
1179
 
1174
1180
  <code class="ruby"> ret.merge!(</code>
1175
1181
  </li>
1176
1182
 
1177
- <li class="never" data-hits="" data-linenumber="75">
1183
+ <li class="never" data-hits="" data-linenumber="76">
1178
1184
 
1179
1185
 
1180
1186
  <code class="ruby"> gem_latest_version: checker.latest_version,</code>
1181
1187
  </li>
1182
1188
 
1183
- <li class="never" data-hits="" data-linenumber="76">
1189
+ <li class="never" data-hits="" data-linenumber="77">
1184
1190
 
1185
1191
 
1186
1192
  <code class="ruby"> last_checked_for_update: last_check_at,</code>
1187
1193
  </li>
1188
1194
 
1189
- <li class="never" data-hits="" data-linenumber="77">
1195
+ <li class="never" data-hits="" data-linenumber="78">
1190
1196
 
1191
1197
 
1192
1198
  <code class="ruby"> next_check_for_update: last_check_at + opts[:check_interval],</code>
1193
1199
  </li>
1194
1200
 
1195
- <li class="never" data-hits="" data-linenumber="78">
1201
+ <li class="never" data-hits="" data-linenumber="79">
1196
1202
 
1197
1203
 
1198
1204
  <code class="ruby"> installed_is_latest: ret[:gem_installed_version] == checker.latest_version,</code>
1199
1205
  </li>
1200
1206
 
1201
- <li class="never" data-hits="" data-linenumber="79">
1207
+ <li class="never" data-hits="" data-linenumber="80">
1202
1208
 
1203
1209
 
1204
1210
  <code class="ruby"> gem_update_available: checker.update_available</code>
1205
1211
  </li>
1206
1212
 
1207
- <li class="never" data-hits="" data-linenumber="80">
1213
+ <li class="never" data-hits="" data-linenumber="81">
1208
1214
 
1209
1215
 
1210
1216
  <code class="ruby"> )</code>
1211
1217
  </li>
1212
1218
 
1213
- <li class="never" data-hits="" data-linenumber="81">
1219
+ <li class="never" data-hits="" data-linenumber="82">
1214
1220
 
1215
1221
 
1216
1222
  <code class="ruby"></code>
1217
1223
  </li>
1218
1224
 
1219
- <li class="covered" data-hits="6" data-linenumber="82">
1225
+ <li class="covered" data-hits="6" data-linenumber="83">
1220
1226
  <span class="hits">6</span>
1221
1227
 
1222
- <code class="ruby"> FileUtils.touch(statefile_path, mtime: Time.now) if ret[:installed_is_latest] || opts[:force_check]</code>
1228
+ <code class="ruby"> if ret[:installed_is_latest] || opts[:force_check]</code>
1223
1229
  </li>
1224
1230
 
1225
- <li class="never" data-hits="" data-linenumber="83">
1231
+ <li class="covered" data-hits="4" data-linenumber="84">
1232
+ <span class="hits">4</span>
1233
+
1234
+ <code class="ruby"> FileUtils.touch(statefile_path, mtime: Time.now)</code>
1235
+ </li>
1236
+
1237
+ <li class="never" data-hits="" data-linenumber="85">
1238
+
1239
+
1240
+ <code class="ruby"> else</code>
1241
+ </li>
1242
+
1243
+ <li class="covered" data-hits="2" data-linenumber="86">
1244
+ <span class="hits">2</span>
1245
+
1246
+ <code class="ruby"> ret[:next_check_for_update] = Time.now</code>
1247
+ </li>
1248
+
1249
+ <li class="never" data-hits="" data-linenumber="87">
1250
+
1251
+
1252
+ <code class="ruby"> end</code>
1253
+ </li>
1254
+
1255
+ <li class="never" data-hits="" data-linenumber="88">
1226
1256
 
1227
1257
 
1228
1258
  <code class="ruby"></code>
1229
1259
  </li>
1230
1260
 
1231
- <li class="covered" data-hits="6" data-linenumber="84">
1261
+ <li class="covered" data-hits="6" data-linenumber="89">
1232
1262
  <span class="hits">6</span>
1233
1263
 
1234
1264
  <code class="ruby"> ret</code>
1235
1265
  </li>
1236
1266
 
1237
- <li class="never" data-hits="" data-linenumber="85">
1267
+ <li class="never" data-hits="" data-linenumber="90">
1238
1268
 
1239
1269
 
1240
1270
  <code class="ruby"> end</code>
1241
1271
  </li>
1242
1272
 
1243
- <li class="never" data-hits="" data-linenumber="86">
1273
+ <li class="never" data-hits="" data-linenumber="91">
1244
1274
 
1245
1275
 
1246
1276
  <code class="ruby"> end</code>
1247
1277
  </li>
1248
1278
 
1249
- <li class="never" data-hits="" data-linenumber="87">
1279
+ <li class="never" data-hits="" data-linenumber="92">
1250
1280
 
1251
1281
 
1252
1282
  <code class="ruby"> end</code>
1253
1283
  </li>
1254
1284
 
1255
- <li class="never" data-hits="" data-linenumber="88">
1285
+ <li class="never" data-hits="" data-linenumber="93">
1256
1286
 
1257
1287
 
1258
1288
  <code class="ruby">end</code>
data/doc/BB.html CHANGED
@@ -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.2</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.4</span><span class='tstring_end'>&#39;</span></span></pre></dd>
119
119
 
120
120
  </dl>
121
121
 
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
 
133
133
  <div id="footer">
134
- Generated on Sat May 14 22:10:23 2016 by
134
+ Generated on Sat May 14 23:58:48 2016 by
135
135
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
136
136
  0.8.7.6 (ruby-2.3.1).
137
137
  </div>
data/doc/BB/Crypto.html CHANGED
@@ -1132,7 +1132,7 @@
1132
1132
  </div>
1133
1133
 
1134
1134
  <div id="footer">
1135
- Generated on Sat May 14 22:10:23 2016 by
1135
+ Generated on Sat May 14 23:58:48 2016 by
1136
1136
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1137
1137
  0.8.7.6 (ruby-2.3.1).
1138
1138
  </div>
data/doc/BB/Gem.html CHANGED
@@ -338,7 +338,12 @@ version?</p>
338
338
  82
339
339
  83
340
340
  84
341
- 85</pre>
341
+ 85
342
+ 86
343
+ 87
344
+ 88
345
+ 89
346
+ 90</pre>
342
347
  </td>
343
348
  <td>
344
349
  <pre class="code"><span class="info file"># File 'lib/blackbox/gem.rb', line 21</span>
@@ -354,16 +359,17 @@ version?</p>
354
359
  <span class='label'>installed_is_latest:</span> <span class='kw'>true</span>
355
360
  <span class='rbrace'>}</span>
356
361
 
362
+ <span class='id identifier rubyid_calling_file'>calling_file</span> <span class='op'>=</span> <span class='id identifier rubyid_caller'>caller</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
357
363
  <span class='id identifier rubyid_spec'>spec</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Gem</span><span class='op'>::</span><span class='const'>Specification</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span>
358
- <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_fnmatch'>fnmatch</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_full_gem_path'>full_gem_path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>*</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='kw'>__FILE__</span><span class='rparen'>)</span>
364
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_fnmatch'>fnmatch</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_full_gem_path'>full_gem_path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>*</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_calling_file'>calling_file</span><span class='rparen'>)</span>
359
365
  <span class='kw'>end</span>
360
366
 
361
- <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='op'>=</span> <span class='id identifier rubyid_spec'>spec</span><span class='op'>&amp;.</span><span class='id identifier rubyid_version'>version</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>||</span> <span class='symbol'>:unknown</span>
367
+ <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='op'>=</span> <span class='id identifier rubyid_spec'>spec</span><span class='op'>&amp;.</span><span class='id identifier rubyid_version'>version</span><span class='op'>&amp;.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>||</span> <span class='symbol'>:unknown</span>
362
368
  <span class='id identifier rubyid_ret'>ret</span><span class='lbracket'>[</span><span class='symbol'>:gem_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_spec'>spec</span><span class='op'>&amp;.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>||</span> <span class='symbol'>:unknown</span>
363
369
 
364
370
  <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='comment'># defaults
365
371
  </span> <span class='label'>check_interval:</span> <span class='int'>3600</span><span class='comma'>,</span>
366
- <span class='label'>disabling_env_var:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_spec'>spec</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='embexpr_end'>}</span><span class='tstring_content'>_DISABLE_VERSION_CHECK</span><span class='tstring_end'>&quot;</span></span>
372
+ <span class='label'>disabling_env_var:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</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='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='embexpr_end'>}</span><span class='tstring_content'>_DISABLE_VERSION_CHECK</span><span class='tstring_end'>&quot;</span></span>
367
373
  <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
368
374
 
369
375
  <span class='kw'>return</span> <span class='id identifier rubyid_ret'>ret</span> <span class='kw'>if</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='op'>==</span> <span class='symbol'>:unknown</span>
@@ -404,7 +410,11 @@ version?</p>
404
410
  <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>
405
411
  <span class='rparen'>)</span>
406
412
 
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>
413
+ <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>
414
+ <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>
415
+ <span class='kw'>else</span>
416
+ <span class='id identifier rubyid_ret'>ret</span><span class='lbracket'>[</span><span class='symbol'>:next_check_for_update</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
417
+ <span class='kw'>end</span>
408
418
 
409
419
  <span class='id identifier rubyid_ret'>ret</span>
410
420
  <span class='kw'>end</span></pre>
@@ -418,7 +428,7 @@ version?</p>
418
428
  </div>
419
429
 
420
430
  <div id="footer">
421
- Generated on Sat May 14 22:10:23 2016 by
431
+ Generated on Sat May 14 23:58:48 2016 by
422
432
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
423
433
  0.8.7.6 (ruby-2.3.1).
424
434
  </div>
data/doc/BB/Hash.html CHANGED
@@ -432,7 +432,7 @@ BB::Hash.flatten_prop_style(input)
432
432
  </div>
433
433
 
434
434
  <div id="footer">
435
- Generated on Sat May 14 22:10:23 2016 by
435
+ Generated on Sat May 14 23:58:48 2016 by
436
436
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
437
437
  0.8.7.6 (ruby-2.3.1).
438
438
  </div>
data/doc/BB/Number.html CHANGED
@@ -922,7 +922,7 @@ 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 22:10:23 2016 by
925
+ Generated on Sat May 14 23:58:48 2016 by
926
926
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
927
927
  0.8.7.6 (ruby-2.3.1).
928
928
  </div>
data/doc/BB/String.html CHANGED
@@ -231,7 +231,7 @@
231
231
  </div>
232
232
 
233
233
  <div id="footer">
234
- Generated on Sat May 14 22:10:23 2016 by
234
+ Generated on Sat May 14 23:58:48 2016 by
235
235
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
236
236
  0.8.7.6 (ruby-2.3.1).
237
237
  </div>
data/doc/_index.html CHANGED
@@ -176,7 +176,7 @@
176
176
  </div>
177
177
 
178
178
  <div id="footer">
179
- Generated on Sat May 14 22:10:23 2016 by
179
+ Generated on Sat May 14 23:58:48 2016 by
180
180
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
181
181
  0.8.7.6 (ruby-2.3.1).
182
182
  </div>
data/doc/file.README.html CHANGED
@@ -95,7 +95,7 @@ BB::String.strip_ansi( ... )
95
95
  </div></div>
96
96
 
97
97
  <div id="footer">
98
- Generated on Sat May 14 22:10:23 2016 by
98
+ Generated on Sat May 14 23:58:48 2016 by
99
99
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
100
100
  0.8.7.6 (ruby-2.3.1).
101
101
  </div>
data/doc/index.html CHANGED
@@ -95,7 +95,7 @@ BB::String.strip_ansi( ... )
95
95
  </div></div>
96
96
 
97
97
  <div id="footer">
98
- Generated on Sat May 14 22:10:23 2016 by
98
+ Generated on Sat May 14 23:58:48 2016 by
99
99
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
100
100
  0.8.7.6 (ruby-2.3.1).
101
101
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sat May 14 22:10:23 2016 by
106
+ Generated on Sat May 14 23:58:48 2016 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.7.6 (ruby-2.3.1).
109
109
  </div>
data/lib/blackbox/gem.rb CHANGED
@@ -29,16 +29,17 @@ module BB
29
29
  installed_is_latest: true
30
30
  }
31
31
 
32
+ calling_file = caller[0].split(':')[0]
32
33
  spec = ::Gem::Specification.find do |s|
33
- File.fnmatch(File.join(s.full_gem_path, '*'), __FILE__)
34
+ File.fnmatch(File.join(s.full_gem_path, '*'), calling_file)
34
35
  end
35
36
 
36
- ret[:gem_installed_version] = spec&.version.to_s || :unknown
37
+ ret[:gem_installed_version] = spec&.version&.to_s || :unknown
37
38
  ret[:gem_name] = spec&.name || :unknown
38
39
 
39
40
  opts = { # defaults
40
41
  check_interval: 3600,
41
- disabling_env_var: "#{spec.name.upcase}_DISABLE_VERSION_CHECK"
42
+ disabling_env_var: "#{ret[:gem_name].upcase}_DISABLE_VERSION_CHECK"
42
43
  }.merge(opts)
43
44
 
44
45
  return ret if ret[:gem_name] == :unknown
@@ -79,7 +80,11 @@ module BB
79
80
  gem_update_available: checker.update_available
80
81
  )
81
82
 
82
- FileUtils.touch(statefile_path, mtime: Time.now) if ret[:installed_is_latest] || opts[:force_check]
83
+ if ret[:installed_is_latest] || opts[:force_check]
84
+ FileUtils.touch(statefile_path, mtime: Time.now)
85
+ else
86
+ ret[:next_check_for_update] = Time.now
87
+ end
83
88
 
84
89
  ret
85
90
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module BB
3
- VERSION = '3.1.2'
3
+ VERSION = '3.1.4'
4
4
  end
data/spec/gem_spec.rb CHANGED
@@ -53,9 +53,15 @@ describe BB::Gem do
53
53
  at = Time.parse('2015-10-21 07:28')
54
54
  Timecop.freeze(at) do
55
55
  retval = BB::Gem.version_info(check_interval: 60)
56
- expect(retval).to include(
57
- next_check_for_update: at + 60
58
- )
56
+ if retval[:installed_is_latest] == false
57
+ expect(retval).to include(
58
+ next_check_for_update: at
59
+ )
60
+ else
61
+ expect(retval).to include(
62
+ next_check_for_update: at + 60
63
+ )
64
+ end
59
65
  end
60
66
  end
61
67
 
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.2
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moe