troml 0.1.2 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Cargo.lock +48 -0
- data/Gemfile.lock +10 -1
- data/Rakefile +6 -0
- data/lib/troml/version.rb +1 -1
- data/lib/troml.rb +18 -1
- metadata +3 -4
- data/exe/troml +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8afe995854ad17cc3e856060bf1f0bb3fb599ab6ee19bc40a2edc6b3e67ce3e
|
4
|
+
data.tar.gz: b595b1c64e7d041e73bbb3bafb5899225388102254c6beb65c04cf34a099a84c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b89faf9e6f1397d039f01e26ccf37c27cd018f1ded736e554fbf7a97a218138a38d280a9fff3e59184fb3c0e3b13692b59d02a23793891e1f922ad15df4cb88c
|
7
|
+
data.tar.gz: 438d8f30031bb21d8e68c8cafe1aaefbec42a78e1b5740982ae04e515897fe10c931d03a7877fe03be07d90fce4c85e67fd21217c555f498f1278fda2ec63396
|
data/Cargo.lock
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
2
|
+
# It is not intended for manual editing.
|
3
|
+
version = 3
|
4
|
+
|
5
|
+
[[package]]
|
6
|
+
name = "lazy_static"
|
7
|
+
version = "1.4.0"
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
+
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
10
|
+
|
11
|
+
[[package]]
|
12
|
+
name = "libc"
|
13
|
+
version = "0.2.126"
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
15
|
+
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
16
|
+
|
17
|
+
[[package]]
|
18
|
+
name = "rutie"
|
19
|
+
version = "0.8.4"
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
21
|
+
checksum = "5d97db4cbb9739b48364c38cc9a6ebabdc07b42bd87b60ab448e1f29eaebb2ac"
|
22
|
+
dependencies = [
|
23
|
+
"lazy_static",
|
24
|
+
"libc",
|
25
|
+
]
|
26
|
+
|
27
|
+
[[package]]
|
28
|
+
name = "serde"
|
29
|
+
version = "1.0.137"
|
30
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
31
|
+
checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
|
32
|
+
|
33
|
+
[[package]]
|
34
|
+
name = "toml"
|
35
|
+
version = "0.5.9"
|
36
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
37
|
+
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
|
38
|
+
dependencies = [
|
39
|
+
"serde",
|
40
|
+
]
|
41
|
+
|
42
|
+
[[package]]
|
43
|
+
name = "troml"
|
44
|
+
version = "0.1.0"
|
45
|
+
dependencies = [
|
46
|
+
"rutie",
|
47
|
+
"toml",
|
48
|
+
]
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
troml (0.1.
|
4
|
+
troml (0.1.4)
|
5
5
|
rutie (~> 0.0.4)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
|
+
debug (1.5.0)
|
12
|
+
irb (>= 1.3.6)
|
13
|
+
reline (>= 0.2.7)
|
11
14
|
gem-release (2.2.2)
|
15
|
+
io-console (0.5.11)
|
16
|
+
irb (1.4.1)
|
17
|
+
reline (>= 0.3.0)
|
12
18
|
minitest (5.16.0)
|
13
19
|
parallel (1.22.1)
|
14
20
|
parser (3.1.2.0)
|
@@ -16,6 +22,8 @@ GEM
|
|
16
22
|
rainbow (3.1.1)
|
17
23
|
rake (13.0.6)
|
18
24
|
regexp_parser (2.5.0)
|
25
|
+
reline (0.3.0)
|
26
|
+
io-console (~> 0.5)
|
19
27
|
rexml (3.2.5)
|
20
28
|
rubocop (1.29.1)
|
21
29
|
parallel (~> 1.10)
|
@@ -45,6 +53,7 @@ PLATFORMS
|
|
45
53
|
x86_64-linux
|
46
54
|
|
47
55
|
DEPENDENCIES
|
56
|
+
debug
|
48
57
|
gem-release (~> 2.2.2)
|
49
58
|
minitest (~> 5.0)
|
50
59
|
rake (~> 13.0)
|
data/Rakefile
CHANGED
data/lib/troml/version.rb
CHANGED
data/lib/troml.rb
CHANGED
@@ -17,7 +17,24 @@ module Troml
|
|
17
17
|
class ExtParseError < Error; end
|
18
18
|
|
19
19
|
# Initialize external library
|
20
|
-
|
20
|
+
#
|
21
|
+
# This is a hack to work around the weirdness of developing
|
22
|
+
# a Rust extension while relying on Rubygems' native Cargo builder.
|
23
|
+
# Rubygems builds copies the shared object into the gem's lib directory
|
24
|
+
# when gem install is run, so it's available for loading in.
|
25
|
+
#
|
26
|
+
# However, while developing the gem, we want to be able to run the gem from its
|
27
|
+
# source context, so we rely on Rutie's convention of loading the shared object
|
28
|
+
# built by Cargo.
|
29
|
+
if File.exist?(File.join(__dir__, "troml.so"))
|
30
|
+
# We are running in "installed" mode.
|
31
|
+
# Load the shared object built by rubygems.
|
32
|
+
require "troml.so"
|
33
|
+
else
|
34
|
+
# Otherwise we are running in "dev" mode.
|
35
|
+
# Load the target/release object via Rutie.
|
36
|
+
Rutie.new(:troml).init "Init_troml", __dir__
|
37
|
+
end
|
21
38
|
|
22
39
|
# Returns a hash representation of the TOML string passed.
|
23
40
|
# Raises on parse failure.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: troml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pawan Dubey
|
@@ -55,8 +55,7 @@ dependencies:
|
|
55
55
|
description: Blazing fast TOML parser, with the power of Rust.
|
56
56
|
email:
|
57
57
|
- git@pawandubey.com
|
58
|
-
executables:
|
59
|
-
- troml
|
58
|
+
executables: []
|
60
59
|
extensions:
|
61
60
|
- Cargo.toml
|
62
61
|
extra_rdoc_files: []
|
@@ -66,13 +65,13 @@ files:
|
|
66
65
|
- ".standard.yml"
|
67
66
|
- CHANGELOG.md
|
68
67
|
- CODE_OF_CONDUCT.md
|
68
|
+
- Cargo.lock
|
69
69
|
- Cargo.toml
|
70
70
|
- Gemfile
|
71
71
|
- Gemfile.lock
|
72
72
|
- LICENSE.txt
|
73
73
|
- README.md
|
74
74
|
- Rakefile
|
75
|
-
- exe/troml
|
76
75
|
- lib/troml.rb
|
77
76
|
- lib/troml/version.rb
|
78
77
|
- sig/troml.rbs
|
data/exe/troml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "troml"
|
6
|
-
require "json"
|
7
|
-
|
8
|
-
def tag(val)
|
9
|
-
case val
|
10
|
-
when String
|
11
|
-
{type: "string", value: val}
|
12
|
-
when Integer
|
13
|
-
{type: "integer", value: val}
|
14
|
-
when Float
|
15
|
-
{type: "float", value: val}
|
16
|
-
when TrueClass, FalseClass
|
17
|
-
{type: "bool", value: val}
|
18
|
-
when Array
|
19
|
-
val.map { |e| tag(e) }
|
20
|
-
when Hash
|
21
|
-
val.transform_values { |v| tag(v) }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
raw_toml = ARGF.read
|
26
|
-
|
27
|
-
parsed_toml = Troml.parse(raw_toml)
|
28
|
-
|
29
|
-
tagged_hash = tag(parsed_toml)
|
30
|
-
|
31
|
-
puts tagged_hash.to_json
|