trick_bag 0.64.2 → 0.64.3

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: e8a48446e9119703f810133692137de8f195c871
4
- data.tar.gz: 8add889aa251bc76cc0ccf0ae86fa1148005115a
3
+ metadata.gz: 28ae94cfcd0c241ef6cd4d87ecae15af4a9929bf
4
+ data.tar.gz: ed2d558acf885889dff1ac5d187ffaaad87dd502
5
5
  SHA512:
6
- metadata.gz: d2725686797acdcc96003c781bca27ccf8009c5ae2c59eb52b9a3757da5d653299dea0466b28ac858db843315fa95c44e30484efc1ee20c716f601d2a2a38368
7
- data.tar.gz: 7b4a86cd52b46b1a583c13603e38edb1736cf2cd5300845cb8d9676a86809fca3656b21b3cd6a6737432e689fdaa818944135ac93f74ab1758c341874e073d4d
6
+ metadata.gz: 5cee6f95c71a61a9e4b7fed223afdbea81957a7befca0b4fff3b7ba2d39db48f5c1ce63f91d17bf95124c7756ce5834bb08f42f50a6471244097f3fbb33eebeb
7
+ data.tar.gz: 129f258783beb2feec46186284e07a0f1af10181ae538f1b10e5bf3785a924ae40b6130dc298f52debc32776f8d841371046c868b36290c6da1452dd87acf6bb
data/RELEASE_NOTES.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.64.3
2
+
3
+ * Fix retry_until_true_or_timeout bug.
4
+
5
+
1
6
  ## v0.64.2
2
7
 
3
8
  * Fix net-ssh version error on Ruby versions < 2.
@@ -34,13 +34,13 @@ module BinaryToHexAndAscii
34
34
  end
35
35
 
36
36
 
37
- def one_to_four_bytes_as_hex(bytes)
37
+ def bytes_as_hex(bytes)
38
38
  bytes.map { |b| "%02X" % b }.join(' ')
39
39
  end
40
40
 
41
41
 
42
42
  def offset_string(offset)
43
- "0x%4x" % [offset] # Offset, e.g. "0x 0" or "0x 10"
43
+ "0x%4X" % [offset] # Offset, e.g. "0x 0" or "0x 10"
44
44
  end
45
45
 
46
46
 
@@ -60,7 +60,7 @@ module BinaryToHexAndAscii
60
60
 
61
61
 
62
62
  def format_line(offset, bytes)
63
- sections = bytes.each_slice(4).to_a.map { |slice| one_to_four_bytes_as_hex(slice) }
63
+ sections = bytes.each_slice(4).to_a.map { |slice| bytes_as_hex(slice) }
64
64
 
65
65
  offset_string(offset) \
66
66
  << ' ' \
@@ -29,30 +29,40 @@ module Timing
29
29
  def retry_until_true_or_timeout(
30
30
  sleep_interval, timeout_secs, output_stream = $stdout, predicate = nil)
31
31
 
32
+ test_preconditions = -> do
33
+
34
+ # Method signature has changed from:
35
+ # (predicate, sleep_interval, timeout_secs, output_stream = $stdout)
36
+ # to:
37
+ # (sleep_interval, timeout_secs, output_stream = $stdout, predicate = nil)
38
+ #
39
+ # Test to see that when old signature is used, a descriptive error is raised.
40
+ #
41
+ # This test should be removed when we go to version 1.0.
42
+ if sleep_interval.respond_to?(:call)
43
+ raise ArgumentError.new('Sorry, method signature has changed to: ' \
44
+ '(sleep_interval, timeout_secs, output_stream = $stdout, predicate = nil).' \
45
+ ' Also a code block can now be provided instead of a lambda.')
46
+ end
32
47
 
33
- # Method signature has changed from:
34
- # (predicate, sleep_interval, timeout_secs, output_stream = $stdout)
35
- # to:
36
- # (sleep_interval, timeout_secs, output_stream = $stdout, predicate = nil)
37
- #
38
- # Test to see that when old signature is used, a descriptive error is raised.
39
- #
40
- # This test should be removed when we go to version 1.0.
41
- if sleep_interval.respond_to?(:call)
42
- raise ArgumentError.new('Sorry, method signature has changed to: ' \
43
- '(sleep_interval, timeout_secs, output_stream = $stdout, predicate = nil).' \
44
- ' Also a code block can now be provided instead of a lambda.')
48
+ if block_given? && predicate
49
+ raise ArgumentError.new('Both a predicate lambda and a code block were specified.' \
50
+ ' Please specify one or the other but not both.')
51
+ end
45
52
  end
46
53
 
47
- if block_given? && predicate
48
- raise ArgumentError.new('Both a predicate lambda and a code block were specified.' \
49
- ' Please specify one or the other but not both.')
50
- end
54
+ test_preconditions.()
51
55
 
52
56
  success = false
53
- end_time = Time.now + timeout_secs
54
- time_to_go = nil
55
- text_generator = ->() { '%9.3f %9.3f' % [time_elapsed, time_to_go] }
57
+ start_time = Time.now
58
+ end_time = start_time + timeout_secs
59
+
60
+ text_generator = ->() do
61
+ now = Time.now
62
+ elapsed = now - start_time
63
+ to_go = end_time - now
64
+ '%9.3f %9.3f' % [elapsed, to_go]
65
+ end
56
66
  status_updater = ::TrickBag::Io::TextModeStatusUpdater.new(text_generator, output_stream)
57
67
 
58
68
  loop do
@@ -1,3 +1,3 @@
1
1
  module TrickBag
2
- VERSION = '0.64.2'
2
+ VERSION = '0.64.3'
3
3
  end
@@ -13,11 +13,11 @@ module BinaryToHexAndAscii
13
13
  context '#one_to_four_bytes_as_hex' do
14
14
 
15
15
  specify '1 byte works' do
16
- expect(one_to_four_bytes_as_hex([1])).to eq('01')
16
+ expect(bytes_as_hex([1])).to eq('01')
17
17
  end
18
18
 
19
19
  specify '4 bytes works' do
20
- expect(one_to_four_bytes_as_hex([0, 16, 64, 255])).to eq('00 10 40 FF')
20
+ expect(bytes_as_hex([0, 16, 64, 255])).to eq('00 10 40 FF')
21
21
  end
22
22
 
23
23
  end
metadata CHANGED
@@ -1,99 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trick_bag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.64.2
4
+ version: 0.64.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Bennett
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-28 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: os
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
- - - ~>
17
+ - - "~>"
17
18
  - !ruby/object:Gem::Version
18
19
  version: '0'
19
- name: os
20
- prerelease: false
21
20
  type: :runtime
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
+ name: diffy
28
29
  requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ~>
31
+ - - "~>"
31
32
  - !ruby/object:Gem::Version
32
33
  version: '3.0'
33
- name: diffy
34
- prerelease: false
35
34
  type: :runtime
35
+ prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
+ name: net-ssh
42
43
  requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
- - - '='
45
+ - - ">="
45
46
  - !ruby/object:Gem::Version
46
- version: 2.9.2
47
- name: net-ssh
48
- prerelease: false
47
+ version: '0'
49
48
  type: :runtime
49
+ prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 2.9.2
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
+ name: bundler
56
57
  requirement: !ruby/object:Gem::Requirement
57
58
  requirements:
58
- - - ~>
59
+ - - "~>"
59
60
  - !ruby/object:Gem::Version
60
61
  version: '1.3'
61
- name: bundler
62
- prerelease: false
63
62
  type: :development
63
+ prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
+ name: rake
70
71
  requirement: !ruby/object:Gem::Requirement
71
72
  requirements:
72
- - - ~>
73
+ - - "~>"
73
74
  - !ruby/object:Gem::Version
74
75
  version: '10.1'
75
- name: rake
76
- prerelease: false
77
76
  type: :development
77
+ prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.1'
83
83
  - !ruby/object:Gem::Dependency
84
+ name: rspec
84
85
  requirement: !ruby/object:Gem::Requirement
85
86
  requirements:
86
- - - ~>
87
+ - - "~>"
87
88
  - !ruby/object:Gem::Version
88
89
  version: '3.0'
89
- name: rspec
90
- prerelease: false
91
90
  type: :development
91
+ prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.10'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.10'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.0'
97
125
  description: Miscellaneous general useful tools for general purpose programming.
98
126
  email:
99
127
  - keithrbennett@gmail.com
@@ -101,8 +129,8 @@ executables: []
101
129
  extensions: []
102
130
  extra_rdoc_files: []
103
131
  files:
104
- - .gitignore
105
- - .travis.yml
132
+ - ".gitignore"
133
+ - ".travis.yml"
106
134
  - Gemfile
107
135
  - Guardfile
108
136
  - LICENSE.txt
@@ -177,24 +205,24 @@ homepage: https://github.com/keithrbennett/trick_bag
177
205
  licenses:
178
206
  - MIT
179
207
  metadata: {}
180
- post_install_message:
208
+ post_install_message:
181
209
  rdoc_options: []
182
210
  require_paths:
183
211
  - lib
184
212
  required_ruby_version: !ruby/object:Gem::Requirement
185
213
  requirements:
186
- - - '>='
214
+ - - ">="
187
215
  - !ruby/object:Gem::Version
188
216
  version: '0'
189
217
  required_rubygems_version: !ruby/object:Gem::Requirement
190
218
  requirements:
191
- - - '>='
219
+ - - ">="
192
220
  - !ruby/object:Gem::Version
193
221
  version: '0'
194
222
  requirements: []
195
- rubyforge_project:
196
- rubygems_version: 2.4.6
197
- signing_key:
223
+ rubyforge_project:
224
+ rubygems_version: 2.5.1
225
+ signing_key:
198
226
  specification_version: 4
199
227
  summary: Miscellaneous general useful tools.
200
228
  test_files: