legion-json 0.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +87 -132
- data/.gitignore +2 -1
- data/.rubocop.yml +6 -5
- data/Gemfile +0 -1
- data/Gemfile.lock +79 -0
- data/README.md +5 -34
- data/bitbucket-pipelines.yml +11 -18
- data/legion-json.gemspec +22 -16
- data/lib/legion/json.rb +7 -32
- data/lib/legion/json/version.rb +1 -1
- data/sonar-project.properties +11 -0
- metadata +70 -40
- data/.circleci/setup-rubygems.sh +0 -2
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/legion/json/jrjackson.rb +0 -14
- data/lib/legion/json/oj.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 65c011b8c2de1d49c810436d664a2355d6aca45214bbed8c223d312171e4f8e9
|
4
|
+
data.tar.gz: 4a68bb3e2c93ec8a9757868d4d4019545c3dfa8957cc3f438d9380432c25024d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 252c77011b8c72d142535043aa4906c227a94e95c8e2a5e23d5736fcaa68c226f1c720ba3ea82bb48be695eda1fbdab7cd00c9e62ec7c7bfa36348cc70c95c68
|
7
|
+
data.tar.gz: 3a80218fa21fb74a45623d934f618e6499b71d01b1641ad5d60496abf20f2d6e56038a3b30213eccb1b1d78bea4c5bb220a753577ebf5627402cc1270626940f
|
data/.circleci/config.yml
CHANGED
@@ -1,169 +1,124 @@
|
|
1
|
-
version: 2
|
1
|
+
version: 2.1
|
2
2
|
orbs:
|
3
|
-
|
3
|
+
ruby: circleci/ruby@1.1.2
|
4
|
+
sonarcloud: sonarsource/sonarcloud@1.0.2
|
5
|
+
|
4
6
|
jobs:
|
5
7
|
"rubocop":
|
6
8
|
docker:
|
7
|
-
- image:
|
8
|
-
steps:
|
9
|
-
- checkout
|
10
|
-
- run: gem install rubocop rubocop-performance
|
11
|
-
- run:
|
12
|
-
name: Run Rubocop
|
13
|
-
command: rubocop
|
14
|
-
- store_test_results:
|
15
|
-
path: test_results
|
16
|
-
"ruby-2.0":
|
17
|
-
docker:
|
18
|
-
- image: circleci/ruby:2.0
|
19
|
-
steps:
|
20
|
-
- checkout
|
21
|
-
- run:
|
22
|
-
name: Bundle Install
|
23
|
-
command: bundle install
|
24
|
-
- run:
|
25
|
-
name: Run RSpec
|
26
|
-
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
27
|
-
when: always
|
28
|
-
- store_test_results:
|
29
|
-
path: test-results
|
30
|
-
"ruby-2.1":
|
31
|
-
docker:
|
32
|
-
- image: circleci/ruby:2.1
|
9
|
+
- image: cimg/ruby:2.7
|
33
10
|
steps:
|
34
11
|
- checkout
|
35
|
-
-
|
36
|
-
|
37
|
-
|
38
|
-
- run:
|
39
|
-
name: Run RSpec
|
40
|
-
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
41
|
-
when: always
|
12
|
+
- restore_cache:
|
13
|
+
key: "bundler cache mri"
|
14
|
+
- run: bundle update
|
15
|
+
- run: bundle exec rubocop --format=json --out=rubocop-result.json
|
42
16
|
- store_test_results:
|
43
|
-
path:
|
44
|
-
|
17
|
+
path: rubocop-result.json
|
18
|
+
- sonarcloud/scan
|
19
|
+
- run: bundle exec rubocop
|
20
|
+
- save_cache:
|
21
|
+
key: "bundler cache mri"
|
22
|
+
paths:
|
23
|
+
- "/usr/local/bundle"
|
24
|
+
"ruby-two-five":
|
45
25
|
docker:
|
46
|
-
- image:
|
26
|
+
- image: cimg/ruby:2.5
|
47
27
|
steps:
|
48
28
|
- checkout
|
49
|
-
-
|
50
|
-
|
51
|
-
|
52
|
-
-
|
53
|
-
|
54
|
-
|
55
|
-
|
29
|
+
- restore_cache:
|
30
|
+
key: "bundler cache mri"
|
31
|
+
- run: bundle update
|
32
|
+
- save_cache:
|
33
|
+
key: "bundler cache mri"
|
34
|
+
paths:
|
35
|
+
- "/usr/local/bundle"
|
36
|
+
- run: bundle exec rspec --format progress --format RspecJunitFormatter -o rspec-results.xml
|
56
37
|
- store_test_results:
|
57
|
-
path:
|
58
|
-
|
59
|
-
"ruby-
|
38
|
+
path: rspec-results.xml
|
39
|
+
- sonarcloud/scan
|
40
|
+
"ruby-two-six":
|
60
41
|
docker:
|
61
|
-
- image:
|
42
|
+
- image: cimg/ruby:2.6
|
62
43
|
steps:
|
63
44
|
- checkout
|
64
|
-
-
|
65
|
-
|
66
|
-
|
67
|
-
-
|
68
|
-
|
69
|
-
|
70
|
-
|
45
|
+
- restore_cache:
|
46
|
+
key: "bundler cache mri"
|
47
|
+
- run: bundle update
|
48
|
+
- save_cache:
|
49
|
+
key: "bundler cache mri"
|
50
|
+
paths:
|
51
|
+
- "/usr/local/bundle"
|
52
|
+
- run: bundle exec rspec --format progress --format RspecJunitFormatter -o rspec-results.xml
|
71
53
|
- store_test_results:
|
72
|
-
path:
|
73
|
-
|
74
|
-
"ruby-
|
54
|
+
path: rspec-results.xml
|
55
|
+
- sonarcloud/scan
|
56
|
+
"ruby-two-seven":
|
75
57
|
docker:
|
76
|
-
- image: circleci/ruby:2.
|
58
|
+
- image: circleci/ruby:2.7
|
77
59
|
steps:
|
78
60
|
- checkout
|
79
|
-
-
|
80
|
-
|
81
|
-
|
82
|
-
-
|
83
|
-
|
84
|
-
|
85
|
-
|
61
|
+
- restore_cache:
|
62
|
+
key: "bundler cache mri"
|
63
|
+
- run: bundle update
|
64
|
+
- save_cache:
|
65
|
+
key: "bundler cache mri"
|
66
|
+
paths:
|
67
|
+
- "/usr/local/bundle"
|
68
|
+
- run: bundle exec rspec --format progress --format RspecJunitFormatter -o rspec-results.xml
|
86
69
|
- store_test_results:
|
87
|
-
path:
|
88
|
-
|
70
|
+
path: rspec-results.xml
|
71
|
+
- sonarcloud/scan
|
72
|
+
"jruby92-11jdk":
|
89
73
|
docker:
|
90
|
-
- image: circleci/
|
74
|
+
- image: circleci/jruby:9.2-jre11
|
91
75
|
steps:
|
92
76
|
- checkout
|
93
|
-
-
|
94
|
-
|
95
|
-
|
96
|
-
-
|
97
|
-
|
98
|
-
|
99
|
-
|
77
|
+
- restore_cache:
|
78
|
+
key: "bundler cache jruby92-11jdk"
|
79
|
+
- run: bundle update
|
80
|
+
- save_cache:
|
81
|
+
key: "bundler cache jruby92-11jdk"
|
82
|
+
paths:
|
83
|
+
- "/usr/local/bundle"
|
84
|
+
- run: bundle exec rspec --format progress --format RspecJunitFormatter -o rspec-results.xml
|
100
85
|
- store_test_results:
|
101
|
-
path:
|
102
|
-
|
86
|
+
path: rspec-results.xml
|
87
|
+
- sonarcloud/scan
|
88
|
+
"jruby92-14jdk":
|
103
89
|
docker:
|
104
|
-
- image: circleci/
|
90
|
+
- image: circleci/jruby:9.2-jdk14
|
105
91
|
steps:
|
106
92
|
- checkout
|
107
|
-
-
|
108
|
-
|
109
|
-
|
110
|
-
-
|
111
|
-
|
112
|
-
|
113
|
-
|
93
|
+
- restore_cache:
|
94
|
+
key: "bundler cache jruby92-14jdk"
|
95
|
+
- run: bundle update
|
96
|
+
- save_cache:
|
97
|
+
key: "bundler cache jruby92-14jdk"
|
98
|
+
paths:
|
99
|
+
- "/usr/local/bundle"
|
100
|
+
- run: bundle exec rspec --format progress --format RspecJunitFormatter -o rspec-results.xml
|
114
101
|
- store_test_results:
|
115
|
-
path:
|
116
|
-
|
117
|
-
docker:
|
118
|
-
- image: circleci/jruby:9.2
|
119
|
-
steps:
|
120
|
-
- checkout
|
121
|
-
- run:
|
122
|
-
name: Bundle Install
|
123
|
-
command: bundle install
|
124
|
-
- run:
|
125
|
-
name: Run RSpec
|
126
|
-
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
127
|
-
when: always
|
128
|
-
- store_test_results:
|
129
|
-
path: test-results
|
102
|
+
path: rspec-results.xml
|
103
|
+
- sonarcloud/scan
|
130
104
|
|
131
105
|
workflows:
|
132
106
|
version: 2
|
133
|
-
|
107
|
+
rubocop-rspec:
|
134
108
|
jobs:
|
135
109
|
- rubocop
|
136
|
-
- ruby-
|
137
|
-
requires:
|
138
|
-
- ruby-2.4
|
139
|
-
filters:
|
140
|
-
branches:
|
141
|
-
only: /\bdevelop\b|\bmaster\b/
|
142
|
-
- ruby-2.3:
|
143
|
-
requires:
|
144
|
-
- ruby-2.4
|
145
|
-
filters:
|
146
|
-
branches:
|
147
|
-
only: /\bdevelop\b|\bmaster\b/
|
148
|
-
- ruby-2.4:
|
110
|
+
- ruby-two-five:
|
149
111
|
requires:
|
150
112
|
- rubocop
|
151
|
-
- ruby-
|
113
|
+
- ruby-two-six:
|
114
|
+
requires:
|
115
|
+
- ruby-two-five
|
116
|
+
- ruby-two-seven:
|
152
117
|
requires:
|
153
|
-
- ruby-
|
154
|
-
|
155
|
-
branches:
|
156
|
-
only: /\bdevelop\b|\bmaster\b/
|
157
|
-
- ruby-2.6:
|
118
|
+
- ruby-two-five
|
119
|
+
- jruby92-11jdk:
|
158
120
|
requires:
|
159
|
-
- ruby-
|
160
|
-
|
161
|
-
branches:
|
162
|
-
only: /\bdevelop\b|\bmaster\b/
|
163
|
-
- jruby-9.2:
|
121
|
+
- ruby-two-five
|
122
|
+
- jruby92-14jdk:
|
164
123
|
requires:
|
165
|
-
- ruby-
|
166
|
-
- ruby-2.3
|
167
|
-
- ruby-2.4
|
168
|
-
- ruby-2.5
|
169
|
-
- ruby-2.6
|
124
|
+
- ruby-two-five
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require: rubocop-performance
|
2
|
-
|
2
|
+
Layout/LineLength:
|
3
3
|
Max: 120
|
4
4
|
Metrics/MethodLength:
|
5
5
|
Max: 30
|
@@ -9,17 +9,18 @@ Metrics/BlockLength:
|
|
9
9
|
Max: 50
|
10
10
|
Layout/SpaceAroundEqualsInParameterDefault:
|
11
11
|
EnforcedStyle: space
|
12
|
+
Style/OptionalBooleanParameter:
|
13
|
+
Enabled: false
|
12
14
|
Style/SymbolArray:
|
13
15
|
Enabled: true
|
14
|
-
Layout/
|
16
|
+
Layout/HashAlignment:
|
15
17
|
EnforcedHashRocketStyle: table
|
16
18
|
EnforcedColonStyle: table
|
17
|
-
Style/HashSyntax:
|
18
|
-
EnforcedStyle: ruby19_no_mixed_keys
|
19
19
|
Style/Documentation:
|
20
20
|
Enabled: false
|
21
21
|
AllCops:
|
22
|
-
TargetRubyVersion: 2.
|
22
|
+
TargetRubyVersion: 2.5
|
23
|
+
NewCops: enable
|
23
24
|
Style/FrozenStringLiteralComment:
|
24
25
|
Enabled: false
|
25
26
|
Naming/FileName:
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
legion-json (1.1.3)
|
5
|
+
json_pure
|
6
|
+
multi_json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.1)
|
12
|
+
diff-lcs (1.4.4)
|
13
|
+
docile (1.3.2)
|
14
|
+
json (2.3.1)
|
15
|
+
json_pure (2.3.1)
|
16
|
+
multi_json (1.15.0)
|
17
|
+
oj (3.10.15)
|
18
|
+
parallel (1.19.2)
|
19
|
+
parser (2.7.2.0)
|
20
|
+
ast (~> 2.4.1)
|
21
|
+
rainbow (3.0.0)
|
22
|
+
rake (13.0.1)
|
23
|
+
regexp_parser (1.8.2)
|
24
|
+
rexml (3.2.4)
|
25
|
+
rspec (3.10.0)
|
26
|
+
rspec-core (~> 3.10.0)
|
27
|
+
rspec-expectations (~> 3.10.0)
|
28
|
+
rspec-mocks (~> 3.10.0)
|
29
|
+
rspec-core (3.10.0)
|
30
|
+
rspec-support (~> 3.10.0)
|
31
|
+
rspec-expectations (3.10.0)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.10.0)
|
34
|
+
rspec-mocks (3.10.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.10.0)
|
37
|
+
rspec-support (3.10.0)
|
38
|
+
rspec_junit_formatter (0.4.1)
|
39
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
40
|
+
rubocop (1.2.0)
|
41
|
+
parallel (~> 1.10)
|
42
|
+
parser (>= 2.7.1.5)
|
43
|
+
rainbow (>= 2.2.2, < 4.0)
|
44
|
+
regexp_parser (>= 1.8)
|
45
|
+
rexml
|
46
|
+
rubocop-ast (>= 1.0.1)
|
47
|
+
ruby-progressbar (~> 1.7)
|
48
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
49
|
+
rubocop-ast (1.1.1)
|
50
|
+
parser (>= 2.7.1.5)
|
51
|
+
rubocop-performance (1.8.1)
|
52
|
+
rubocop (>= 0.87.0)
|
53
|
+
rubocop-ast (>= 0.4.0)
|
54
|
+
ruby-progressbar (1.10.1)
|
55
|
+
simplecov (0.17.1)
|
56
|
+
docile (~> 1.1)
|
57
|
+
json (>= 1.8, < 3)
|
58
|
+
simplecov-html (~> 0.10.0)
|
59
|
+
simplecov-html (0.10.2)
|
60
|
+
simplecov_json_formatter (0.1.2)
|
61
|
+
unicode-display_width (1.7.0)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
bundler (>= 2)
|
68
|
+
legion-json!
|
69
|
+
oj
|
70
|
+
rake
|
71
|
+
rspec
|
72
|
+
rspec_junit_formatter
|
73
|
+
rubocop
|
74
|
+
rubocop-performance
|
75
|
+
simplecov (< 0.18.0)
|
76
|
+
simplecov_json_formatter
|
77
|
+
|
78
|
+
BUNDLED WITH
|
79
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,42 +1,13 @@
|
|
1
1
|
# Legion::Json
|
2
2
|
|
3
|
-
Legion::Json is part of the Legion Framework
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Add this line to your application's Gemfile:
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
gem 'legion-json'
|
12
|
-
```
|
13
|
-
|
14
|
-
And then execute:
|
15
|
-
|
16
|
-
$ bundle
|
17
|
-
|
18
|
-
Or install it yourself as:
|
19
|
-
|
20
|
-
$ gem install legion-json
|
3
|
+
Legion::Json is part of the Legion Framework
|
4
|
+
[Issue Tracker - Jira](https://legionio.atlassian.net/projects/JSON/issues)
|
5
|
+
[Docs - Confluence](https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324)
|
6
|
+
[RubyGems](https://rubygems.org/gems/legion-json)
|
21
7
|
|
22
8
|
## Usage
|
23
|
-
|
24
9
|
This library provides the Legion JSON parser abstraction, enabling the use of platform specific JSON parsers.
|
25
|
-
|
26
|
-
## Development
|
27
|
-
|
28
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
|
-
|
30
|
-
To install this gem onto your local machine, run `bundle exec install`.
|
31
|
-
|
32
|
-
## Contributing
|
33
|
-
|
34
|
-
Bug reports and pull requests are welcome on GitHub at https://bitbucket.org/legion-io/legion-json/issues This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
10
|
+
Based on the old sensu-json gem
|
35
11
|
|
36
12
|
## License
|
37
|
-
|
38
13
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
39
|
-
|
40
|
-
## Credit
|
41
|
-
|
42
|
-
This gem was based on the Sensu JSON gem. You can find the original gem [here](https://github.com/sensu/sensu-json)
|
data/bitbucket-pipelines.yml
CHANGED
@@ -1,25 +1,18 @@
|
|
1
|
-
image: ruby:2.
|
1
|
+
image: ruby:2.7
|
2
2
|
|
3
3
|
pipelines:
|
4
4
|
tags:
|
5
|
-
|
5
|
+
"v*":
|
6
6
|
- step:
|
7
|
-
name:
|
8
|
-
deployment:
|
7
|
+
name: Push to RubyGems
|
8
|
+
deployment: RubyGems
|
9
9
|
script:
|
10
|
-
-
|
11
|
-
-
|
12
|
-
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
caches:
|
17
|
-
- bundler
|
18
|
-
script:
|
19
|
-
- gem install bundle rubocop
|
20
|
-
- bundle install
|
21
|
-
- rubocop
|
22
|
-
- rake
|
10
|
+
- gem install bundler gem-release rspec
|
11
|
+
- bundle install
|
12
|
+
- (umask 077 ; echo $gem_creds | base64 --decode > ~/.gem/credentials)
|
13
|
+
- gem release
|
14
|
+
artifacts:
|
15
|
+
- pkg/**
|
23
16
|
definitions:
|
24
17
|
caches:
|
25
|
-
bundler:
|
18
|
+
bundler: /usr/local/bundle
|
data/legion-json.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
require 'legion/json/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = 'legion-json'
|
7
7
|
spec.version = Legion::Json::VERSION
|
8
8
|
spec.authors = ['Esity']
|
9
9
|
spec.email = ['matthewdiverson@gmail.com']
|
@@ -12,26 +12,32 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = 'A gem used to load and use JSON objects inside the Legion framework'
|
13
13
|
spec.homepage = 'https://bitbucket.org/legion-io/legion-json'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.required_ruby_version = '
|
15
|
+
spec.required_ruby_version = '>= 2.5'
|
16
|
+
spec.metadata = {
|
17
|
+
'bug_tracker_uri' => 'https://legionio.atlassian.net/projects/JSON/issues',
|
18
|
+
'changelog_uri' => 'https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON',
|
19
|
+
'documentation_uri' => 'https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON',
|
20
|
+
'homepage_uri' => 'https://legionio.atlassian.net/wiki/spaces/LEGION',
|
21
|
+
'source_code_uri' => 'https://bitbucket.org/legion-io/legion-json',
|
22
|
+
'wiki_uri' => 'https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON'
|
23
|
+
}
|
16
24
|
|
17
25
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
26
|
f.match(%r{^(test|spec|features)/})
|
19
27
|
end
|
20
|
-
spec.bindir = 'exe'
|
21
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
28
|
spec.require_paths = ['lib']
|
23
29
|
|
24
|
-
spec.add_development_dependency 'bundler'
|
25
|
-
spec.add_development_dependency '
|
26
|
-
spec.add_development_dependency '
|
27
|
-
spec.add_development_dependency '
|
28
|
-
spec.add_development_dependency '
|
29
|
-
spec.add_development_dependency '
|
30
|
+
spec.add_development_dependency 'bundler', '>= 2'
|
31
|
+
spec.add_development_dependency 'jrjackson' if RUBY_ENGINE == 'jruby'
|
32
|
+
spec.add_development_dependency 'oj' unless RUBY_ENGINE == 'jruby'
|
33
|
+
spec.add_development_dependency 'rake'
|
34
|
+
spec.add_development_dependency 'rspec'
|
35
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
36
|
+
spec.add_development_dependency 'rubocop'
|
30
37
|
spec.add_development_dependency 'rubocop-performance'
|
31
|
-
spec.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
38
|
+
spec.add_development_dependency 'simplecov', '< 0.18.0'
|
39
|
+
spec.add_development_dependency 'simplecov_json_formatter'
|
40
|
+
|
41
|
+
spec.add_dependency 'json_pure'
|
42
|
+
spec.add_dependency 'multi_json'
|
37
43
|
end
|
data/lib/legion/json.rb
CHANGED
@@ -1,48 +1,23 @@
|
|
1
1
|
require 'legion/json/version'
|
2
2
|
require 'legion/json/parse_error'
|
3
|
+
require 'multi_json'
|
3
4
|
|
4
5
|
module Legion
|
5
|
-
# Used to create JSON objects
|
6
6
|
module JSON
|
7
7
|
class << self
|
8
|
-
|
9
|
-
|
10
|
-
# the bottom of this file. The appropriate JSON parser will be
|
11
|
-
# loaded for the current platform.
|
12
|
-
#
|
13
|
-
# @return [Object] parser.
|
14
|
-
def setup!
|
15
|
-
if RUBY_ENGINE == 'jruby'
|
16
|
-
require 'jrjackson'
|
17
|
-
require 'legion/json/jrjackson'
|
18
|
-
@parser = Legion::JSON::JrJackson.new
|
19
|
-
else
|
20
|
-
require 'oj'
|
21
|
-
Oj.default_options = { mode: :compat }
|
22
|
-
require 'legion/json/oj'
|
23
|
-
@parser = Legion::JSON::Oj.new
|
24
|
-
end
|
8
|
+
def parser
|
9
|
+
@parser ||= MultiJson
|
25
10
|
end
|
26
11
|
|
27
|
-
|
28
|
-
|
29
|
-
# @param string [String]
|
30
|
-
# @return [Object]
|
31
|
-
def load(string)
|
32
|
-
@parser.load(string)
|
12
|
+
def load(string, symbolize_keys = true)
|
13
|
+
parser.load(string, symbolize_keys: symbolize_keys)
|
33
14
|
rescue StandardError => e
|
34
15
|
raise Legion::JSON::ParseError.build(e, string)
|
35
16
|
end
|
36
17
|
|
37
|
-
|
38
|
-
|
39
|
-
# @param object [Object]
|
40
|
-
# @param options [Hash]
|
41
|
-
def dump(object, options = {})
|
42
|
-
@parser.dump(object, options)
|
18
|
+
def dump(object, pretty = false)
|
19
|
+
parser.dump(object, pretty: pretty)
|
43
20
|
end
|
44
21
|
end
|
45
22
|
end
|
46
23
|
end
|
47
|
-
|
48
|
-
Legion::JSON.setup!
|
data/lib/legion/json/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
sonar.projectKey=legion-io_legion-json
|
2
|
+
sonar.organization=legion-io
|
3
|
+
sonar.sources=.
|
4
|
+
sonar.exclusions=vendor/**
|
5
|
+
sonar.coverage.exclusions=spec/**
|
6
|
+
sonar.ruby.coverage.reportPath=coverage/.resultset.json
|
7
|
+
sonar.ruby.file.suffixes=rb,ruby
|
8
|
+
sonar.ruby.coverage.framework=RSpec
|
9
|
+
sonar.ruby.rubocopConfig=.rubocop.yml
|
10
|
+
sonar.ruby.rubocop.reportPath=rubocop-result.json
|
11
|
+
sonar.ruby.rubocop.filePath=.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: legion-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esity
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,82 +16,82 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: oj
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
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: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec_junit_formatter
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
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: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
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: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
@@ -109,33 +109,61 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "<"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.18.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "<"
|
116
123
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
124
|
+
version: 0.18.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov_json_formatter
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: json_pure
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
118
146
|
type: :runtime
|
119
147
|
prerelease: false
|
120
148
|
version_requirements: !ruby/object:Gem::Requirement
|
121
149
|
requirements:
|
122
|
-
- - "
|
150
|
+
- - ">="
|
123
151
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
152
|
+
version: '0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
154
|
+
name: multi_json
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
128
156
|
requirements:
|
129
|
-
- - "
|
157
|
+
- - ">="
|
130
158
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
159
|
+
version: '0'
|
132
160
|
type: :runtime
|
133
161
|
prerelease: false
|
134
162
|
version_requirements: !ruby/object:Gem::Requirement
|
135
163
|
requirements:
|
136
|
-
- - "
|
164
|
+
- - ">="
|
137
165
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
166
|
+
version: '0'
|
139
167
|
description: A gem used to load and use JSON objects inside the Legion framework
|
140
168
|
email:
|
141
169
|
- matthewdiverson@gmail.com
|
@@ -144,44 +172,46 @@ extensions: []
|
|
144
172
|
extra_rdoc_files: []
|
145
173
|
files:
|
146
174
|
- ".circleci/config.yml"
|
147
|
-
- ".circleci/setup-rubygems.sh"
|
148
175
|
- ".gitignore"
|
149
176
|
- ".rubocop.yml"
|
150
177
|
- Gemfile
|
178
|
+
- Gemfile.lock
|
151
179
|
- LICENSE.txt
|
152
180
|
- README.md
|
153
181
|
- Rakefile
|
154
|
-
- bin/console
|
155
|
-
- bin/setup
|
156
182
|
- bitbucket-pipelines.yml
|
157
183
|
- codecov.yml
|
158
184
|
- legion-json.gemspec
|
159
185
|
- lib/legion/json.rb
|
160
|
-
- lib/legion/json/jrjackson.rb
|
161
|
-
- lib/legion/json/oj.rb
|
162
186
|
- lib/legion/json/parse_error.rb
|
163
187
|
- lib/legion/json/version.rb
|
188
|
+
- sonar-project.properties
|
164
189
|
homepage: https://bitbucket.org/legion-io/legion-json
|
165
190
|
licenses:
|
166
191
|
- MIT
|
167
|
-
metadata:
|
192
|
+
metadata:
|
193
|
+
bug_tracker_uri: https://legionio.atlassian.net/projects/JSON/issues
|
194
|
+
changelog_uri: https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON
|
195
|
+
documentation_uri: https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON
|
196
|
+
homepage_uri: https://legionio.atlassian.net/wiki/spaces/LEGION
|
197
|
+
source_code_uri: https://bitbucket.org/legion-io/legion-json
|
198
|
+
wiki_uri: https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON
|
168
199
|
post_install_message:
|
169
200
|
rdoc_options: []
|
170
201
|
require_paths:
|
171
202
|
- lib
|
172
203
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
204
|
requirements:
|
174
|
-
- - "
|
205
|
+
- - ">="
|
175
206
|
- !ruby/object:Gem::Version
|
176
|
-
version: '2.
|
207
|
+
version: '2.5'
|
177
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
209
|
requirements:
|
179
210
|
- - ">="
|
180
211
|
- !ruby/object:Gem::Version
|
181
212
|
version: '0'
|
182
213
|
requirements: []
|
183
|
-
|
184
|
-
rubygems_version: 2.6.11
|
214
|
+
rubygems_version: 3.1.4
|
185
215
|
signing_key:
|
186
216
|
specification_version: 4
|
187
217
|
summary: Legion JSON
|
data/.circleci/setup-rubygems.sh
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'legion/json'
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require 'irb'
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
module Legion
|
2
|
-
module JSON
|
3
|
-
# The Legion JSON parser when running on JRuby.
|
4
|
-
class JrJackson
|
5
|
-
def load(string)
|
6
|
-
::JrJackson::Json.load(string, symbolize_keys: true, raw: true)
|
7
|
-
end
|
8
|
-
|
9
|
-
def dump(object, options = {})
|
10
|
-
::JrJackson::Json.dump(object, options)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/lib/legion/json/oj.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module Legion
|
2
|
-
module JSON
|
3
|
-
# The Legion JSON parser when running on MRI.
|
4
|
-
class Oj
|
5
|
-
def load(string)
|
6
|
-
::Oj.load(string, symbol_keys: true)
|
7
|
-
end
|
8
|
-
|
9
|
-
def dump(object, options = {})
|
10
|
-
options[:indent] = 2 if options[:pretty]
|
11
|
-
::Oj.dump(object, options)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|