vdf 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/gempush.yml +12 -0
- data/README.md +3 -0
- data/lib/vdf/generate.rb +15 -13
- data/lib/vdf/parse.rb +2 -2
- data/lib/vdf/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d59421040845ace586a5c85a1bd21f04197956ecf167864ce816e76fb2f1313
|
4
|
+
data.tar.gz: c11b0824a64d2d5c83fedffe3cfefdf75739528d42844b899e8e820d600dbc48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acbbf17141f9d37ceb9afa01a6ce343f3769e18c56b411afd70a4b23d04cdc4c83db9d6907476da71115a0514d3f1a9e0319e333d1e1f9a6334027bd56fcf407
|
7
|
+
data.tar.gz: 29a20503e1a355834385e07f303ade165a52b1f6479a6b16e55b4e1af188a088bdf5e9c6b63985104c77646455d89174a783aeb4838d4918d81b0d68b2475fcb
|
@@ -20,6 +20,18 @@ jobs:
|
|
20
20
|
with:
|
21
21
|
version: 2.6.x
|
22
22
|
|
23
|
+
- name: Publish to GPR
|
24
|
+
run: |
|
25
|
+
mkdir -p $HOME/.gem
|
26
|
+
touch $HOME/.gem/credentials
|
27
|
+
chmod 0600 $HOME/.gem/credentials
|
28
|
+
printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
29
|
+
gem build *.gemspec
|
30
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
31
|
+
env:
|
32
|
+
GEM_HOST_API_KEY: ${{secrets.GPR_AUTH_TOKEN}}
|
33
|
+
OWNER: sapphyrus
|
34
|
+
|
23
35
|
- name: Publish to RubyGems
|
24
36
|
run: |
|
25
37
|
mkdir -p $HOME/.gem
|
data/README.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
VDF is a gem to convert Valve's KeyValue format to ruby hashes and back, based on the excellent [node-steam/vdf](https://github.com/node-steam/vdf)
|
4
4
|
|
5
|
+
[](https://actions-badge.atrox.dev/sapphyrus/vdf/goto)
|
6
|
+
[](https://rubygems.org/gems/vdf)
|
7
|
+
|
5
8
|
## Installation
|
6
9
|
|
7
10
|
Add this line to your application's Gemfile:
|
data/lib/vdf/generate.rb
CHANGED
@@ -1,28 +1,30 @@
|
|
1
1
|
module VDF
|
2
2
|
class Generator
|
3
|
-
|
3
|
+
class << self
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
end
|
5
|
+
def generate(object)
|
6
|
+
raise ArgumentError, "Object has to respond to each" unless object.respond_to? :each
|
8
7
|
|
9
|
-
|
8
|
+
generate_impl(object, 0)
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
result = ""
|
13
|
-
indent = -"\t"*level
|
11
|
+
private
|
14
12
|
|
15
|
-
|
13
|
+
def generate_impl(object, level)
|
14
|
+
result = ""
|
15
|
+
indent = -"\t"*level
|
16
|
+
|
17
|
+
object.each do |key, value|
|
16
18
|
if value.respond_to? :each
|
17
19
|
result << [indent, -'"', key, -"\"\n", indent, -"{\n", generate_impl(value, level + 1), indent, -"}\n"].join
|
18
20
|
else
|
19
21
|
result << [indent, -'"', key, -'"', indent, indent, -'"', value.to_s, -"\"\n"].join
|
20
22
|
end
|
21
|
-
|
23
|
+
end
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
result
|
26
|
+
end
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
def generate(object)
|
data/lib/vdf/parse.rb
CHANGED
@@ -30,7 +30,7 @@ module VDF
|
|
30
30
|
expect = false
|
31
31
|
next
|
32
32
|
elsif expect
|
33
|
-
raise ParserError, "Invalid syntax on line #{i+1}
|
33
|
+
raise ParserError, "Invalid syntax on line #{i+1}"
|
34
34
|
end
|
35
35
|
|
36
36
|
if line.start_with?(-'}')
|
@@ -41,7 +41,7 @@ module VDF
|
|
41
41
|
loop do
|
42
42
|
m = REGEX.match(line)
|
43
43
|
if m.nil?
|
44
|
-
raise ParserError, "Invalid syntax on line #{i+1}
|
44
|
+
raise ParserError, "Invalid syntax on line #{i+1}"
|
45
45
|
end
|
46
46
|
|
47
47
|
key = m[2] || m[3]
|
data/lib/vdf/version.rb
CHANGED