toml 0.0.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +21 -0
- data/README.md +15 -3
- data/lib/toml.rb +3 -4
- data/lib/toml/generator.rb +1 -40
- data/lib/toml/monkey_patch.rb +76 -10
- data/lib/toml/parser.rb +57 -20
- data/lib/toml/parslet.rb +58 -35
- data/lib/toml/table.rb +10 -0
- data/lib/toml/transformer.rb +25 -9
- data/lib/toml/version.rb +3 -0
- metadata +40 -30
- data/Gemfile +0 -8
- data/Rakefile +0 -150
- data/lib/toml/key_group.rb +0 -9
- data/test/spec.toml +0 -62
- data/test/test_generator.rb +0 -33
- data/test/test_parser.rb +0 -75
- data/test/tmp.rb +0 -25
- data/toml.gemspec +0 -70
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6fe891b78d0c8ef3788c8abe359d4350bc1a1a9774d2576c94b8840160acee62
|
4
|
+
data.tar.gz: 948287584ed396f0f07bdaf358f4263f25528a5de4ccb3b8cfecabc1514936fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 867a7f6183e52213106e50d68e8e2e1262b87875a6cbe20e43637803011d3796bc77ad50e5e6c64e778cd84ebb833fad474f39ac8abc605e1a436e41aff24edd
|
7
|
+
data.tar.gz: efd7be04b02c6487ce8a1bc686e8943f426ceb8054852eebb944ba655bcab152b299dd6a189f73d5671df16446cdeeb11d0bea2fe51171aad661c392efbfb4bb
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
## 0.3.0 / 2020-06-09
|
2
|
+
|
3
|
+
- Fix "undefined method `ascii_tree' for nil:NilClass" when printing parse error
|
4
|
+
- Fixes TOML to work with version 2.0 of Parslet
|
5
|
+
|
6
|
+
## 0.2.0 / 2017-11-11
|
7
|
+
|
8
|
+
- Add support for underscored Integers and Floats
|
9
|
+
- Fixes TOML to work with version 1.8.0 of Parslet
|
10
|
+
|
11
|
+
## 0.1.2 / 2014-10-16
|
12
|
+
|
13
|
+
- Add support for `CR` and `CRLF` newlines (#13)
|
14
|
+
- Add support for generating TOML from Ruby `Hash`es (#36)
|
15
|
+
- Add a script interface for @BurntSushi's `toml-test` utility (#38)
|
16
|
+
|
17
|
+
## 0.1.1 / 2014-02-17
|
18
|
+
|
19
|
+
- Add license to gemspec (#26)
|
20
|
+
- Loosen `multi_json` dependency version specified (#27)
|
21
|
+
- `Generator` should print empty hash tables but not keys without values (#28)
|
data/README.md
CHANGED
@@ -1,15 +1,25 @@
|
|
1
1
|
# TOML
|
2
2
|
|
3
|
-
A
|
3
|
+
A Ruby parser for [TOML](https://github.com/mojombo/toml), built on [parslet](https://github.com/kschiess/parslet).
|
4
4
|
|
5
5
|
This is far superior to YAML and JSON because it doesn't suck. Really it doesn't.
|
6
6
|
|
7
|
+
<<<<<<< HEAD
|
8
|
+
=======
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/toml.svg)](http://badge.fury.io/rb/toml)
|
10
|
+
|
11
|
+
>>>>>>> Update README
|
7
12
|
## Usage
|
8
13
|
|
9
|
-
|
14
|
+
Install this library:
|
10
15
|
|
16
|
+
<<<<<<< HEAD
|
11
17
|
```ruby
|
12
|
-
gem "toml", "~> 0.0
|
18
|
+
gem "toml", "~> 0.3.0"
|
19
|
+
=======
|
20
|
+
```bash
|
21
|
+
gem install "toml"
|
22
|
+
>>>>>>> Update README
|
13
23
|
```
|
14
24
|
|
15
25
|
It's simple, really.
|
@@ -38,6 +48,8 @@ TOML.load_file("my_file.toml")
|
|
38
48
|
# => {"whatever" => "keys"}
|
39
49
|
```
|
40
50
|
|
51
|
+
In case a syntax error occurs, the parser will raise a `Parslet::ParseFailed` exception.
|
52
|
+
|
41
53
|
There's also a beta feature for generating a TOML file from a Ruby hash. Please note this will likely not give beautiful output right now.
|
42
54
|
|
43
55
|
```ruby
|
data/lib/toml.rb
CHANGED
@@ -3,8 +3,9 @@ $:.unshift(File.dirname(__FILE__))
|
|
3
3
|
require 'time'
|
4
4
|
require 'parslet'
|
5
5
|
|
6
|
+
require 'toml/version'
|
6
7
|
require 'toml/key'
|
7
|
-
require 'toml/
|
8
|
+
require 'toml/table'
|
8
9
|
require 'toml/parslet'
|
9
10
|
require 'toml/transformer'
|
10
11
|
require 'toml/parser'
|
@@ -14,8 +15,6 @@ require 'toml/generator'
|
|
14
15
|
# require 'toml/monkey_patch
|
15
16
|
|
16
17
|
module TOML
|
17
|
-
VERSION = '0.0.4'
|
18
|
-
|
19
18
|
def self.load(content)
|
20
19
|
Parser.new(content).parsed
|
21
20
|
end
|
@@ -23,4 +22,4 @@ module TOML
|
|
23
22
|
def self.load_file(path)
|
24
23
|
Parser.new(File.read(path)).parsed
|
25
24
|
end
|
26
|
-
end
|
25
|
+
end
|
data/lib/toml/generator.rb
CHANGED
@@ -8,10 +8,8 @@ module TOML
|
|
8
8
|
# used by TOML.
|
9
9
|
self.class.inject!
|
10
10
|
|
11
|
-
@body = ""
|
12
11
|
@doc = doc
|
13
|
-
|
14
|
-
visit(@doc)
|
12
|
+
@body = doc.to_toml
|
15
13
|
|
16
14
|
return @body
|
17
15
|
end
|
@@ -27,42 +25,5 @@ module TOML
|
|
27
25
|
require 'toml/monkey_patch'
|
28
26
|
@@injected = true
|
29
27
|
end
|
30
|
-
|
31
|
-
def visit(hash, path = "")
|
32
|
-
hash_pairs = [] # Sub-hashes
|
33
|
-
other_pairs = []
|
34
|
-
|
35
|
-
hash.keys.sort.each do |key|
|
36
|
-
val = hash[key]
|
37
|
-
# TODO: Refactor for other hash-likes (OrderedHash)
|
38
|
-
if val.is_a? Hash
|
39
|
-
hash_pairs << [key, val]
|
40
|
-
else
|
41
|
-
other_pairs << [key, val]
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# Handle all the key-values
|
46
|
-
if !path.empty? && !other_pairs.empty?
|
47
|
-
@body += "[#{path}]\n"
|
48
|
-
end
|
49
|
-
other_pairs.each do |pair|
|
50
|
-
key, val = pair
|
51
|
-
@body += "#{key} = #{format(val)}\n"
|
52
|
-
end
|
53
|
-
@body += "\n" unless other_pairs.empty?
|
54
|
-
|
55
|
-
# Then deal with sub-hashes
|
56
|
-
hash_pairs.each do |pair|
|
57
|
-
key, hash = pair
|
58
|
-
visit(hash, (path.empty? ? key : [path, key].join(".")))
|
59
|
-
end
|
60
|
-
end#visit
|
61
|
-
|
62
|
-
# Returns the value formatted for TOML.
|
63
|
-
def format(val)
|
64
|
-
val.to_toml
|
65
|
-
end
|
66
|
-
|
67
28
|
end#Generator
|
68
29
|
end#TOML
|
data/lib/toml/monkey_patch.rb
CHANGED
@@ -1,21 +1,87 @@
|
|
1
1
|
# Adds to_toml methods to base Ruby classes used by the generator.
|
2
|
+
class Object
|
3
|
+
def toml_table?
|
4
|
+
self.kind_of?(Hash)
|
5
|
+
end
|
6
|
+
def toml_table_array?
|
7
|
+
self.kind_of?(Array) && self.first.toml_table?
|
8
|
+
end
|
9
|
+
end
|
10
|
+
class Hash
|
11
|
+
def to_toml(path = "")
|
12
|
+
return "" if self.empty?
|
13
|
+
|
14
|
+
tables = {}
|
15
|
+
values = {}
|
16
|
+
self.keys.sort.each do |key|
|
17
|
+
val = self[key]
|
18
|
+
if val.kind_of?(NilClass)
|
19
|
+
next
|
20
|
+
elsif val.toml_table? || val.toml_table_array?
|
21
|
+
tables[key] = val
|
22
|
+
else
|
23
|
+
values[key] = val
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
toml = ""
|
28
|
+
values.each do |key, val|
|
29
|
+
toml << "#{key} = #{val.to_toml(key)}\n"
|
30
|
+
end
|
31
|
+
|
32
|
+
tables.each do |key, val|
|
33
|
+
key = "#{path}.#{key}" unless path.empty?
|
34
|
+
toml_val = val.to_toml(key)
|
35
|
+
unless toml_val.empty?
|
36
|
+
if val.toml_table?
|
37
|
+
non_table_vals = val.values.reject do |v|
|
38
|
+
v.toml_table? || v.toml_table_array?
|
39
|
+
end
|
40
|
+
|
41
|
+
# Only add the table key if there are non table values.
|
42
|
+
if non_table_vals.length > 0
|
43
|
+
toml << "\n[#{key}]\n"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
toml << toml_val
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
toml
|
51
|
+
end
|
52
|
+
end
|
53
|
+
class Array
|
54
|
+
def to_toml(path = "")
|
55
|
+
unless self.map(&:class).uniq.length == 1
|
56
|
+
raise "All array values must be the same type"
|
57
|
+
end
|
58
|
+
|
59
|
+
if self.first.toml_table?
|
60
|
+
toml = ""
|
61
|
+
self.each do |val|
|
62
|
+
toml << "\n[[#{path}]]\n"
|
63
|
+
toml << val.to_toml(path)
|
64
|
+
end
|
65
|
+
return toml
|
66
|
+
else
|
67
|
+
"[" + self.map {|v| v.to_toml(path) }.join(",") + "]"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
2
71
|
class TrueClass
|
3
|
-
def to_toml; "true"; end
|
72
|
+
def to_toml(path = ""); "true"; end
|
4
73
|
end
|
5
74
|
class FalseClass
|
6
|
-
def to_toml; "false"; end
|
75
|
+
def to_toml(path = ""); "false"; end
|
7
76
|
end
|
8
77
|
class String
|
9
|
-
def to_toml; self.inspect; end
|
78
|
+
def to_toml(path = ""); self.inspect; end
|
10
79
|
end
|
11
80
|
class Numeric
|
12
|
-
def to_toml; self.to_s; end
|
81
|
+
def to_toml(path = ""); self.to_s; end
|
13
82
|
end
|
14
|
-
class
|
15
|
-
def to_toml
|
16
|
-
|
17
|
-
raise "All array values must be the same type"
|
18
|
-
end
|
19
|
-
"[" + self.map {|v| v.to_toml }.join(",") + "]"
|
83
|
+
class DateTime
|
84
|
+
def to_toml(path = "")
|
85
|
+
self.rfc3339
|
20
86
|
end
|
21
87
|
end
|
data/lib/toml/parser.rb
CHANGED
@@ -4,22 +4,25 @@ module TOML
|
|
4
4
|
|
5
5
|
def initialize(markup)
|
6
6
|
# Make sure we have a newline on the end
|
7
|
-
markup += "\n" unless markup.end_with?("\n")
|
8
|
-
|
9
|
-
begin
|
10
|
-
tree = Parslet.new.parse(markup)
|
11
|
-
rescue Parslet::ParseFailed => failure
|
12
|
-
puts failure.cause.ascii_tree
|
13
|
-
end
|
14
|
-
|
15
|
-
parts = Transformer.new.apply(tree)
|
16
7
|
|
8
|
+
markup += "\n" unless markup.end_with?("\n") || markup.length == 0
|
9
|
+
tree = Parslet.new.parse(markup)
|
10
|
+
|
11
|
+
parts = Transformer.new.apply(tree) || []
|
17
12
|
@parsed = {}
|
18
13
|
@current = @parsed
|
19
14
|
@current_path = ''
|
20
15
|
|
21
16
|
parts.each do |part|
|
22
17
|
if part.is_a? Key
|
18
|
+
# If @current is an array then we're in a key-group
|
19
|
+
if @current.is_a? Array
|
20
|
+
# Make sure there's a table to work with.
|
21
|
+
@current << {} if @current.last.nil?
|
22
|
+
# Set the key on the table.
|
23
|
+
@current.last[part.key] = part.value
|
24
|
+
next
|
25
|
+
end
|
23
26
|
# Make sure the key isn't already set
|
24
27
|
if !@current.is_a?(Hash) || @current.has_key?(part.key)
|
25
28
|
err = "Cannot override key '#{part.key}'"
|
@@ -30,28 +33,62 @@ module TOML
|
|
30
33
|
end
|
31
34
|
# Set the key-value into the current hash
|
32
35
|
@current[part.key] = part.value
|
33
|
-
elsif part.is_a?
|
34
|
-
|
36
|
+
elsif part.is_a?(TableArray)
|
37
|
+
resolve_table_array(part)
|
38
|
+
elsif part.is_a?(Table)
|
39
|
+
resolve_table(part)
|
35
40
|
else
|
36
41
|
raise "Unrecognized part: #{part.inspect}"
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
40
45
|
|
41
|
-
def
|
46
|
+
def resolve_table_array(t)
|
42
47
|
@current = @parsed
|
43
|
-
|
44
|
-
path = kg.keys.dup
|
48
|
+
path = t.name.dup
|
45
49
|
@current_path = path.join('.')
|
46
|
-
|
47
|
-
|
48
|
-
if @current.
|
49
|
-
|
50
|
+
while n = path.shift
|
51
|
+
# If it's a table-array then get the last item.
|
52
|
+
@current = @current.last if @current.is_a? Array
|
53
|
+
|
54
|
+
# If it's the last item:
|
55
|
+
if path.length == 0
|
56
|
+
# If the current table has an item:
|
57
|
+
if @current.has_key?(n)
|
58
|
+
# And that item is already a table-array:
|
59
|
+
if @current[n].is_a? Array
|
60
|
+
# Then add an item to that table-array.
|
61
|
+
@current[n] << {}
|
62
|
+
else
|
63
|
+
raise "Cannot override table array '#{t.name.join '.'}'"
|
64
|
+
end
|
65
|
+
else
|
66
|
+
# Create a new table array if nothing exists here.
|
67
|
+
@current[n] = []
|
68
|
+
end
|
69
|
+
elsif @current.has_key? n
|
70
|
+
# Don't do anything if we're just moving into tables.
|
50
71
|
else
|
51
|
-
@current[
|
72
|
+
@current[n] = {}
|
52
73
|
end
|
53
|
-
@current = @current[
|
74
|
+
@current = @current[n]
|
54
75
|
end
|
55
76
|
end
|
77
|
+
|
78
|
+
def resolve_table(t)
|
79
|
+
@current = @parsed
|
80
|
+
|
81
|
+
path = t.name.dup
|
82
|
+
@current_path = path.join('.')
|
83
|
+
while k = path.shift
|
84
|
+
# If it's a table-array then get the last item.
|
85
|
+
@current = @current.last if @current.is_a? Array
|
86
|
+
# Create a new table if one doesn't exist.
|
87
|
+
@current[k] = {} if !@current.has_key? k
|
88
|
+
# Move into the table.
|
89
|
+
@current = @current[k]
|
90
|
+
end
|
91
|
+
end#/resolve_key_group
|
92
|
+
|
56
93
|
end
|
57
94
|
end
|
data/lib/toml/parslet.rb
CHANGED
@@ -2,7 +2,7 @@ module TOML
|
|
2
2
|
class Parslet < ::Parslet::Parser
|
3
3
|
rule(:document) {
|
4
4
|
all_space >>
|
5
|
-
(
|
5
|
+
(comment_line | table | table_array | key_value).repeat >>
|
6
6
|
all_space
|
7
7
|
}
|
8
8
|
root :document
|
@@ -11,81 +11,104 @@ module TOML
|
|
11
11
|
array |
|
12
12
|
string |
|
13
13
|
datetime.as(:datetime) |
|
14
|
+
datetime_rfc3339.as(:datetime_rfc3339) |
|
14
15
|
float.as(:float) |
|
15
16
|
integer.as(:integer) |
|
16
17
|
boolean
|
17
18
|
}
|
18
|
-
|
19
|
+
|
19
20
|
# Finding comments in multiline arrays requires accepting a bunch of
|
20
21
|
# possible newlines and stuff before the comment
|
21
|
-
rule(:array_comments) { (all_space >> comment_line).repeat
|
22
|
-
|
22
|
+
rule(:array_comments) { (all_space >> comment_line).repeat }
|
23
|
+
|
23
24
|
rule(:array) {
|
24
|
-
str("[") >>
|
25
|
+
str("[") >> all_space >> array_comments >>
|
26
|
+
( array_comments >> # Match any comments on first line
|
25
27
|
all_space >> value >> array_comments >>
|
26
28
|
(
|
27
29
|
# Separator followed by any comments
|
28
30
|
all_space >> str(",") >> array_comments >>
|
29
31
|
# Value followed by any comments
|
30
32
|
all_space >> value >> array_comments
|
31
|
-
).repeat
|
33
|
+
).repeat >>
|
34
|
+
(all_space >> str(",")).maybe >> # possible trailing comma
|
32
35
|
all_space >> array_comments # Grab any remaining comments just in case
|
33
|
-
).maybe.as(:array) >> str("]")
|
36
|
+
).maybe.as(:array) >> str("]")
|
34
37
|
}
|
35
|
-
|
36
|
-
rule(:key_value) {
|
38
|
+
|
39
|
+
rule(:key_value) {
|
37
40
|
space >> key.as(:key) >>
|
38
41
|
space >> str("=") >>
|
39
42
|
space >> value.as(:value) >>
|
40
|
-
space >> comment.maybe >>
|
43
|
+
space >> comment.maybe >> newline >> all_space
|
41
44
|
}
|
42
|
-
rule(:
|
45
|
+
rule(:table) {
|
43
46
|
space >> str("[") >>
|
44
|
-
|
47
|
+
table_name.as(:table) >>
|
45
48
|
str("]") >>
|
49
|
+
space >> comment.maybe >> newline >> all_space
|
50
|
+
}
|
51
|
+
rule(:table_array) {
|
52
|
+
space >> str("[[") >>
|
53
|
+
table_name.as(:table_array) >>
|
54
|
+
str("]]") >>
|
46
55
|
space >> comment.maybe >> str("\n") >> all_space
|
47
56
|
}
|
48
|
-
|
49
|
-
rule(:key) { match("[^. \t\\]]").repeat(1) }
|
50
|
-
rule(:key_group_name) { key.as(:key) >> (str(".") >> key.as(:key)).repeat(0) }
|
51
57
|
|
52
|
-
rule(:
|
53
|
-
rule(:
|
58
|
+
rule(:key) { match["^. \t\\]"].repeat(1) }
|
59
|
+
rule(:table_name) { key.as(:key) >> (str(".") >> key.as(:key)).repeat }
|
60
|
+
|
61
|
+
rule(:comment_line) { comment >> newline >> all_space }
|
62
|
+
rule(:comment) { str("#") >> match["^\n"].repeat }
|
63
|
+
|
64
|
+
rule(:space) { match[" \t"].repeat }
|
65
|
+
rule(:all_space) { match[" \t\r\n"].repeat }
|
66
|
+
rule(:newline) { str("\r").maybe >> str("\n") | str("\r") >> str("\n").maybe }
|
54
67
|
|
55
|
-
rule(:space) { match("[ \t]").repeat(0) }
|
56
|
-
rule(:all_space) { match("[ \t\r\n]").repeat(0) }
|
57
|
-
|
58
68
|
rule(:string) {
|
59
69
|
str('"') >> (
|
60
|
-
match
|
61
|
-
(str("\\") >> match
|
62
|
-
).repeat
|
70
|
+
match["^\"\\\\"] |
|
71
|
+
(str("\\") >> match["0tnr\"\\\\"])
|
72
|
+
).repeat.as(:string) >> str('"')
|
63
73
|
}
|
64
|
-
|
74
|
+
|
65
75
|
rule(:sign) { str("-") }
|
66
76
|
rule(:sign?) { sign.maybe }
|
67
|
-
|
77
|
+
|
68
78
|
rule(:integer) {
|
69
|
-
str("0") |
|
79
|
+
str("0") | sign? >>
|
80
|
+
(match["1-9"] >> (match["_"].maybe >> match["0-9"]).repeat)
|
70
81
|
}
|
71
82
|
rule(:float) {
|
72
|
-
sign? >>
|
83
|
+
sign? >>
|
84
|
+
(match["0-9"] >> (match["_"].maybe >> match["0-9"]).repeat) >> str(".") >>
|
85
|
+
(match["0-9"] >> (match["_"].maybe >> match["0-9"]).repeat)
|
73
86
|
}
|
74
87
|
|
75
88
|
rule(:boolean) { str("true").as(:true) | str("false").as(:false) }
|
76
|
-
|
89
|
+
|
77
90
|
rule(:date) {
|
78
|
-
match
|
79
|
-
match
|
80
|
-
match
|
91
|
+
match["0-9"].repeat(4,4) >> str("-") >>
|
92
|
+
match["0-9"].repeat(2,2) >> str("-") >>
|
93
|
+
match["0-9"].repeat(2,2)
|
81
94
|
}
|
82
95
|
|
83
96
|
rule(:time) {
|
84
|
-
match
|
85
|
-
match
|
86
|
-
match
|
97
|
+
match["0-9"].repeat(2,2) >> str(":") >>
|
98
|
+
match["0-9"].repeat(2,2) >> str(":") >>
|
99
|
+
match["0-9"].repeat(2,2)
|
100
|
+
}
|
101
|
+
|
102
|
+
rule(:timezone) {
|
103
|
+
match["0-9"].repeat(2,2) >> str(":") >>
|
104
|
+
match["0-9"].repeat(2,2)
|
87
105
|
}
|
88
106
|
|
89
107
|
rule(:datetime) { date >> str("T") >> time >> str("Z") }
|
108
|
+
|
109
|
+
rule(:datetime_rfc3339) {
|
110
|
+
# rfc3339 section 5.6 allows replacing 'T' with a space.
|
111
|
+
date >> (str("T") | str(" ")) >> time >> (str("+") | str("-")) >> timezone
|
112
|
+
}
|
90
113
|
end
|
91
|
-
end
|
114
|
+
end
|
data/lib/toml/table.rb
ADDED
data/lib/toml/transformer.rb
CHANGED
@@ -7,9 +7,9 @@ module TOML
|
|
7
7
|
s = 0
|
8
8
|
o = []
|
9
9
|
while s < e
|
10
|
-
if val[s] == "\\"
|
10
|
+
if val[s].chr == "\\"
|
11
11
|
s += 1
|
12
|
-
case val[s]
|
12
|
+
case val[s].chr
|
13
13
|
when "t"
|
14
14
|
o << "\t"
|
15
15
|
when "n"
|
@@ -26,7 +26,7 @@ module TOML
|
|
26
26
|
raise "Unexpected escape character: '\\#{val[s]}'"
|
27
27
|
end
|
28
28
|
else
|
29
|
-
o << val[s]
|
29
|
+
o << val[s].chr
|
30
30
|
end
|
31
31
|
s += 1
|
32
32
|
end
|
@@ -36,6 +36,11 @@ module TOML
|
|
36
36
|
# Clean up arrays
|
37
37
|
# rule(:array => subtree(:ar)) { ar.is_a?(Array) ? ar : [ar] }
|
38
38
|
|
39
|
+
# Empty file
|
40
|
+
rule('') {
|
41
|
+
nil
|
42
|
+
}
|
43
|
+
|
39
44
|
# Clean up simple value hashes
|
40
45
|
rule(:integer => simple(:i)) { i.to_i }
|
41
46
|
rule(:float => simple(:f)) { f.to_f }
|
@@ -47,6 +52,7 @@ module TOML
|
|
47
52
|
""
|
48
53
|
}
|
49
54
|
rule(:datetime => simple(:d)) { DateTime.iso8601(d) }
|
55
|
+
rule(:datetime_rfc3339 => simple(:d)) { DateTime.rfc3339(d) }
|
50
56
|
rule(:true => simple(:b)) { true }
|
51
57
|
rule(:false => simple(:b)) { false }
|
52
58
|
|
@@ -87,14 +93,24 @@ module TOML
|
|
87
93
|
# Make key hashes (inside key_groups) just be strings
|
88
94
|
rule(:key => simple(:k)) { k }
|
89
95
|
|
90
|
-
#
|
91
|
-
rule(:
|
92
|
-
|
96
|
+
# Captures array-like key-groups
|
97
|
+
rule(:table => subtree(:kg)) {
|
98
|
+
Table.new(kg.map &:to_s)
|
93
99
|
}
|
94
100
|
|
95
|
-
|
96
|
-
rule(:
|
97
|
-
|
101
|
+
# Then objectify the key_groups
|
102
|
+
rule(:table => simple(:kg)) {
|
103
|
+
Table.new([kg.to_s])
|
104
|
+
}
|
105
|
+
|
106
|
+
# Multi-part (a.b.c) table-arrays
|
107
|
+
rule(:table_array => subtree(:names)) {
|
108
|
+
TableArray.new(names.map &:to_s)
|
109
|
+
}
|
110
|
+
|
111
|
+
# Single name table-arrays
|
112
|
+
rule(:table_array => simple(:name)) {
|
113
|
+
TableArray.new([name.to_s])
|
98
114
|
}
|
99
115
|
end
|
100
116
|
end
|
data/lib/toml/version.rb
ADDED
metadata
CHANGED
@@ -1,31 +1,48 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jeremy McAnally
|
9
8
|
- Dirk Gadsden
|
10
|
-
autorequire:
|
9
|
+
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2021-06-01 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: parslet
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ">="
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
20
|
+
version: 1.8.0
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 3.0.0
|
23
24
|
type: :runtime
|
24
25
|
prerelease: false
|
25
26
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 1.8.0
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rake
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
29
46
|
- !ruby/object:Gem::Version
|
30
47
|
version: '0'
|
31
48
|
description: Parse your TOML, seriously.
|
@@ -35,49 +52,42 @@ extensions: []
|
|
35
52
|
extra_rdoc_files:
|
36
53
|
- README.md
|
37
54
|
- LICENSE
|
55
|
+
- CHANGELOG.md
|
38
56
|
files:
|
39
|
-
-
|
57
|
+
- CHANGELOG.md
|
40
58
|
- LICENSE
|
41
59
|
- README.md
|
42
|
-
- Rakefile
|
43
60
|
- lib/toml.rb
|
44
61
|
- lib/toml/generator.rb
|
45
62
|
- lib/toml/key.rb
|
46
|
-
- lib/toml/key_group.rb
|
47
63
|
- lib/toml/monkey_patch.rb
|
48
64
|
- lib/toml/parser.rb
|
49
65
|
- lib/toml/parslet.rb
|
66
|
+
- lib/toml/table.rb
|
50
67
|
- lib/toml/transformer.rb
|
51
|
-
-
|
52
|
-
- test/test_generator.rb
|
53
|
-
- test/test_parser.rb
|
54
|
-
- test/tmp.rb
|
55
|
-
- toml.gemspec
|
68
|
+
- lib/toml/version.rb
|
56
69
|
homepage: http://github.com/jm/toml
|
57
|
-
licenses:
|
58
|
-
|
70
|
+
licenses:
|
71
|
+
- MIT
|
72
|
+
metadata: {}
|
73
|
+
post_install_message:
|
59
74
|
rdoc_options:
|
60
|
-
- --charset=UTF-8
|
75
|
+
- "--charset=UTF-8"
|
61
76
|
require_paths:
|
62
77
|
- lib
|
63
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
84
|
requirements:
|
72
|
-
- -
|
85
|
+
- - ">="
|
73
86
|
- !ruby/object:Gem::Version
|
74
87
|
version: '0'
|
75
88
|
requirements: []
|
76
|
-
|
77
|
-
|
78
|
-
signing_key:
|
89
|
+
rubygems_version: 3.1.4
|
90
|
+
signing_key:
|
79
91
|
specification_version: 2
|
80
92
|
summary: Parse your TOML.
|
81
|
-
test_files:
|
82
|
-
- test/test_generator.rb
|
83
|
-
- test/test_parser.rb
|
93
|
+
test_files: []
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'date'
|
4
|
-
|
5
|
-
#############################################################################
|
6
|
-
#
|
7
|
-
# Helper functions
|
8
|
-
#
|
9
|
-
#############################################################################
|
10
|
-
|
11
|
-
def name
|
12
|
-
@name ||= Dir['*.gemspec'].first.split('.').first
|
13
|
-
end
|
14
|
-
|
15
|
-
def version
|
16
|
-
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
|
17
|
-
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
18
|
-
end
|
19
|
-
|
20
|
-
def date
|
21
|
-
Date.today.to_s
|
22
|
-
end
|
23
|
-
|
24
|
-
def rubyforge_project
|
25
|
-
name
|
26
|
-
end
|
27
|
-
|
28
|
-
def gemspec_file
|
29
|
-
"#{name}.gemspec"
|
30
|
-
end
|
31
|
-
|
32
|
-
def gem_file
|
33
|
-
"#{name}-#{version}.gem"
|
34
|
-
end
|
35
|
-
|
36
|
-
def replace_header(head, header_name)
|
37
|
-
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
38
|
-
end
|
39
|
-
|
40
|
-
#############################################################################
|
41
|
-
#
|
42
|
-
# Standard tasks
|
43
|
-
#
|
44
|
-
#############################################################################
|
45
|
-
|
46
|
-
task :default => :test
|
47
|
-
|
48
|
-
require 'rake/testtask'
|
49
|
-
Rake::TestTask.new(:test) do |test|
|
50
|
-
test.libs << 'lib' << 'test'
|
51
|
-
test.pattern = 'test/**/test_*.rb'
|
52
|
-
test.verbose = true
|
53
|
-
end
|
54
|
-
|
55
|
-
desc "Generate RCov test coverage and open in your browser"
|
56
|
-
task :coverage do
|
57
|
-
require 'rcov'
|
58
|
-
sh "rm -fr coverage"
|
59
|
-
sh "rcov test/test_*.rb"
|
60
|
-
sh "open coverage/index.html"
|
61
|
-
end
|
62
|
-
|
63
|
-
require 'rdoc/task'
|
64
|
-
Rake::RDocTask.new do |rdoc|
|
65
|
-
rdoc.rdoc_dir = 'rdoc'
|
66
|
-
rdoc.title = "#{name} #{version}"
|
67
|
-
rdoc.rdoc_files.include('README*')
|
68
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
69
|
-
end
|
70
|
-
|
71
|
-
desc "Open an irb session preloaded with this library"
|
72
|
-
task :console do
|
73
|
-
sh "irb -rubygems -r ./lib/#{name}.rb"
|
74
|
-
end
|
75
|
-
|
76
|
-
#############################################################################
|
77
|
-
#
|
78
|
-
# Custom tasks (add your own tasks here)
|
79
|
-
#
|
80
|
-
#############################################################################
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
#############################################################################
|
85
|
-
#
|
86
|
-
# Packaging tasks
|
87
|
-
#
|
88
|
-
#############################################################################
|
89
|
-
|
90
|
-
desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
|
91
|
-
task :release => :build do
|
92
|
-
unless `git branch` =~ /^\* master$/
|
93
|
-
puts "You must be on the master branch to release!"
|
94
|
-
exit!
|
95
|
-
end
|
96
|
-
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
97
|
-
sh "git tag v#{version}"
|
98
|
-
sh "git push origin master"
|
99
|
-
sh "git push origin v#{version}"
|
100
|
-
sh "gem push pkg/#{name}-#{version}.gem"
|
101
|
-
end
|
102
|
-
|
103
|
-
desc "Build #{gem_file} into the pkg directory"
|
104
|
-
task :build => :gemspec do
|
105
|
-
sh "mkdir -p pkg"
|
106
|
-
sh "gem build #{gemspec_file}"
|
107
|
-
sh "mv #{gem_file} pkg"
|
108
|
-
end
|
109
|
-
|
110
|
-
desc "Generate #{gemspec_file}"
|
111
|
-
task :gemspec => :validate do
|
112
|
-
# read spec file and split out manifest section
|
113
|
-
spec = File.read(gemspec_file)
|
114
|
-
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
115
|
-
|
116
|
-
# replace name version and date
|
117
|
-
replace_header(head, :name)
|
118
|
-
replace_header(head, :version)
|
119
|
-
replace_header(head, :date)
|
120
|
-
#comment this out if your rubyforge_project has a different name
|
121
|
-
replace_header(head, :rubyforge_project)
|
122
|
-
|
123
|
-
# determine file list from git ls-files
|
124
|
-
files = `git ls-files`.
|
125
|
-
split("\n").
|
126
|
-
sort.
|
127
|
-
reject { |file| file =~ /^\./ }.
|
128
|
-
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
129
|
-
map { |file| " #{file}" }.
|
130
|
-
join("\n")
|
131
|
-
|
132
|
-
# piece file back together and write
|
133
|
-
manifest = " s.files = %w[\n#{files}\n ]\n"
|
134
|
-
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
135
|
-
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
136
|
-
puts "Updated #{gemspec_file}"
|
137
|
-
end
|
138
|
-
|
139
|
-
desc "Validate #{gemspec_file}"
|
140
|
-
task :validate do
|
141
|
-
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
|
142
|
-
unless libfiles.empty?
|
143
|
-
puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
|
144
|
-
exit!
|
145
|
-
end
|
146
|
-
unless Dir['VERSION*'].empty?
|
147
|
-
puts "A `VERSION` file at root level violates Gem best practices."
|
148
|
-
exit!
|
149
|
-
end
|
150
|
-
end
|
data/lib/toml/key_group.rb
DELETED
data/test/spec.toml
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# Comment
|
2
|
-
|
3
|
-
# Booleans
|
4
|
-
true = true
|
5
|
-
false = false
|
6
|
-
|
7
|
-
[strings]
|
8
|
-
# String
|
9
|
-
string = "string\n\t\"string"
|
10
|
-
empty = ""
|
11
|
-
|
12
|
-
[ints]
|
13
|
-
simple = 42
|
14
|
-
negative = -42
|
15
|
-
|
16
|
-
[floats]
|
17
|
-
pi = 3.14159
|
18
|
-
negative = -10.0
|
19
|
-
|
20
|
-
[datetimes]
|
21
|
-
# DateTime
|
22
|
-
simple = 1979-05-27T07:32:00Z
|
23
|
-
|
24
|
-
# Keygroups
|
25
|
-
[a.b.c]
|
26
|
-
d = "test"
|
27
|
-
|
28
|
-
[e]
|
29
|
-
f = "test"
|
30
|
-
|
31
|
-
# Post line comment
|
32
|
-
[comments]
|
33
|
-
on = "a line" # with markup
|
34
|
-
|
35
|
-
# Multi-line arrays
|
36
|
-
[arrays]
|
37
|
-
# Simple array
|
38
|
-
simple = [1, 2, 3]
|
39
|
-
|
40
|
-
# Nested array
|
41
|
-
nested = [[1, 2], [3]]
|
42
|
-
|
43
|
-
# Multiline array
|
44
|
-
multiline = [
|
45
|
-
1,
|
46
|
-
2,
|
47
|
-
3
|
48
|
-
]
|
49
|
-
|
50
|
-
# With comments
|
51
|
-
multiline_comments = [ # 0
|
52
|
-
1, # 1
|
53
|
-
2, # 2
|
54
|
-
3 # 3
|
55
|
-
]
|
56
|
-
|
57
|
-
multi = ["lines", "are",
|
58
|
-
"super", "cool", "lol",
|
59
|
-
"amirite"]
|
60
|
-
|
61
|
-
# Uneven spacing
|
62
|
-
uneven = [1, 2, 3, 4, 5 ]
|
data/test/test_generator.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'bundler/setup'
|
4
|
-
|
5
|
-
require 'toml'
|
6
|
-
require 'minitest/autorun'
|
7
|
-
|
8
|
-
class TestGenerator < MiniTest::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
@doc = {
|
11
|
-
"integer" => 1,
|
12
|
-
"float" => 3.14159,
|
13
|
-
"true" => true,
|
14
|
-
"false" => false,
|
15
|
-
"string" => "hi",
|
16
|
-
"array" => [[1], [2], [3]],
|
17
|
-
"key" => {
|
18
|
-
"group" => {
|
19
|
-
"value" => "lol"
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_generator
|
27
|
-
body = TOML::Generator.new(@doc).body
|
28
|
-
|
29
|
-
doc_parsed = TOML::Parser.new(body).parsed
|
30
|
-
|
31
|
-
assert_equal @doc, doc_parsed
|
32
|
-
end
|
33
|
-
end
|
data/test/test_parser.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'bundler/setup'
|
4
|
-
|
5
|
-
require 'toml'
|
6
|
-
require 'minitest/autorun'
|
7
|
-
|
8
|
-
class TestParser < MiniTest::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
filepath = File.join(File.dirname(__FILE__), 'spec.toml')
|
11
|
-
@doc = TOML::Parser.new(File.read(filepath)).parsed
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_string
|
15
|
-
assert_equal "string\n\t\"string", @doc["strings"]["string"]
|
16
|
-
assert_equal "", @doc["strings"]["empty"]
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_integer
|
20
|
-
assert_equal 42, @doc["ints"]["simple"]
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_negative_integer
|
24
|
-
assert_equal -42, @doc["ints"]["negative"]
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_float
|
28
|
-
assert_equal 3.14159, @doc["floats"]["pi"]
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_negative_float
|
32
|
-
assert_equal -10.0, @doc["floats"]["negative"]
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_datetime
|
36
|
-
assert_equal DateTime.iso8601("1979-05-27T07:32:00Z"), @doc["datetimes"]["simple"]
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_booleans
|
40
|
-
assert_equal true, @doc["true"]
|
41
|
-
assert_equal false, @doc["false"]
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_simple_array
|
45
|
-
assert_equal [1, 2, 3], @doc["arrays"]["simple"]
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_nested_array
|
49
|
-
assert_equal [[1, 2], [3]], @doc["arrays"]["nested"]
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_multiline_arrays
|
53
|
-
assert_equal ["lines", "are", "super", "cool", "lol", "amirite"], @doc["arrays"]["multi"]
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_multiline_array
|
57
|
-
assert_equal @doc["arrays"]["multiline"], [1, 2, 3]
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_multiline_array_with_comments
|
61
|
-
assert_equal @doc["arrays"]["multiline_comments"], [1, 2, 3]
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_simple_keygroup
|
65
|
-
assert_equal "test", @doc["e"]["f"]
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_nested_keygroup
|
69
|
-
assert_equal "test", @doc["a"]["b"]["c"]["d"]
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_inline_comment
|
73
|
-
assert_equal "a line", @doc["comments"]["on"]
|
74
|
-
end
|
75
|
-
end
|
data/test/tmp.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'bundler/setup'
|
4
|
-
|
5
|
-
require 'toml'
|
6
|
-
|
7
|
-
doc = "
|
8
|
-
a = [true, false]
|
9
|
-
"
|
10
|
-
|
11
|
-
puts TOML.load(doc).inspect
|
12
|
-
|
13
|
-
# puts TOML.load("a = [[[[1]]]]")["a"].inspect
|
14
|
-
# puts "[[[[1]]]] <- expected"
|
15
|
-
#
|
16
|
-
# puts TOML.load("a = [1]")["a"].inspect
|
17
|
-
# puts "[1] <- expected"
|
18
|
-
#
|
19
|
-
# puts TOML.load("a = [1, 2, 3]")["a"].inspect
|
20
|
-
# puts "[1, 2, 3] <- expected"
|
21
|
-
#
|
22
|
-
# puts TOML.load("a = [[[1], 2], 3]")["a"].inspect
|
23
|
-
# puts "[[[1], 2], 3] <- expected"
|
24
|
-
#
|
25
|
-
# puts TOML.load("a = [[]]")["a"].inspect
|
data/toml.gemspec
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
## This is the rakegem gemspec template. Make sure you read and understand
|
2
|
-
## all of the comments. Some sections require modification, and others can
|
3
|
-
## be deleted if you don't need them. Once you understand the contents of
|
4
|
-
## this file, feel free to delete any comments that begin with two hash marks.
|
5
|
-
## You can find comprehensive Gem::Specification documentation, at
|
6
|
-
## http://docs.rubygems.org/read/chapter/20
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.specification_version = 2 if s.respond_to? :specification_version=
|
9
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
|
-
s.rubygems_version = '1.3.5'
|
11
|
-
|
12
|
-
## Leave these as is they will be modified for you by the rake gemspec task.
|
13
|
-
## If your rubyforge_project name is different, then edit it and comment out
|
14
|
-
## the sub! line in the Rakefile
|
15
|
-
s.name = 'toml'
|
16
|
-
s.version = '0.0.4'
|
17
|
-
s.date = '2013-03-28'
|
18
|
-
|
19
|
-
## Make sure your summary is short. The description may be as long
|
20
|
-
## as you like.
|
21
|
-
s.summary = "Parse your TOML."
|
22
|
-
s.description = "Parse your TOML, seriously."
|
23
|
-
|
24
|
-
## List the primary authors. If there are a bunch of authors, it's probably
|
25
|
-
## better to set the email to an email list or something. If you don't have
|
26
|
-
## a custom homepage, consider using your GitHub URL or the like.
|
27
|
-
s.authors = ["Jeremy McAnally", "Dirk Gadsden"]
|
28
|
-
s.email = 'jeremy@github.com'
|
29
|
-
s.homepage = 'http://github.com/jm/toml'
|
30
|
-
|
31
|
-
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
32
|
-
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
33
|
-
s.require_paths = %w[lib]
|
34
|
-
|
35
|
-
## Specify any RDoc options here. You'll want to add your README and
|
36
|
-
## LICENSE files to the extra_rdoc_files list.
|
37
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
38
|
-
s.extra_rdoc_files = %w[README.md LICENSE]
|
39
|
-
|
40
|
-
s.add_dependency 'parslet'
|
41
|
-
|
42
|
-
## Leave this section as-is. It will be automatically generated from the
|
43
|
-
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
44
|
-
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
45
|
-
# = MANIFEST =
|
46
|
-
s.files = %w[
|
47
|
-
Gemfile
|
48
|
-
LICENSE
|
49
|
-
README.md
|
50
|
-
Rakefile
|
51
|
-
lib/toml.rb
|
52
|
-
lib/toml/generator.rb
|
53
|
-
lib/toml/key.rb
|
54
|
-
lib/toml/key_group.rb
|
55
|
-
lib/toml/monkey_patch.rb
|
56
|
-
lib/toml/parser.rb
|
57
|
-
lib/toml/parslet.rb
|
58
|
-
lib/toml/transformer.rb
|
59
|
-
test/spec.toml
|
60
|
-
test/test_generator.rb
|
61
|
-
test/test_parser.rb
|
62
|
-
test/tmp.rb
|
63
|
-
toml.gemspec
|
64
|
-
]
|
65
|
-
# = MANIFEST =
|
66
|
-
|
67
|
-
## Test files will be grabbed from the file list. Make sure the path glob
|
68
|
-
## matches what you actually use.
|
69
|
-
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
70
|
-
end
|