right_support 2.8.24 → 2.8.25
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 +7 -0
- data/Gemfile +13 -3
- data/Gemfile.lock +25 -4
- data/Rakefile +3 -0
- data/VERSION +1 -1
- data/features/serialization.feature +5 -0
- data/features/step_definitions/serialization_steps.rb +20 -1
- data/lib/right_support/data/serializer.rb +17 -4
- data/right_support.gemspec +10 -34
- data/spec/stats/exceptions_spec.rb +1 -1
- data/spec/stats/helpers_spec.rb +2 -0
- metadata +22 -112
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d4d1fe10f00edff41986d12d3974498f8dc14ace
|
4
|
+
data.tar.gz: 7358538374cc52741957dd32c5cd86e28322d72a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d23cdbb1ed41af6ea575de60bedc7de338317c90866fbe52496f80f0bff85fcc4cf32afec52a5bbcb00e0e43ec7c608f556aa7b4c7b827e42d3669514d187230
|
7
|
+
data.tar.gz: 3cbded75569f2a003032861dffb60414cb050274c85f6cd30fd278f245cd1525cda2b6ea10c8e5c72bb156c0916e0a8c3618cccb78117d02611d644f82b83036
|
data/Gemfile
CHANGED
@@ -15,10 +15,20 @@ group :optional do
|
|
15
15
|
gem 'iconv', :platforms => :ruby_18
|
16
16
|
end
|
17
17
|
|
18
|
-
# Gems used during test and development of RightSupport
|
19
|
-
|
18
|
+
# Gems used during test and development of RightSupport, but which should be omitted as development
|
19
|
+
# dependencies when generating the gemspec.
|
20
|
+
group :test do
|
20
21
|
gem 'jeweler', '~> 2.0'
|
21
22
|
gem 'flexmock', '~> 1.0'
|
22
23
|
gem 'rspec', '~> 2.13.0'
|
23
|
-
gem '
|
24
|
+
gem 'right_develop', '~> 2.1'
|
25
|
+
|
26
|
+
# Cuke >= 1.3.3 depends on RubyGems > 2.0 without specifying that in its gemspec
|
27
|
+
gem 'cucumber', ['~> 1.0', '< 1.3.3']
|
28
|
+
|
29
|
+
# Nokogiri is a transitive dependency (via jeweler and other gems) that stopped being
|
30
|
+
# incompatible with Ruby 1.8 as of version 1.6.0, but fails to declare this in its gemspec.
|
31
|
+
# Work around the bug by locking ourselves to 1.5.x, guaranteeing that we can install our bundle
|
32
|
+
# under Ruby 1.8.
|
33
|
+
gem 'nokogiri', '~> 1.5.0'
|
24
34
|
end
|
data/Gemfile.lock
CHANGED
@@ -9,6 +9,7 @@ GEM
|
|
9
9
|
gherkin (~> 2.12.0)
|
10
10
|
multi_json (~> 1.3)
|
11
11
|
diff-lcs (1.2.5)
|
12
|
+
extlib (0.9.16)
|
12
13
|
faraday (0.8.9)
|
13
14
|
multipart-post (~> 1.2.0)
|
14
15
|
flexmock (1.3.3)
|
@@ -23,7 +24,7 @@ GEM
|
|
23
24
|
nokogiri (~> 1.5.2)
|
24
25
|
oauth2
|
25
26
|
hashie (2.0.5)
|
26
|
-
highline (1.6.
|
27
|
+
highline (1.6.21)
|
27
28
|
iconv (1.0.4)
|
28
29
|
jeweler (2.0.1)
|
29
30
|
builder
|
@@ -40,11 +41,11 @@ GEM
|
|
40
41
|
macaddr (1.6.5)
|
41
42
|
systemu (~> 2.6.2)
|
42
43
|
mime-types (1.25.1)
|
43
|
-
multi_json (1.
|
44
|
+
multi_json (1.10.1)
|
44
45
|
multi_xml (0.5.5)
|
45
46
|
multipart-post (1.2.0)
|
46
47
|
net-ssh (2.8.0)
|
47
|
-
nokogiri (1.5.
|
48
|
+
nokogiri (1.5.11)
|
48
49
|
oauth2 (0.9.3)
|
49
50
|
faraday (>= 0.8, < 0.10)
|
50
51
|
jwt (~> 0.1.8)
|
@@ -52,11 +53,28 @@ GEM
|
|
52
53
|
multi_xml (~> 0.5)
|
53
54
|
rack (~> 1.2)
|
54
55
|
rack (1.5.2)
|
55
|
-
rake (
|
56
|
+
rake (0.9.6)
|
56
57
|
rdoc (4.1.1)
|
57
58
|
json (~> 1.4)
|
58
59
|
rest-client (1.6.7)
|
59
60
|
mime-types (>= 1.16)
|
61
|
+
right_aws (3.1.0)
|
62
|
+
right_http_connection (>= 1.2.5)
|
63
|
+
right_develop (2.3.0)
|
64
|
+
builder (~> 3.0)
|
65
|
+
cucumber (~> 1.0, < 1.3.3)
|
66
|
+
extlib
|
67
|
+
rack
|
68
|
+
rake (>= 0.8.7, < 0.10)
|
69
|
+
right_aws (>= 2.1.0)
|
70
|
+
right_git (~> 0.1.0)
|
71
|
+
right_support (~> 2.0)
|
72
|
+
rspec (>= 1.3, < 3.0)
|
73
|
+
trollop (>= 1.0, < 3.0)
|
74
|
+
right_git (0.1.0)
|
75
|
+
right_support (>= 2.8.10, < 3.0.0)
|
76
|
+
right_http_connection (1.4.0)
|
77
|
+
right_support (2.8.24)
|
60
78
|
rspec (2.13.0)
|
61
79
|
rspec-core (~> 2.13.0)
|
62
80
|
rspec-expectations (~> 2.13.0)
|
@@ -67,6 +85,7 @@ GEM
|
|
67
85
|
rspec-mocks (2.13.1)
|
68
86
|
simple_uuid (0.4.0)
|
69
87
|
systemu (2.6.3)
|
88
|
+
trollop (2.0)
|
70
89
|
uuid (2.3.7)
|
71
90
|
macaddr (~> 1.0)
|
72
91
|
uuidtools (2.1.4)
|
@@ -83,7 +102,9 @@ DEPENDENCIES
|
|
83
102
|
jeweler (~> 2.0)
|
84
103
|
mime-types (~> 1.0)
|
85
104
|
net-ssh (~> 2.0)
|
105
|
+
nokogiri (~> 1.5.0)
|
86
106
|
rest-client (~> 1.6)
|
107
|
+
right_develop (~> 2.1)
|
87
108
|
rspec (~> 2.13.0)
|
88
109
|
simple_uuid (~> 0.2)
|
89
110
|
uuid (~> 2.3)
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.8.
|
1
|
+
2.8.25
|
@@ -101,3 +101,8 @@ Feature: JSON serialization
|
|
101
101
|
When I serialize the Ruby value: GotState.new
|
102
102
|
And an eldritch force deletes a key from the serialized value
|
103
103
|
And the serialized value should fail to round-trip
|
104
|
+
|
105
|
+
Scenario: unrecognized Ruby object class
|
106
|
+
When I unserialize the JSON value: {"_ruby_class":"DoesNotExist","hello":"world"}
|
107
|
+
Then the unserialized object should be an OpenStruct
|
108
|
+
And the unserialized object should have a "hello" attribute with value: "world"
|
@@ -36,6 +36,11 @@ When /^I serialize the Ruby value: (.*)$/ do |expression|
|
|
36
36
|
@serialized_value = @serializer.dump(@ruby_value)
|
37
37
|
end
|
38
38
|
|
39
|
+
When /^I unserialize the JSON value: (.*)$/ do |value|
|
40
|
+
@serialized_value = value
|
41
|
+
@ruby_value = @serializer.load(@serialized_value)
|
42
|
+
end
|
43
|
+
|
39
44
|
When /^I serialize a complex random data structure$/ do
|
40
45
|
@ruby_value = random_value(nil, [String])
|
41
46
|
@serialized_value = @serializer.dump(@ruby_value)
|
@@ -91,6 +96,20 @@ Then /^the serialized value should be a JSON (.*)$/ do |json_type|
|
|
91
96
|
end
|
92
97
|
end
|
93
98
|
|
94
|
-
Then /^the serialized value should have a suitable _ruby_class
|
99
|
+
Then /^the serialized value should have a suitable _ruby_class$/ do
|
95
100
|
@serialized_value.should =~ /"_ruby_class":"#{Regexp.escape(@ruby_value.class.name)}"/
|
96
101
|
end
|
102
|
+
|
103
|
+
Then /^the unserialized object should be an? (.*)$/ do |class_name|
|
104
|
+
klass = class_name.to_const
|
105
|
+
klass.should_not be_nil
|
106
|
+
@ruby_value.should be_a(klass)
|
107
|
+
end
|
108
|
+
|
109
|
+
Then /^the unserialized object should have a "(.*)" attribute with value: (.*)$/ do |attr, value|
|
110
|
+
attr = attr.to_sym
|
111
|
+
value = eval(value)
|
112
|
+
|
113
|
+
@ruby_value.should respond_to(attr)
|
114
|
+
@ruby_value.__send__(attr).should == value
|
115
|
+
end
|
@@ -22,6 +22,7 @@
|
|
22
22
|
|
23
23
|
require 'time'
|
24
24
|
require 'date'
|
25
|
+
require 'ostruct'
|
25
26
|
|
26
27
|
module RightSupport::Data
|
27
28
|
# Utility class that implements true, lossless Ruby-to-JSON serialization.
|
@@ -252,14 +253,26 @@ module RightSupport::Data
|
|
252
253
|
# Object-escaped Ruby String
|
253
254
|
jsonish = String.new(hash.delete(STRING_ESCAPE_KEY))
|
254
255
|
when Time.name
|
255
|
-
# Object-escaped Ruby
|
256
|
+
# Object-escaped Ruby Time
|
256
257
|
jsonish = Time.at(hash.delete(TIME_ESCAPE_KEY))
|
257
258
|
else
|
258
259
|
# Generic serialized object
|
259
260
|
klass = klass.to_const
|
260
|
-
|
261
|
-
|
262
|
-
|
261
|
+
|
262
|
+
if klass
|
263
|
+
# Known types get unserialized in-place using a strategy that's identical
|
264
|
+
# to YAML: do not call #initialize, set instance variables in-place.
|
265
|
+
jsonish = klass.allocate
|
266
|
+
hash.each_pair do |k, v|
|
267
|
+
jsonish.instance_variable_set("@#{k}", jsonish_to_object(v))
|
268
|
+
end
|
269
|
+
else
|
270
|
+
|
271
|
+
# Unknown types turn into an OpenStruct.
|
272
|
+
jsonish = OpenStruct.new(hash.inject({}) do |result, (k, v)|
|
273
|
+
result[k] = jsonish_to_object(v)
|
274
|
+
result
|
275
|
+
end)
|
263
276
|
end
|
264
277
|
end
|
265
278
|
|
data/right_support.gemspec
CHANGED
@@ -2,16 +2,18 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: right_support 2.8.25 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "2.8.
|
8
|
+
s.name = "right_support"
|
9
|
+
s.version = "2.8.25"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Tony Spataro", "Sergey Sergyenko", "Ryan Williamson", "Lee Kirchhoff", "Alexey Karpik", "Scott Messier"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
14
|
+
s.date = "2014-08-01"
|
15
|
+
s.description = "A toolkit of useful, reusable foundation code created by RightScale."
|
16
|
+
s.email = "support@rightscale.com"
|
15
17
|
s.extra_rdoc_files = [
|
16
18
|
"LICENSE",
|
17
19
|
"README.rdoc"
|
@@ -136,35 +138,9 @@ Gem::Specification.new do |s|
|
|
136
138
|
"spec/validation/openssl_spec.rb",
|
137
139
|
"spec/validation/ssh_spec.rb"
|
138
140
|
]
|
139
|
-
s.homepage =
|
141
|
+
s.homepage = "https://github.com/rightscale/right_support"
|
140
142
|
s.licenses = ["MIT"]
|
141
|
-
s.
|
142
|
-
s.
|
143
|
-
s.summary = %q{Reusable foundation code.}
|
144
|
-
|
145
|
-
if s.respond_to? :specification_version then
|
146
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
147
|
-
s.specification_version = 3
|
148
|
-
|
149
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
150
|
-
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
151
|
-
s.add_development_dependency(%q<flexmock>, ["~> 1.0"])
|
152
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.13.0"])
|
153
|
-
s.add_development_dependency(%q<cucumber>, ["~> 1.0", "< 1.3.3"])
|
154
|
-
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
155
|
-
else
|
156
|
-
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
157
|
-
s.add_dependency(%q<flexmock>, ["~> 1.0"])
|
158
|
-
s.add_dependency(%q<rspec>, ["~> 2.13.0"])
|
159
|
-
s.add_dependency(%q<cucumber>, ["~> 1.0", "< 1.3.3"])
|
160
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
161
|
-
end
|
162
|
-
else
|
163
|
-
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
164
|
-
s.add_dependency(%q<flexmock>, ["~> 1.0"])
|
165
|
-
s.add_dependency(%q<rspec>, ["~> 2.13.0"])
|
166
|
-
s.add_dependency(%q<cucumber>, ["~> 1.0", "< 1.3.3"])
|
167
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
168
|
-
end
|
143
|
+
s.rubygems_version = "2.2.0"
|
144
|
+
s.summary = "Reusable foundation code."
|
169
145
|
end
|
170
146
|
|
@@ -64,7 +64,7 @@ describe RightSupport::Stats::Exceptions do
|
|
64
64
|
@exception = e
|
65
65
|
end
|
66
66
|
@stats.track("testing", @exception)
|
67
|
-
@stats.stats["testing"]["recent"][0]["where"].should =~ /
|
67
|
+
@stats.stats["testing"]["recent"][0]["where"].should =~ /spec\/stats\/exceptions_spec.rb/
|
68
68
|
end
|
69
69
|
|
70
70
|
it "recognizes and counts repeated exceptions" do
|
data/spec/stats/helpers_spec.rb
CHANGED
@@ -37,6 +37,8 @@ describe RightSupport::Stats do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
before(:each) do
|
40
|
+
pending("unreliable on Ruby 1.8 due to Hash-key ordering") if RUBY_VERSION =~ /1.8/
|
41
|
+
|
40
42
|
@hr = sprintf("%02d", 13 + (Time.now.utc_offset / 3600) + (Time.now.dst? ? -1 : 0))
|
41
43
|
@now = 1000000
|
42
44
|
flexmock(Time).should_receive(:now).and_return(@now).by_default
|
metadata
CHANGED
@@ -1,15 +1,9 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_support
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 8
|
9
|
-
- 24
|
10
|
-
version: 2.8.24
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.8.25
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Tony Spataro
|
14
8
|
- Sergey Sergyenko
|
15
9
|
- Ryan Williamson
|
@@ -19,90 +13,17 @@ authors:
|
|
19
13
|
autorequire:
|
20
14
|
bindir: bin
|
21
15
|
cert_chain: []
|
22
|
-
|
23
|
-
|
24
|
-
default_executable:
|
25
|
-
dependencies:
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ~>
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
hash: 3
|
33
|
-
segments:
|
34
|
-
- 2
|
35
|
-
- 0
|
36
|
-
version: "2.0"
|
37
|
-
name: jeweler
|
38
|
-
requirement: *id001
|
39
|
-
prerelease: false
|
40
|
-
type: :development
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
|
-
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
hash: 15
|
48
|
-
segments:
|
49
|
-
- 1
|
50
|
-
- 0
|
51
|
-
version: "1.0"
|
52
|
-
name: flexmock
|
53
|
-
requirement: *id002
|
54
|
-
prerelease: false
|
55
|
-
type: :development
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
hash: 59
|
63
|
-
segments:
|
64
|
-
- 2
|
65
|
-
- 13
|
66
|
-
- 0
|
67
|
-
version: 2.13.0
|
68
|
-
name: rspec
|
69
|
-
requirement: *id003
|
70
|
-
prerelease: false
|
71
|
-
type: :development
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
hash: 15
|
79
|
-
segments:
|
80
|
-
- 1
|
81
|
-
- 0
|
82
|
-
version: "1.0"
|
83
|
-
- - <
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
hash: 29
|
86
|
-
segments:
|
87
|
-
- 1
|
88
|
-
- 3
|
89
|
-
- 3
|
90
|
-
version: 1.3.3
|
91
|
-
name: cucumber
|
92
|
-
requirement: *id004
|
93
|
-
prerelease: false
|
94
|
-
type: :development
|
16
|
+
date: 2014-08-01 00:00:00.000000000 Z
|
17
|
+
dependencies: []
|
95
18
|
description: A toolkit of useful, reusable foundation code created by RightScale.
|
96
19
|
email: support@rightscale.com
|
97
20
|
executables: []
|
98
|
-
|
99
21
|
extensions: []
|
100
|
-
|
101
|
-
extra_rdoc_files:
|
22
|
+
extra_rdoc_files:
|
102
23
|
- LICENSE
|
103
24
|
- README.rdoc
|
104
|
-
files:
|
105
|
-
- .rspec
|
25
|
+
files:
|
26
|
+
- ".rspec"
|
106
27
|
- CHANGELOG.rdoc
|
107
28
|
- Gemfile
|
108
29
|
- Gemfile.lock
|
@@ -220,39 +141,28 @@ files:
|
|
220
141
|
- spec/stats/helpers_spec.rb
|
221
142
|
- spec/validation/openssl_spec.rb
|
222
143
|
- spec/validation/ssh_spec.rb
|
223
|
-
has_rdoc: true
|
224
144
|
homepage: https://github.com/rightscale/right_support
|
225
|
-
licenses:
|
145
|
+
licenses:
|
226
146
|
- MIT
|
147
|
+
metadata: {}
|
227
148
|
post_install_message:
|
228
149
|
rdoc_options: []
|
229
|
-
|
230
|
-
require_paths:
|
150
|
+
require_paths:
|
231
151
|
- lib
|
232
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
233
|
-
|
234
|
-
requirements:
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
235
154
|
- - ">="
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
version: "0"
|
241
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
|
-
none: false
|
243
|
-
requirements:
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
244
159
|
- - ">="
|
245
|
-
- !ruby/object:Gem::Version
|
246
|
-
|
247
|
-
segments:
|
248
|
-
- 0
|
249
|
-
version: "0"
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
250
162
|
requirements: []
|
251
|
-
|
252
163
|
rubyforge_project:
|
253
|
-
rubygems_version:
|
164
|
+
rubygems_version: 2.2.0
|
254
165
|
signing_key:
|
255
|
-
specification_version:
|
166
|
+
specification_version: 4
|
256
167
|
summary: Reusable foundation code.
|
257
168
|
test_files: []
|
258
|
-
|