nestedtext 2.0.1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +55 -25
- data/lib/nestedtext/core_ext.rb +14 -5
- data/lib/nestedtext/decode.rb +20 -1
- data/lib/nestedtext/dumper.rb +0 -1
- data/lib/nestedtext/encode.rb +23 -7
- data/lib/nestedtext/encode_helpers.rb +6 -8
- data/lib/nestedtext/error.rb +8 -0
- data/lib/nestedtext/{errors.rb → errors_internal.rb} +1 -5
- data/lib/nestedtext/parser.rb +1 -2
- data/lib/nestedtext/scanners.rb +1 -1
- data/lib/nestedtext/version.rb +2 -1
- data/lib/nestedtext.rb +9 -2
- data/nestedtext.gemspec +2 -2
- metadata +4 -9
- data/.editorconfig +0 -24
- data/.gitignore +0 -24
- data/.rubocop.yml +0 -143
- data/.ruby-version +0 -1
- data/Gemfile +0 -27
- data/OSSMETADATA +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e19886916af03f3d5ef28b374957b529721fc1302aefa86d37483052dfcc96e
|
4
|
+
data.tar.gz: 7b0b78e029f5138341ea101567d2668c97a9681bef2f2830282ad00341b80c29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83a89a05ec0fba9ad2a397b16454b93de78751dda15d369b2a0704fc0e87bd426741b872a58fa236ff7814953eb6faa1a0681ac755c5eed4244560925863bfa5
|
7
|
+
data.tar.gz: 45e701d977422c34fc3ef2923b4a54c2bcb617fe973a867c343b7e16df94607ae0f2b5b22e515824e2245cdb4289b11fc88a11bdf12cc420e7552517c89e681a
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [3.2.0] - 2022-01-27
|
10
|
+
### Changed
|
11
|
+
- Switch from rdoc formatting syntax to Markdown with Redcarpet to be able to render README.md properly.
|
12
|
+
|
13
|
+
## [3.1.0] - 2022-01-27
|
14
|
+
### Changed
|
15
|
+
- Switch from rdoc to YARD to match rubydoc.info that is used automatically for Gems uploaded to rubygems.org.
|
16
|
+
|
17
|
+
## [3.0.0] - 2022-01-27
|
18
|
+
### Added
|
19
|
+
- API documentation generated with rdoc.
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
- Removed leaked `NT_MIXIN` constant in core extensions.
|
23
|
+
|
24
|
+
### Changed
|
25
|
+
- **Breaking change**: `#to_nt` on `String`, `Array` and `Hash` is no longer strict by default for consistency an unexpected surprises e.g. when having an array of CustomObjects and calling the method on the array.
|
26
|
+
- Internal clean-up and simplifications on helper classes and methods.
|
27
|
+
|
28
|
+
## [2.1.0] - 2022-01-27
|
29
|
+
### Changed
|
30
|
+
- Slim down Gem by using include instead of block list.
|
31
|
+
|
9
32
|
## [2.0.1] - 2022-01-26
|
10
33
|
### Fixed
|
11
34
|
- README issue with logo showing up on Rdoc (out-commented HTML).
|
data/CONTRIBUTING.md
CHANGED
data/README.md
CHANGED
@@ -3,20 +3,20 @@
|
|
3
3
|
[![Gem Downloads](https://ruby-gem-downloads-badge.herokuapp.com/nestedtext?color=brightgreen&type=total&label=gem%20downloads)](https://rubygems.org/gems/nestedtext)
|
4
4
|
[![Documentation](https://img.shields.io/badge/docs-API-informational?logo=readthedocs&logoColor=violet)](https://www.rubydoc.info/gems/nestedtext/)
|
5
5
|
[![Data Format Version Supported](https://img.shields.io/badge/%F0%9F%84%BD%F0%9F%85%83%20Version%20Supported-3.2.1-blueviolet)](https://nestedtext.org/en/v3.2/)
|
6
|
-
[![Official Tests](https://img.shields.io/badge
|
6
|
+
[![Official Tests](https://img.shields.io/badge/Official%20Tests-Passing-success?logo=cachet)](https://github.com/KenKundert/nestedtext_tests/tree/585e95a73d94ac1f48e71a154e2db0ab67cf30fa)
|
7
7
|
[![GitHub Actions: Continuous Integration](https://github.com/erikw/nestedtext-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/erikw/nestedtext-ruby/actions/workflows/ci.yml)
|
8
8
|
[![GitHub Actions: Continuous Deployment](https://github.com/erikw/nestedtext-ruby/actions/workflows/cd.yml/badge.svg)](https://github.com/erikw/nestedtext-ruby/actions/workflows/cd.yml)
|
9
9
|
[![GitHub Actions: CodeQL Analysis](https://github.com/erikw/nestedtext-ruby/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/erikw/nestedtext-ruby/actions/workflows/codeql-analysis.yml)
|
10
10
|
[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/8409b6cdc3dc62a33f6f/maintainability)](https://codeclimate.com/github/erikw/nestedtext-ruby/maintainability)
|
11
11
|
[![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/8409b6cdc3dc62a33f6f/test_coverage)](https://codeclimate.com/github/erikw/nestedtext-ruby/test_coverage)
|
12
|
-
[![SLOC](https://img.shields.io/tokei/lines/github/erikw/nestedtext-ruby)](#)
|
12
|
+
[![SLOC](https://img.shields.io/tokei/lines/github/erikw/nestedtext-ruby?logo=codefactor&logoColor=lightgrey)](#)
|
13
13
|
[![License](https://img.shields.io/github/license/erikw/nestedtext-ruby?color=informational)](LICENSE.txt)
|
14
14
|
[![OSS Lifecycle](https://img.shields.io/osslifecycle/erikw/nestedtext-ruby)](https://github.com/Netflix/osstracker)
|
15
15
|
|
16
16
|
|
17
17
|
A ruby library for the human friendly data format [NestedText](https://nestedtext.org/).
|
18
18
|
|
19
|
-
<a href="#" ><img src="
|
19
|
+
<a href="#" ><img src="img/logo.webp" align="right" width="420px" alt="Project logo" /></a>
|
20
20
|
|
21
21
|
Provided is support for decoding a NestedText file or string to Ruby data structures, as well as encoding Ruby objects to a NestedText file or string. Furthermore there is support for serialization and deserialization of custom classes. The supported language version of the data format can be see in the badge above. This implementation pass all the [official tests](https://github.com/KenKundert/nestedtext_tests).
|
22
22
|
|
@@ -56,7 +56,7 @@ vice president:
|
|
56
56
|
See the [language introduction](https://nestedtext.org/en/latest/basic_syntax.html) for more details.
|
57
57
|
|
58
58
|
# Usage
|
59
|
-
The full documentation can be found at [
|
59
|
+
The full API documentation can be found at [**rubydocs.info**](https://www.rubydoc.info/gems/nestedtext/). A minimal & fully working example of a project using this library can be found at [erikw/nestedtext-ruby-test](https://github.com/erikw/nestedtext-ruby-test).
|
60
60
|
|
61
61
|
## Decoding (reading NT)
|
62
62
|
This is how you can decode NestedText from a string or directly from a file (`*.nt`) to Ruby object instances:
|
@@ -78,17 +78,6 @@ key1: value1
|
|
78
78
|
key2: value2
|
79
79
|
```
|
80
80
|
|
81
|
-
The NestedText types maps like this to Ruby:
|
82
|
-
|
83
|
-
[NestedText](https://nestedtext.org/en/latest/basic_syntax.html) | Ruby | Comment
|
84
|
-
---|---|---
|
85
|
-
`String` | `String` |
|
86
|
-
`List` | `Array` |
|
87
|
-
`Dictionary`| `Hash` |
|
88
|
-
`String` | `Symbol` | when `strict: false`, otherwise Ruby Symbols are encoded as Custom Class (see below).
|
89
|
-
*empty* | `nil` | How empty strings and nil are handled depends on where it is used. This library follows how the official implementation does it.
|
90
|
-
|
91
|
-
|
92
81
|
Thus you must know what you're parsing, or test what you decoded.
|
93
82
|
|
94
83
|
### Explicit Top Level Type
|
@@ -119,11 +108,10 @@ ntstr = NestedText::dump(data)
|
|
119
108
|
NestedText::dump_file(data, "path/to/data.nt")
|
120
109
|
```
|
121
110
|
|
122
|
-
|
123
111
|
### `#to_nt` Convenience
|
124
112
|
To make it more convenient, the Ruby Core is extended with a `#to_nt` method on the supported types that will dump a String of the data structure. Here's an IRB session showing how it works:
|
125
113
|
|
126
|
-
```
|
114
|
+
```ruby
|
127
115
|
irb> require 'nestedtext'
|
128
116
|
irb> puts "a\nstring".to_nt
|
129
117
|
> a
|
@@ -132,7 +120,10 @@ irb> puts ["i1", "i2", "i3"].to_nt
|
|
132
120
|
- i1
|
133
121
|
- i2
|
134
122
|
- i3
|
135
|
-
irb>
|
123
|
+
irb> hash = {"k1" => "v1",
|
124
|
+
"multiline\nkey" => "v2",
|
125
|
+
"k3" => ["a", "list"]}
|
126
|
+
irb> puts hash.to_nt
|
136
127
|
k1: v1
|
137
128
|
: multiline
|
138
129
|
: key
|
@@ -142,9 +133,46 @@ k3:
|
|
142
133
|
- list
|
143
134
|
```
|
144
135
|
|
136
|
+
## Types
|
137
|
+
Ruby classes maps like this to NestedText types:
|
138
|
+
Ruby | [NestedText](https://nestedtext.org/en/latest/basic_syntax.html)
|
139
|
+
---|---
|
140
|
+
`String` |`String`
|
141
|
+
`Array` |`List`
|
142
|
+
`Hash` |`Dictionary`
|
143
|
+
|
144
|
+
|
145
|
+
### Strict Mode
|
146
|
+
The strict mode determines how classes other than the basic types `String`, `Array` and `Hash` are handled during encoding and decoding. By **default** strict mode is turned **off**.
|
147
|
+
|
148
|
+
With `strict: true`
|
149
|
+
Ruby | NestedText | Comment
|
150
|
+
---|---|---
|
151
|
+
`nil` |*empty* | (1.)
|
152
|
+
`Symbol` |`String` | Raises `NestedText::Error`
|
153
|
+
Other Class | -- | Raises `NestedText::Error`
|
154
|
+
|
155
|
+
|
156
|
+
With `strict: false`
|
157
|
+
Ruby | NestedText | Comment
|
158
|
+
---|---|---
|
159
|
+
`nil` | *Custom Class Encoding* | (1.)
|
160
|
+
`Symbol` | `String` |
|
161
|
+
Custom Class | *Custom Class Encoding* | If the [Custom Class](#custom-classes-serialization) implements `#encode_nt_with` (2.)
|
162
|
+
Other Class | String | `#to_s` will be called if there is no `#encode_nt_with`
|
163
|
+
|
164
|
+
|
165
|
+
* (1.) How empty strings and nil are handled depends on where it is used. This library follows how the official implementation does it.
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
145
171
|
## Custom Classes Serialization
|
146
172
|
This library has support for serialization/deserialization of custom classes as well. This is done by letting the objects tell NestedText what data should be used to represent the object instance with the `#encode_nt_with` method (inspired by `YAML`'s `#encode_with` method). All objects being recursively referenced from a root object being serialized must either implement this method or be one of the core supported NestedText data types from the table above.
|
147
173
|
|
174
|
+
A class implementing `#encode_nt_with` is refered to as `Custom Class` in this document.
|
175
|
+
|
148
176
|
```ruby
|
149
177
|
class Apple
|
150
178
|
def initialize(type, weight)
|
@@ -191,7 +219,6 @@ data:
|
|
191
219
|
- granny smith
|
192
220
|
- 12
|
193
221
|
```
|
194
|
-
Note that the special key to denote the class name is subject to change in future versions and you **must not** rely on it.
|
195
222
|
|
196
223
|
If you want to add some more super powers to your custom class, you can add the `#to_nt` shortcut by including the `NTEncodeMixin`:
|
197
224
|
```ruby
|
@@ -204,13 +231,16 @@ Apple.new("granny smith", 12).to_nt
|
|
204
231
|
```
|
205
232
|
|
206
233
|
|
207
|
-
**
|
208
|
-
|
209
|
-
|
210
|
-
|
234
|
+
**Important notes**:
|
235
|
+
* The special key to denote the class name is subject to change in future versions and you **must not** rely on it.
|
236
|
+
* Custom Classes **can not be a key** in a Hash. Trying to do this will raise an Error.
|
237
|
+
* When deserializing a custom class, this custom class must be available when calling the `#dump*` methods e.g.
|
238
|
+
```ruby
|
239
|
+
require 'nestedtext'
|
240
|
+
require_relative 'apple' # This is needed if Apple is defined in apple.rb and not in this scope already.
|
211
241
|
|
212
|
-
NestedText::load_file('path/to/apple_dump.nt')
|
213
|
-
```
|
242
|
+
NestedText::load_file('path/to/apple_dump.nt')
|
243
|
+
```
|
214
244
|
|
215
245
|
See [encode_custom_classes_test.rb](test/nestedtext/encode_custom_classes_test.rb) for more real working examples.
|
216
246
|
|
data/lib/nestedtext/core_ext.rb
CHANGED
@@ -1,19 +1,28 @@
|
|
1
1
|
require "nestedtext/encode_helpers"
|
2
2
|
|
3
|
+
# Extension of Ruby core types with the NestedText::NTEncodeMixin.
|
4
|
+
#
|
3
5
|
# TODO: add encoding of more Ruby native classes like Integer, Float etc plus commons like Set,....? Not covered in NestedText language.
|
4
6
|
# Or leave this to a schema validator 3rd party plugin maybe? And replace my custom class decoding (and also encoding?)?
|
5
7
|
# Or both: add encoding/decoding of more native classes, and allow decoding + applying a schema with 3rd party.
|
6
8
|
# Or encourage using Marshal from core?
|
7
9
|
|
8
|
-
|
9
|
-
class String include
|
10
|
-
class Array include NT_MIXIN end
|
11
|
-
class Hash include NT_MIXIN end
|
10
|
+
# Extended with the `#to_nt` method.
|
11
|
+
class String include NestedText::NTEncodeMixin; end
|
12
12
|
|
13
|
+
# Extended with the `#to_nt` method.
|
14
|
+
class Array include NestedText::NTEncodeMixin; end
|
15
|
+
|
16
|
+
# Extended with the `#to_nt` method.
|
17
|
+
class Hash include NestedText::NTEncodeMixin; end
|
18
|
+
|
19
|
+
# Extended with NestedText support.
|
13
20
|
class NilClass
|
14
|
-
include
|
21
|
+
include NestedText::NTEncodeMixin
|
15
22
|
|
23
|
+
# Adds support for encoding and decoding nil.
|
16
24
|
def self.nt_create(_data) = nil
|
17
25
|
|
26
|
+
# Adds support for encoding and decoding nil.
|
18
27
|
def encode_nt_with() = ""
|
19
28
|
end
|
data/lib/nestedtext/decode.rb
CHANGED
@@ -1,18 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "nestedtext/parser"
|
4
|
-
require "nestedtext/
|
4
|
+
require "nestedtext/errors_internal"
|
5
5
|
|
6
6
|
require "logger"
|
7
7
|
require "stringio"
|
8
8
|
|
9
9
|
module NestedText
|
10
|
+
# Decode a NestedText string to Ruby objects.
|
11
|
+
#
|
12
|
+
# @param ntstring [String] The string containing NestedText to be decoded.
|
13
|
+
# @param top_class [String] Force the top level returned object to be of this type. Supported values are `Object`, `Array`, `Hash` and `String`.
|
14
|
+
# @param strict [Boolean] If strict mode should be used.
|
15
|
+
#
|
16
|
+
# @return [Object, nil] The parsed object.
|
17
|
+
#
|
18
|
+
# @raise [NestedText::Error] if anything went wrong.
|
10
19
|
def self.load(ntstring, top_class: Object, strict: false)
|
11
20
|
raise Errors::WrongInputTypeError.new([String], ntstring) unless ntstring.nil? || ntstring.is_a?(String)
|
12
21
|
|
13
22
|
Parser.new(StringIO.new(ntstring), top_class, strict: strict).parse
|
14
23
|
end
|
15
24
|
|
25
|
+
# Decode a NestedText stored in a given file.
|
26
|
+
#
|
27
|
+
# @param filename [String] The file path to read NestedText to decode from.
|
28
|
+
# @param top_class [String] Force the top level returned object to be of this type. Supported values are `Object`, `Array`, `Hash` and `String`.
|
29
|
+
# @param strict [Boolean] If strict mode should be used.
|
30
|
+
#
|
31
|
+
# @return [Object, nil] The parsed object.
|
32
|
+
#
|
33
|
+
# @raise [NestedText::Error] if anything went wrong.
|
34
|
+
# @raise [IOError] on issue opening `filename` for reading in text mode.
|
16
35
|
def self.load_file(filename, top_class: Object, strict: false)
|
17
36
|
raise Errors::WrongInputTypeError.new([String], filename) unless !filename.nil? && filename.is_a?(String)
|
18
37
|
|
data/lib/nestedtext/dumper.rb
CHANGED
data/lib/nestedtext/encode.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "nestedtext/errors"
|
4
3
|
require "nestedtext/dumper"
|
5
|
-
|
6
|
-
# Model after JSON
|
7
|
-
# NestedText.dump(obj, io=nil) => dumps to string, or to IO if given
|
8
|
-
# NestedText.dump_file(obj, filename)
|
4
|
+
require "nestedtext/errors_internal"
|
9
5
|
|
10
6
|
module NestedText
|
7
|
+
# Encode a Ruby object to a NestedText string.
|
8
|
+
#
|
9
|
+
# @param obj [Object] The object to encode to NestedText.
|
10
|
+
# @param io [IO] Additionally write the output to this IO object. The caller is responsible for that the IO is closed after the call to this method.
|
11
|
+
# @param indentation [Integer] The indentation of nested levels to use.
|
12
|
+
# @param strict [Boolean] If strict mode should be used.
|
13
|
+
#
|
14
|
+
# @return A String containing NestedText data.
|
15
|
+
# @raise [NestedText::Error] if anything went wrong.
|
16
|
+
# @raise Whatever the `io` can raise, if supplied.
|
11
17
|
def self.dump(obj, io: nil, indentation: 4, strict: false)
|
12
|
-
# io - additionaly write the out result to IO and still return result.
|
13
|
-
|
14
18
|
raise Errors::DumpBadIOError, io unless io.nil? || io.respond_to?(:write) && io.respond_to?(:fsync)
|
15
19
|
|
16
20
|
dumper = Dumper.new(indentation, strict)
|
@@ -22,6 +26,18 @@ module NestedText
|
|
22
26
|
dumper.dump obj
|
23
27
|
end
|
24
28
|
|
29
|
+
# Encode a Ruby object to a NestedText file.
|
30
|
+
|
31
|
+
# Apart from `filename`, this method behaves exactly like dump.
|
32
|
+
#
|
33
|
+
# @param (see dump)
|
34
|
+
# @param filename [String] The file path to write the NestedText result to. The conventional file extension is `.nt`.
|
35
|
+
#
|
36
|
+
#
|
37
|
+
# @return (see dump)
|
38
|
+
# @raise (see dump)
|
39
|
+
# @raise [IOError] on issues opening the `filename` for writing in text mode.
|
40
|
+
#
|
25
41
|
def self.dump_file(obj, filename, **kwargs)
|
26
42
|
raise Errors::DumpFileBadPathError, filename unless filename.is_a? String
|
27
43
|
|
@@ -1,16 +1,14 @@
|
|
1
1
|
require "nestedtext/dumper"
|
2
2
|
|
3
3
|
module NestedText
|
4
|
-
|
5
|
-
|
6
|
-
NestedText.dump(self, strict: true, **kwargs)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
private_constant :NTEncodeStrictMixin
|
10
|
-
|
4
|
+
# A mixin for Custom Classes to get the to_nt shortcut.
|
5
|
+
# TODO rename to: ToNTMixin
|
11
6
|
module NTEncodeMixin
|
7
|
+
# Encode this object to a NestedText string.
|
8
|
+
#
|
9
|
+
# This method takes the same named arguments as {NestedText.dump}.
|
12
10
|
def to_nt(**kwargs)
|
13
|
-
NestedText.dump(self, **kwargs)
|
11
|
+
NestedText.dump(self, strict: false, **kwargs)
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
@@ -4,13 +4,9 @@ require "word_wrap"
|
|
4
4
|
require "word_wrap/core_ext"
|
5
5
|
|
6
6
|
require "nestedtext/constants"
|
7
|
+
require "nestedtext/error"
|
7
8
|
|
8
9
|
module NestedText
|
9
|
-
# Top level error for users to rescue on.
|
10
|
-
class Error < StandardError
|
11
|
-
private_class_method :new
|
12
|
-
end
|
13
|
-
|
14
10
|
module Errors
|
15
11
|
class InternalError < Error
|
16
12
|
public_class_method :new # Prevent users from instansiating.
|
data/lib/nestedtext/parser.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require "stringio"
|
4
4
|
|
5
|
-
require "nestedtext/
|
5
|
+
require "nestedtext/errors_internal"
|
6
6
|
require "nestedtext/scanners"
|
7
7
|
require "nestedtext/constants"
|
8
8
|
|
@@ -15,7 +15,6 @@ module NestedText
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
# TODO: document that caller is responsible for closing IO after done with Parser.
|
19
18
|
def initialize(io, top_class, strict: false)
|
20
19
|
assert_valid_input_type io
|
21
20
|
Parser.assert_valid_top_level_type(top_class)
|
data/lib/nestedtext/scanners.rb
CHANGED
data/lib/nestedtext/version.rb
CHANGED
data/lib/nestedtext.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "nestedtext/encode"
|
4
|
-
require_relative "nestedtext/decode"
|
5
3
|
require_relative "nestedtext/core_ext"
|
4
|
+
require_relative "nestedtext/decode"
|
5
|
+
require_relative "nestedtext/encode"
|
6
|
+
require_relative "nestedtext/encode_helpers"
|
7
|
+
require_relative "nestedtext/error"
|
6
8
|
require_relative "nestedtext/version"
|
7
9
|
|
10
|
+
##
|
11
|
+
# # NestedText
|
12
|
+
# The main module in this library to use.
|
13
|
+
#
|
14
|
+
# See {file:README.md} for documentation on Types, Strict Mode and Custom Classes.
|
8
15
|
module NestedText
|
9
16
|
end
|
data/nestedtext.gemspec
CHANGED
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
|
|
25
25
|
}
|
26
26
|
|
27
27
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
28
|
-
`git ls-files -z`.split("\x0").
|
29
|
-
f.match(%r{\A(?:
|
28
|
+
`git ls-files -z`.split("\x0").select do |f|
|
29
|
+
f.match(%r{\A(?:lib/|CHANGELOG.md|CONTRIBUTING.md|LICENSE.txt|README.md|SECURITY.md|nestedtext.gemspec)})
|
30
30
|
end
|
31
31
|
end
|
32
32
|
spec.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nestedtext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Westrup
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: warning
|
@@ -49,15 +49,9 @@ executables: []
|
|
49
49
|
extensions: []
|
50
50
|
extra_rdoc_files: []
|
51
51
|
files:
|
52
|
-
- ".editorconfig"
|
53
|
-
- ".gitignore"
|
54
|
-
- ".rubocop.yml"
|
55
|
-
- ".ruby-version"
|
56
52
|
- CHANGELOG.md
|
57
53
|
- CONTRIBUTING.md
|
58
|
-
- Gemfile
|
59
54
|
- LICENSE.txt
|
60
|
-
- OSSMETADATA
|
61
55
|
- README.md
|
62
56
|
- SECURITY.md
|
63
57
|
- lib/nestedtext.rb
|
@@ -68,7 +62,8 @@ files:
|
|
68
62
|
- lib/nestedtext/dumper.rb
|
69
63
|
- lib/nestedtext/encode.rb
|
70
64
|
- lib/nestedtext/encode_helpers.rb
|
71
|
-
- lib/nestedtext/
|
65
|
+
- lib/nestedtext/error.rb
|
66
|
+
- lib/nestedtext/errors_internal.rb
|
72
67
|
- lib/nestedtext/parser.rb
|
73
68
|
- lib/nestedtext/scanners.rb
|
74
69
|
- lib/nestedtext/version.rb
|
data/.editorconfig
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# Modified version of https://github.com/ruby/ruby/blob/master/.editorconfig
|
2
|
-
|
3
|
-
root = true
|
4
|
-
|
5
|
-
[*]
|
6
|
-
end_of_line = lf
|
7
|
-
indent_size = 4
|
8
|
-
indent_style = space
|
9
|
-
insert_final_newline = true
|
10
|
-
tab_width = 4
|
11
|
-
trim_trailing_whitespace = true
|
12
|
-
|
13
|
-
[*.rb]
|
14
|
-
indent_size = 2
|
15
|
-
|
16
|
-
[*.gemspec]
|
17
|
-
indent_size = 2
|
18
|
-
|
19
|
-
[*.yml]
|
20
|
-
indent_size = 2
|
21
|
-
|
22
|
-
[test/nestedtext/encode_test.rb]
|
23
|
-
# So we can test trailing whitespace strings.
|
24
|
-
trim_trailing_whitespace = unset
|
data/.gitignore
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# Contrary to ruby apps, ruby gems should not check in Gemfile.lock.
|
2
|
-
# Reference: https://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
|
3
|
-
/Gemfile.lock
|
4
|
-
|
5
|
-
# Bundle local config
|
6
|
-
/.bundle/
|
7
|
-
|
8
|
-
# Package gem from $(rake install)
|
9
|
-
/pkg/
|
10
|
-
# When built from $(gem build *.gemspec)
|
11
|
-
/*.gem
|
12
|
-
|
13
|
-
# rdoc
|
14
|
-
/doc
|
15
|
-
|
16
|
-
# minitest
|
17
|
-
/test/html_reports/
|
18
|
-
/test/reports/
|
19
|
-
|
20
|
-
# simplecov
|
21
|
-
/coverage/
|
22
|
-
|
23
|
-
# byebug
|
24
|
-
/.byebug_history
|
data/.rubocop.yml
DELETED
@@ -1,143 +0,0 @@
|
|
1
|
-
# See pages relaed at https://docs.rubocop.org/rubocop/1.12/cops_layout.html
|
2
|
-
|
3
|
-
|
4
|
-
# TODO clean this upand remove Excludes not needed.
|
5
|
-
|
6
|
-
# Rubocop extensions
|
7
|
-
require:
|
8
|
-
- rubocop-rake
|
9
|
-
|
10
|
-
inherit_mode:
|
11
|
-
merge:
|
12
|
-
- Exclude # Merge my AllCops.Excllude with default exludes from https://github.com/rubocop/rubocop/blob/master/config/default.yml
|
13
|
-
|
14
|
-
AllCops:
|
15
|
-
TargetRubyVersion: 3.0
|
16
|
-
Include:
|
17
|
-
- lib/**/*.rb
|
18
|
-
- spec/**/*.rb
|
19
|
-
Exclude:
|
20
|
-
# Travis: during build there will be a lot of rubocop config files in this pat which will cause build failure as the refer to gems which are not installed by this project.
|
21
|
-
# See https://github.com/rubocop/rubocop/issues/9832
|
22
|
-
- gemfiles/vendor/bundle/**/*
|
23
|
-
|
24
|
-
Gemspec/DateAssignment:
|
25
|
-
Enabled: true
|
26
|
-
|
27
|
-
Layout/LineEndStringConcatenationIndentation:
|
28
|
-
Enabled: true
|
29
|
-
|
30
|
-
Lint/AmbiguousAssignment:
|
31
|
-
Enabled: true
|
32
|
-
Lint/DeprecatedConstants:
|
33
|
-
Enabled: true
|
34
|
-
Lint/DuplicateBranch:
|
35
|
-
Enabled: true
|
36
|
-
Lint/DuplicateRegexpCharacterClassElement:
|
37
|
-
Enabled: true
|
38
|
-
Lint/EmptyBlock:
|
39
|
-
Enabled: true
|
40
|
-
Lint/EmptyClass:
|
41
|
-
Enabled: true
|
42
|
-
Layout/EmptyLineBetweenDefs:
|
43
|
-
Enabled: true
|
44
|
-
Exclude:
|
45
|
-
- lib/nestedtext-ruby/errors.rb
|
46
|
-
Lint/EmptyInPattern:
|
47
|
-
Enabled: true
|
48
|
-
Lint/LambdaWithoutLiteralBlock:
|
49
|
-
Enabled: true
|
50
|
-
Layout/LineLength:
|
51
|
-
Max: 120
|
52
|
-
Lint/NoReturnInBeginEndBlocks:
|
53
|
-
Enabled: true
|
54
|
-
Lint/NumberedParameterAssignment:
|
55
|
-
Enabled: true
|
56
|
-
Lint/OrAssignmentToConstant:
|
57
|
-
Enabled: true
|
58
|
-
Lint/RedundantDirGlobSort:
|
59
|
-
Enabled: true
|
60
|
-
Layout/SpaceBeforeBrackets:
|
61
|
-
Enabled: true
|
62
|
-
Lint/SymbolConversion:
|
63
|
-
Enabled: true
|
64
|
-
Lint/ToEnumArguments:
|
65
|
-
Enabled: true
|
66
|
-
Lint/TripleQuotes:
|
67
|
-
Enabled: true
|
68
|
-
Lint/UnexpectedBlockArity:
|
69
|
-
Enabled: true
|
70
|
-
Lint/UnmodifiedReduceAccumulator:
|
71
|
-
Enabled: true
|
72
|
-
Lint/UnreachableCode:
|
73
|
-
Severity: error
|
74
|
-
Lint/UselessAccessModifier:
|
75
|
-
Enabled: false
|
76
|
-
|
77
|
-
Metrics/AbcSize:
|
78
|
-
Enabled: true
|
79
|
-
Metrics/BlockLength:
|
80
|
-
Enabled: true
|
81
|
-
Max: 100
|
82
|
-
Metrics/MethodLength:
|
83
|
-
Enabled: true
|
84
|
-
Max: 25
|
85
|
-
|
86
|
-
Naming/FileName:
|
87
|
-
Enabled: false
|
88
|
-
Exclude:
|
89
|
-
- lib/nestedtext-ruby.rb
|
90
|
-
Naming/InclusiveLanguage:
|
91
|
-
Enabled: true
|
92
|
-
|
93
|
-
Style/ArgumentsForwarding:
|
94
|
-
Enabled: true
|
95
|
-
Style/CollectionCompact:
|
96
|
-
Enabled: true
|
97
|
-
Style/Documentation:
|
98
|
-
Enabled: true
|
99
|
-
Exclude:
|
100
|
-
- lib/nestedtext-ruby/errors.rb
|
101
|
-
Style/DocumentDynamicEvalDefinition:
|
102
|
-
Enabled: true
|
103
|
-
Style/EndlessMethod:
|
104
|
-
Enabled: true
|
105
|
-
Style/HashConversion:
|
106
|
-
Enabled: true
|
107
|
-
Style/HashExcept:
|
108
|
-
Enabled: true
|
109
|
-
Style/IfWithBooleanLiteralBranches:
|
110
|
-
Enabled: true
|
111
|
-
Style/InPatternThen:
|
112
|
-
Enabled: true
|
113
|
-
Style/MultilineInPatternThen:
|
114
|
-
Enabled: true
|
115
|
-
Style/NegatedIfElseCondition:
|
116
|
-
Enabled: true
|
117
|
-
Style/NilLambda:
|
118
|
-
Enabled: true
|
119
|
-
Style/QuotedSymbols:
|
120
|
-
Enabled: true
|
121
|
-
Style/RedundantArgument:
|
122
|
-
Enabled: true
|
123
|
-
Style/RegexpLiteral:
|
124
|
-
Enabled: false
|
125
|
-
Style/SingleLineMethods:
|
126
|
-
Enabled: true
|
127
|
-
Exclude:
|
128
|
-
- lib/nestedtext-ruby/errors.rb
|
129
|
-
Style/StringChars:
|
130
|
-
Enabled: true
|
131
|
-
Style/StringLiterals:
|
132
|
-
Enabled: true
|
133
|
-
EnforcedStyle: double_quotes
|
134
|
-
Style/StringLiteralsInInterpolation:
|
135
|
-
Enabled: true
|
136
|
-
EnforcedStyle: double_quotes
|
137
|
-
Style/SwapValues:
|
138
|
-
Enabled: true
|
139
|
-
|
140
|
-
|
141
|
-
# Reference: https://github.com/rubocop/rubocop-rake/blob/master/config/default.yml
|
142
|
-
Rake:
|
143
|
-
Enabled: true
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.1.0
|
data/Gemfile
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Put require=false on gem's that we don't need to import in code (cli exec only)
|
4
|
-
|
5
|
-
source "https://rubygems.org"
|
6
|
-
|
7
|
-
# Include dependencies from the .gemspec
|
8
|
-
gemspec
|
9
|
-
|
10
|
-
# Development dependencies
|
11
|
-
# Should rather be here than in the .gemspec
|
12
|
-
# Reference: https://github.com/rubygems/bundler/pull/7222
|
13
|
-
# However there's an argument for using gemspec too: https://bundler.io/guides/creating_gem.html#testing-our-gem
|
14
|
-
group :development, :test do
|
15
|
-
gem "gem-release", "~> 2.0", require: false
|
16
|
-
gem "pry-byebug", "~> 3.9"
|
17
|
-
gem "rake", "~> 13.0", require: false
|
18
|
-
gem "solargraph", require: false
|
19
|
-
end
|
20
|
-
|
21
|
-
group :test do
|
22
|
-
gem "minitest-byebug", "~> 0.0.3"
|
23
|
-
gem "minitest-reporters", "~> 1.4", require: false
|
24
|
-
gem "rubocop", "~> 1.18", require: false
|
25
|
-
gem "rubocop-rake", "~> 0.6", require: false
|
26
|
-
gem "simplecov", "~> 0.21", require: false
|
27
|
-
end
|
data/OSSMETADATA
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
osslifecycle=active
|