blackbox 1.1.2 → 3.1.1
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/.rubocop.yml +25 -0
- data/Gemfile +1 -0
- data/Guardfile +3 -2
- data/Makefile +1 -0
- data/README.md +1 -1
- data/Rakefile +14 -16
- data/blackbox.gemspec +24 -18
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +136 -37
- data/coverage/.resultset.json.lock +0 -0
- data/coverage/assets/0.10.0/application.css +799 -0
- data/coverage/assets/0.10.0/application.js +1707 -0
- data/coverage/assets/0.10.0/colorbox/border.png +0 -0
- data/coverage/assets/0.10.0/colorbox/controls.png +0 -0
- data/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
- data/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.10.0/favicon_green.png +0 -0
- data/coverage/assets/0.10.0/favicon_red.png +0 -0
- data/coverage/assets/0.10.0/favicon_yellow.png +0 -0
- data/coverage/assets/0.10.0/loading.gif +0 -0
- data/coverage/assets/0.10.0/magnify.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +1153 -543
- data/doc/BB.html +22 -11
- data/doc/BB/Crypto.html +30 -34
- data/doc/BB/Gem.html +415 -0
- data/doc/BB/Hash.html +16 -16
- data/doc/BB/Number.html +100 -68
- data/doc/BB/String.html +12 -12
- data/doc/_index.html +22 -7
- data/doc/class_list.html +8 -3
- data/doc/css/style.css +2 -1
- data/doc/file.README.html +7 -7
- data/doc/file_list.html +7 -2
- data/doc/frames.html +5 -7
- data/doc/index.html +7 -7
- data/doc/js/app.js +7 -2
- data/doc/js/full_list.js +11 -3
- data/doc/method_list.html +25 -38
- data/doc/top-level-namespace.html +6 -6
- data/lib/blackbox.rb +7 -5
- data/lib/blackbox/crypto.rb +8 -10
- data/lib/blackbox/gem.rb +82 -0
- data/lib/blackbox/hash.rb +5 -5
- data/lib/blackbox/number.rb +127 -110
- data/lib/blackbox/string.rb +5 -5
- data/lib/blackbox/version.rb +2 -1
- data/spec/blackbox_spec.rb +1 -1
- data/spec/crypto_spec.rb +23 -23
- data/spec/gem_spec.rb +48 -0
- data/spec/hash_spec.rb +26 -26
- data/spec/number_spec.rb +95 -44
- data/spec/spec_helper.rb +2 -1
- data/spec/string_spec.rb +3 -3
- metadata +76 -4
data/doc/BB.html
CHANGED
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: BB
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.7.6
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
|
19
19
|
relpath = '';
|
|
20
|
-
framesUrl = "frames.html#!"
|
|
20
|
+
framesUrl = "frames.html#!BB.html";
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
|
|
@@ -79,18 +79,29 @@
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
<dt class="r1 last">Defined in:</dt>
|
|
82
|
-
<dd class="r1 last">lib/blackbox/
|
|
83
|
-
lib/blackbox/
|
|
82
|
+
<dd class="r1 last">lib/blackbox/gem.rb<span class="defines">,<br />
|
|
83
|
+
lib/blackbox/hash.rb,<br /> lib/blackbox/number.rb,<br /> lib/blackbox/crypto.rb,<br /> lib/blackbox/string.rb,<br /> lib/blackbox/version.rb</span>
|
|
84
84
|
</dd>
|
|
85
85
|
|
|
86
86
|
</dl>
|
|
87
87
|
<div class="clear"></div>
|
|
88
88
|
|
|
89
|
-
<h2>
|
|
89
|
+
<h2>Overview</h2><div class="docstring">
|
|
90
|
+
<div class="discussion">
|
|
91
|
+
|
|
92
|
+
<p>frozen_string_literal: true</p>
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="tags">
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
</div><h2>Defined Under Namespace</h2>
|
|
90
101
|
<p class="children">
|
|
91
102
|
|
|
92
103
|
|
|
93
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="BB/Crypto.html" title="BB::Crypto (module)">Crypto</a></span>, <span class='object_link'><a href="BB/Hash.html" title="BB::Hash (module)">Hash</a></span>, <span class='object_link'><a href="BB/Number.html" title="BB::Number (module)">Number</a></span>, <span class='object_link'><a href="BB/String.html" title="BB::String (module)">String</a></span>
|
|
104
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="BB/Crypto.html" title="BB::Crypto (module)">Crypto</a></span>, <span class='object_link'><a href="BB/Gem.html" title="BB::Gem (module)">Gem</a></span>, <span class='object_link'><a href="BB/Hash.html" title="BB::Hash (module)">Hash</a></span>, <span class='object_link'><a href="BB/Number.html" title="BB::Number (module)">Number</a></span>, <span class='object_link'><a href="BB/String.html" title="BB::String (module)">String</a></span>
|
|
94
105
|
|
|
95
106
|
|
|
96
107
|
|
|
@@ -104,7 +115,7 @@
|
|
|
104
115
|
<dt id="VERSION-constant" class="">VERSION =
|
|
105
116
|
|
|
106
117
|
</dt>
|
|
107
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'
|
|
118
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>3.1.1</span><span class='tstring_end'>'</span></span></pre></dd>
|
|
108
119
|
|
|
109
120
|
</dl>
|
|
110
121
|
|
|
@@ -120,9 +131,9 @@
|
|
|
120
131
|
</div>
|
|
121
132
|
|
|
122
133
|
<div id="footer">
|
|
123
|
-
Generated on
|
|
134
|
+
Generated on Sat May 14 21:21:15 2016 by
|
|
124
135
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
125
|
-
0.8.
|
|
136
|
+
0.8.7.6 (ruby-2.3.0).
|
|
126
137
|
</div>
|
|
127
138
|
|
|
128
139
|
</body>
|
data/doc/BB/Crypto.html
CHANGED
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: BB::Crypto
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.7.6
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
|
19
19
|
relpath = '../';
|
|
20
|
-
framesUrl = "../frames.html#!"
|
|
20
|
+
framesUrl = "../frames.html#!BB/Crypto.html";
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
|
|
@@ -379,7 +379,6 @@
|
|
|
379
379
|
<pre class="lines">
|
|
380
380
|
|
|
381
381
|
|
|
382
|
-
36
|
|
383
382
|
37
|
|
384
383
|
38
|
|
385
384
|
39
|
|
@@ -391,21 +390,18 @@
|
|
|
391
390
|
45
|
|
392
391
|
46
|
|
393
392
|
47
|
|
394
|
-
48
|
|
395
|
-
49</pre>
|
|
393
|
+
48</pre>
|
|
396
394
|
</td>
|
|
397
395
|
<td>
|
|
398
|
-
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line
|
|
396
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line 37</span>
|
|
399
397
|
|
|
400
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_decrypt'>decrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span
|
|
398
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_decrypt'>decrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aes-256-cbc</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
401
399
|
<span class='id identifier rubyid_cipher'>cipher</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Cipher</span><span class='op'>::</span><span class='const'>Cipher</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_cipher_type'>cipher_type</span><span class='rparen'>)</span>
|
|
402
400
|
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_decrypt'>decrypt</span>
|
|
403
401
|
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span>
|
|
404
402
|
<span class='kw'>if</span> <span class='id identifier rubyid_iv'>iv</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
|
405
403
|
<span class='id identifier rubyid_iv_len'>iv_len</span> <span class='op'>=</span> <span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='period'>.</span><span class='id identifier rubyid_slice!'>slice!</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_unpack'>unpack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>C</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
|
406
|
-
<span class='kw'>unless</span> <span class='int'>0</span> <span class='op'>==</span> <span class='id identifier rubyid_iv_len'>iv_len</span>
|
|
407
|
-
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='period'>.</span><span class='id identifier rubyid_slice!'>slice!</span><span class='lparen'>(</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_iv_len'>iv_len</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</span>
|
|
408
|
-
<span class='kw'>end</span>
|
|
404
|
+
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='period'>.</span><span class='id identifier rubyid_slice!'>slice!</span><span class='lparen'>(</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_iv_len'>iv_len</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='int'>0</span> <span class='op'>==</span> <span class='id identifier rubyid_iv_len'>iv_len</span>
|
|
409
405
|
<span class='kw'>else</span>
|
|
410
406
|
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='id identifier rubyid_iv'>iv</span>
|
|
411
407
|
<span class='kw'>end</span>
|
|
@@ -532,14 +528,14 @@
|
|
|
532
528
|
<pre class="lines">
|
|
533
529
|
|
|
534
530
|
|
|
531
|
+
69
|
|
535
532
|
70
|
|
536
|
-
71
|
|
537
|
-
72</pre>
|
|
533
|
+
71</pre>
|
|
538
534
|
</td>
|
|
539
535
|
<td>
|
|
540
|
-
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line
|
|
536
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line 69</span>
|
|
541
537
|
|
|
542
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_decrypt_base64'>decrypt_base64</span><span class='lparen'>(</span><span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span
|
|
538
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_decrypt_base64'>decrypt_base64</span><span class='lparen'>(</span><span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aes-256-cbc</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
543
539
|
<span class='id identifier rubyid_decrypt'>decrypt</span><span class='lparen'>(</span><span class='const'>Base64</span><span class='period'>.</span><span class='id identifier rubyid_decode64'>decode64</span><span class='lparen'>(</span><span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span><span class='rparen'>)</span>
|
|
544
540
|
<span class='kw'>end</span></pre>
|
|
545
541
|
</td>
|
|
@@ -663,14 +659,14 @@
|
|
|
663
659
|
<pre class="lines">
|
|
664
660
|
|
|
665
661
|
|
|
662
|
+
92
|
|
666
663
|
93
|
|
667
|
-
94
|
|
668
|
-
95</pre>
|
|
664
|
+
94</pre>
|
|
669
665
|
</td>
|
|
670
666
|
<td>
|
|
671
|
-
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line
|
|
667
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line 92</span>
|
|
672
668
|
|
|
673
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_decrypt_urlsafe_base64'>decrypt_urlsafe_base64</span><span class='lparen'>(</span><span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span
|
|
669
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_decrypt_urlsafe_base64'>decrypt_urlsafe_base64</span><span class='lparen'>(</span><span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aes-256-cbc</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
674
670
|
<span class='id identifier rubyid_decrypt'>decrypt</span><span class='lparen'>(</span><span class='const'>Base64</span><span class='period'>.</span><span class='id identifier rubyid_urlsafe_decode64'>urlsafe_decode64</span><span class='lparen'>(</span><span class='id identifier rubyid_ciphertext'>ciphertext</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span><span class='rparen'>)</span>
|
|
675
671
|
<span class='kw'>end</span></pre>
|
|
676
672
|
</td>
|
|
@@ -808,7 +804,6 @@
|
|
|
808
804
|
<pre class="lines">
|
|
809
805
|
|
|
810
806
|
|
|
811
|
-
16
|
|
812
807
|
17
|
|
813
808
|
18
|
|
814
809
|
19
|
|
@@ -819,12 +814,13 @@
|
|
|
819
814
|
24
|
|
820
815
|
25
|
|
821
816
|
26
|
|
822
|
-
27
|
|
817
|
+
27
|
|
818
|
+
28</pre>
|
|
823
819
|
</td>
|
|
824
820
|
<td>
|
|
825
|
-
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line
|
|
821
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line 17</span>
|
|
826
822
|
|
|
827
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_plaintext'>plaintext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span
|
|
823
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_plaintext'>plaintext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aes-256-cbc</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
828
824
|
<span class='id identifier rubyid_cipher'>cipher</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Cipher</span><span class='op'>::</span><span class='const'>Cipher</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_cipher_type'>cipher_type</span><span class='rparen'>)</span>
|
|
829
825
|
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span>
|
|
830
826
|
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span>
|
|
@@ -971,14 +967,14 @@
|
|
|
971
967
|
<pre class="lines">
|
|
972
968
|
|
|
973
969
|
|
|
970
|
+
58
|
|
974
971
|
59
|
|
975
|
-
60
|
|
976
|
-
61</pre>
|
|
972
|
+
60</pre>
|
|
977
973
|
</td>
|
|
978
974
|
<td>
|
|
979
|
-
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line
|
|
975
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line 58</span>
|
|
980
976
|
|
|
981
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_encrypt_base64'>encrypt_base64</span><span class='lparen'>(</span><span class='id identifier rubyid_plaintext'>plaintext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span
|
|
977
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_encrypt_base64'>encrypt_base64</span><span class='lparen'>(</span><span class='id identifier rubyid_plaintext'>plaintext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aes-256-cbc</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
982
978
|
<span class='const'>Base64</span><span class='period'>.</span><span class='id identifier rubyid_strict_encode64'>strict_encode64</span><span class='lparen'>(</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_plaintext'>plaintext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
983
979
|
<span class='kw'>end</span></pre>
|
|
984
980
|
</td>
|
|
@@ -1116,14 +1112,14 @@
|
|
|
1116
1112
|
<pre class="lines">
|
|
1117
1113
|
|
|
1118
1114
|
|
|
1115
|
+
81
|
|
1119
1116
|
82
|
|
1120
|
-
83
|
|
1121
|
-
84</pre>
|
|
1117
|
+
83</pre>
|
|
1122
1118
|
</td>
|
|
1123
1119
|
<td>
|
|
1124
|
-
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line
|
|
1120
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/crypto.rb', line 81</span>
|
|
1125
1121
|
|
|
1126
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_encrypt_urlsafe_base64'>encrypt_urlsafe_base64</span><span class='lparen'>(</span><span class='id identifier rubyid_plaintext'>plaintext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span
|
|
1122
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_encrypt_urlsafe_base64'>encrypt_urlsafe_base64</span><span class='lparen'>(</span><span class='id identifier rubyid_plaintext'>plaintext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aes-256-cbc</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
1127
1123
|
<span class='const'>Base64</span><span class='period'>.</span><span class='id identifier rubyid_urlsafe_encode64'>urlsafe_encode64</span><span class='lparen'>(</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_plaintext'>plaintext</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cipher_type'>cipher_type</span><span class='comma'>,</span> <span class='id identifier rubyid_iv'>iv</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
1128
1124
|
<span class='kw'>end</span></pre>
|
|
1129
1125
|
</td>
|
|
@@ -1136,9 +1132,9 @@
|
|
|
1136
1132
|
</div>
|
|
1137
1133
|
|
|
1138
1134
|
<div id="footer">
|
|
1139
|
-
Generated on
|
|
1135
|
+
Generated on Sat May 14 21:21:15 2016 by
|
|
1140
1136
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1141
|
-
0.8.
|
|
1137
|
+
0.8.7.6 (ruby-2.3.0).
|
|
1142
1138
|
</div>
|
|
1143
1139
|
|
|
1144
1140
|
</body>
|
data/doc/BB/Gem.html
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Module: BB::Gem
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.7.6
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../';
|
|
20
|
+
framesUrl = "../frames.html#!BB/Gem.html";
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="../_index.html">Index (G)</a> »
|
|
35
|
+
<span class='title'><span class='object_link'><a href="../BB.html" title="BB (module)">BB</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">Gem</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Module: BB::Gem
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
|
82
|
+
<dd class="r1 last">lib/blackbox/gem.rb</dd>
|
|
83
|
+
|
|
84
|
+
</dl>
|
|
85
|
+
<div class="clear"></div>
|
|
86
|
+
|
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
|
88
|
+
<div class="discussion">
|
|
89
|
+
|
|
90
|
+
<p>Gem utilities.</p>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
<div class="tags">
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
<h2>
|
|
107
|
+
Class Method Summary
|
|
108
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
109
|
+
</h2>
|
|
110
|
+
|
|
111
|
+
<ul class="summary">
|
|
112
|
+
|
|
113
|
+
<li class="public ">
|
|
114
|
+
<span class="summary_signature">
|
|
115
|
+
|
|
116
|
+
<a href="#version_info-class_method" title="version_info (class method)">+ (Hash) <strong>version_info</strong>(*_, **opts) </a>
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
</span>
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
<span class="summary_desc"><div class='inline'>
|
|
131
|
+
<p>Return information about the currently installed gem version and the latest
|
|
132
|
+
available version on rubygems.org.</p>
|
|
133
|
+
</div></span>
|
|
134
|
+
|
|
135
|
+
</li>
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
</ul>
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
<div id="class_method_details" class="method_details_list">
|
|
144
|
+
<h2>Class Method Details</h2>
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
<div class="method_details first">
|
|
148
|
+
<h3 class="signature first" id="version_info-class_method">
|
|
149
|
+
|
|
150
|
+
+ (<tt><span class='object_link'><a href="Hash.html" title="BB::Hash (module)">Hash</a></span></tt>) <strong>version_info</strong>(*_, **opts)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
</h3><div class="docstring">
|
|
157
|
+
<div class="discussion">
|
|
158
|
+
|
|
159
|
+
<p>Return information about the currently installed gem version and the latest
|
|
160
|
+
available version on rubygems.org.</p>
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
<div class="tags">
|
|
166
|
+
<p class="tag_title">Parameters:</p>
|
|
167
|
+
<ul class="param">
|
|
168
|
+
|
|
169
|
+
<li>
|
|
170
|
+
|
|
171
|
+
<span class='name'>opts</span>
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
<span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
—
|
|
179
|
+
<div class='inline'>
|
|
180
|
+
<p>the options to create a message with.</p>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
</li>
|
|
184
|
+
|
|
185
|
+
</ul>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
<p class="tag_title">Options Hash (<tt>**opts</tt>):</p>
|
|
193
|
+
<ul class="option">
|
|
194
|
+
|
|
195
|
+
<li>
|
|
196
|
+
<span class="name">:check_interval</span>
|
|
197
|
+
<span class="type">(<tt>Fixnum</tt>)</span>
|
|
198
|
+
<span class="default">
|
|
199
|
+
|
|
200
|
+
</span>
|
|
201
|
+
|
|
202
|
+
— <div class='inline'>
|
|
203
|
+
<p>how frequently to query rubygems.org (default: 3600)</p>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
</li>
|
|
207
|
+
|
|
208
|
+
<li>
|
|
209
|
+
<span class="name">:disabling_env_var</span>
|
|
210
|
+
<span class="type">(<tt><span class='object_link'><a href="String.html" title="BB::String (module)">String</a></span></tt>)</span>
|
|
211
|
+
<span class="default">
|
|
212
|
+
|
|
213
|
+
— default:
|
|
214
|
+
<tt>default: #GEMNAMEE}_DISABLE_VERSION_CHECK</tt>
|
|
215
|
+
|
|
216
|
+
</span>
|
|
217
|
+
|
|
218
|
+
</li>
|
|
219
|
+
|
|
220
|
+
<li>
|
|
221
|
+
<span class="name">[]</span>
|
|
222
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
223
|
+
<span class="default">
|
|
224
|
+
|
|
225
|
+
</span>
|
|
226
|
+
|
|
227
|
+
— <div class='inline'>
|
|
228
|
+
<p>:from ('nobody') From address</p>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
</li>
|
|
232
|
+
|
|
233
|
+
</ul>
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
<p class="tag_title">Returns:</p>
|
|
237
|
+
<ul class="return">
|
|
238
|
+
|
|
239
|
+
<li>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
<span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
—
|
|
247
|
+
<div class='inline'>
|
|
248
|
+
<p>result</p>
|
|
249
|
+
<ul><li>
|
|
250
|
+
<p>:gem_name => name of current gem</p>
|
|
251
|
+
</li><li>
|
|
252
|
+
<p>:gem_installed_version => installed version</p>
|
|
253
|
+
</li><li>
|
|
254
|
+
<p>:gem_latest_version => latest version on rubygems.org</p>
|
|
255
|
+
</li><li>
|
|
256
|
+
<p>:last_checked_for_update => timestamp of last query to rubygems.org</p>
|
|
257
|
+
</li><li>
|
|
258
|
+
<p>:next_check_for_update => timestamp of next query to rubygems.org</p>
|
|
259
|
+
</li><li>
|
|
260
|
+
<p>:gem_update_available => update available?</p>
|
|
261
|
+
</li><li>
|
|
262
|
+
<p>:installed_is_latest => is installed version == latest available
|
|
263
|
+
version?</p>
|
|
264
|
+
</li></ul>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
</li>
|
|
268
|
+
|
|
269
|
+
</ul>
|
|
270
|
+
|
|
271
|
+
</div><table class="source_code">
|
|
272
|
+
<tr>
|
|
273
|
+
<td>
|
|
274
|
+
<pre class="lines">
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
21
|
|
278
|
+
22
|
|
279
|
+
23
|
|
280
|
+
24
|
|
281
|
+
25
|
|
282
|
+
26
|
|
283
|
+
27
|
|
284
|
+
28
|
|
285
|
+
29
|
|
286
|
+
30
|
|
287
|
+
31
|
|
288
|
+
32
|
|
289
|
+
33
|
|
290
|
+
34
|
|
291
|
+
35
|
|
292
|
+
36
|
|
293
|
+
37
|
|
294
|
+
38
|
|
295
|
+
39
|
|
296
|
+
40
|
|
297
|
+
41
|
|
298
|
+
42
|
|
299
|
+
43
|
|
300
|
+
44
|
|
301
|
+
45
|
|
302
|
+
46
|
|
303
|
+
47
|
|
304
|
+
48
|
|
305
|
+
49
|
|
306
|
+
50
|
|
307
|
+
51
|
|
308
|
+
52
|
|
309
|
+
53
|
|
310
|
+
54
|
|
311
|
+
55
|
|
312
|
+
56
|
|
313
|
+
57
|
|
314
|
+
58
|
|
315
|
+
59
|
|
316
|
+
60
|
|
317
|
+
61
|
|
318
|
+
62
|
|
319
|
+
63
|
|
320
|
+
64
|
|
321
|
+
65
|
|
322
|
+
66
|
|
323
|
+
67
|
|
324
|
+
68
|
|
325
|
+
69
|
|
326
|
+
70
|
|
327
|
+
71
|
|
328
|
+
72
|
|
329
|
+
73
|
|
330
|
+
74
|
|
331
|
+
75
|
|
332
|
+
76
|
|
333
|
+
77
|
|
334
|
+
78
|
|
335
|
+
79</pre>
|
|
336
|
+
</td>
|
|
337
|
+
<td>
|
|
338
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/gem.rb', line 21</span>
|
|
339
|
+
|
|
340
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_version_info'>version_info</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
|
341
|
+
<span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
|
342
|
+
<span class='label'>gem_name:</span> <span class='symbol'>:unknown</span><span class='comma'>,</span>
|
|
343
|
+
<span class='label'>gem_installed_version:</span> <span class='symbol'>:unknown</span><span class='comma'>,</span>
|
|
344
|
+
<span class='label'>gem_latest_version:</span> <span class='symbol'>:unknown</span><span class='comma'>,</span>
|
|
345
|
+
<span class='label'>gem_update_available:</span> <span class='kw'>false</span><span class='comma'>,</span>
|
|
346
|
+
<span class='label'>last_checked_for_update:</span> <span class='symbol'>:unknown</span><span class='comma'>,</span>
|
|
347
|
+
<span class='label'>next_check_for_update:</span> <span class='symbol'>:unknown</span><span class='comma'>,</span>
|
|
348
|
+
<span class='label'>installed_is_latest:</span> <span class='kw'>true</span>
|
|
349
|
+
<span class='rbrace'>}</span>
|
|
350
|
+
|
|
351
|
+
<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>
|
|
352
|
+
<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'>'</span><span class='tstring_content'>*</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='kw'>__FILE__</span><span class='rparen'>)</span>
|
|
353
|
+
<span class='kw'>end</span>
|
|
354
|
+
|
|
355
|
+
<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'>&.</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>
|
|
356
|
+
<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'>&.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>||</span> <span class='symbol'>:unknown</span>
|
|
357
|
+
|
|
358
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='comment'># defaults
|
|
359
|
+
</span> <span class='label'>check_interval:</span> <span class='int'>3600</span><span class='comma'>,</span>
|
|
360
|
+
<span class='label'>disabling_env_var:</span> <span class='tstring'><span class='tstring_beg'>"</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'>"</span></span>
|
|
361
|
+
<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>
|
|
362
|
+
|
|
363
|
+
<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>
|
|
364
|
+
<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_installed_version</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:unknown</span>
|
|
365
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:disabling_env_var</span><span class='rbracket'>]</span> <span class='op'>&&</span> <span class='const'>ENV</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:disabling_env_var</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
366
|
+
<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='symbol'>:never</span>
|
|
367
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_ret'>ret</span>
|
|
368
|
+
<span class='kw'>end</span>
|
|
369
|
+
|
|
370
|
+
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>gem_update_checker</span><span class='tstring_end'>'</span></span>
|
|
371
|
+
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tmpdir</span><span class='tstring_end'>'</span></span>
|
|
372
|
+
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fileutils</span><span class='tstring_end'>'</span></span>
|
|
373
|
+
|
|
374
|
+
<span class='id identifier rubyid_statefile_path'>statefile_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_tmpdir'>tmpdir</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</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='embexpr_end'>}</span><span class='tstring_content'>-</span><span class='embexpr_beg'>#{</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='embexpr_end'>}</span><span class='tstring_content'>.last_update_check</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
375
|
+
|
|
376
|
+
<span class='id identifier rubyid_last_check_at'>last_check_at</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
377
|
+
<span class='kw'>begin</span>
|
|
378
|
+
<span class='id identifier rubyid_last_check_at'>last_check_at</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_stat'>stat</span><span class='lparen'>(</span><span class='id identifier rubyid_statefile_path'>statefile_path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_mtime'>mtime</span>
|
|
379
|
+
<span class='kw'>rescue</span>
|
|
380
|
+
<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
|
+
<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'>></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>
|
|
383
|
+
|
|
384
|
+
<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
|
+
<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>
|
|
386
|
+
|
|
387
|
+
<span class='id identifier rubyid_ret'>ret</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span>
|
|
388
|
+
<span class='label'>gem_latest_version:</span> <span class='id identifier rubyid_checker'>checker</span><span class='period'>.</span><span class='id identifier rubyid_latest_version'>latest_version</span><span class='comma'>,</span>
|
|
389
|
+
<span class='label'>last_checked_for_update:</span> <span class='id identifier rubyid_last_check_at'>last_check_at</span><span class='comma'>,</span>
|
|
390
|
+
<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><span class='comma'>,</span>
|
|
391
|
+
<span class='label'>installed_is_latest:</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='op'>==</span> <span class='id identifier rubyid_checker'>checker</span><span class='period'>.</span><span class='id identifier rubyid_latest_version'>latest_version</span><span class='comma'>,</span>
|
|
392
|
+
<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
|
+
<span class='rparen'>)</span>
|
|
394
|
+
|
|
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>
|
|
396
|
+
|
|
397
|
+
<span class='id identifier rubyid_ret'>ret</span>
|
|
398
|
+
<span class='kw'>end</span></pre>
|
|
399
|
+
</td>
|
|
400
|
+
</tr>
|
|
401
|
+
</table>
|
|
402
|
+
</div>
|
|
403
|
+
|
|
404
|
+
</div>
|
|
405
|
+
|
|
406
|
+
</div>
|
|
407
|
+
|
|
408
|
+
<div id="footer">
|
|
409
|
+
Generated on Sat May 14 21:21:15 2016 by
|
|
410
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
411
|
+
0.8.7.6 (ruby-2.3.0).
|
|
412
|
+
</div>
|
|
413
|
+
|
|
414
|
+
</body>
|
|
415
|
+
</html>
|