rbstarbound 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -5
- data/bin/rbstarbound +2 -9
- data/lib/rbstarbound/commands/dump.rb +35 -0
- data/lib/rbstarbound/commands/serialize.rb +39 -0
- data/lib/rbstarbound/exit_codes.rb +4 -0
- data/lib/rbstarbound/main_command.rb +22 -0
- data/lib/rbstarbound/player.rb +26 -0
- data/lib/rbstarbound/sbon.rb +133 -10
- data/lib/rbstarbound/sbvj01.rb +26 -18
- data/lib/rbstarbound/utils.rb +7 -0
- data/lib/rbstarbound/version.rb +1 -1
- data/lib/rbstarbound.rb +19 -5
- data/test/commands/dump_test.rb +19 -0
- data/test/commands/serialize_test.rb +19 -0
- data/test/data/1.3.3/test.yaml +3956 -0
- data/test/player_test.rb +17 -0
- data/test/rbstarbound_test.rb +0 -5
- data/test/sbvj01_test.rb +7 -3
- data/test/test_helper.rb +2 -0
- metadata +30 -2
data/test/player_test.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class PlayerTest < Minitest::Test
|
6
|
+
def test_it_changes_player_name
|
7
|
+
data = {
|
8
|
+
'identity' => {
|
9
|
+
'player_name' => 'John Doe'
|
10
|
+
}
|
11
|
+
}
|
12
|
+
new_name = 'changed'
|
13
|
+
player = RBStarbound::Player::Data.new('', 0, data)
|
14
|
+
player.player_name = new_name
|
15
|
+
assert_equal(player.player_name, new_name)
|
16
|
+
end
|
17
|
+
end
|
data/test/rbstarbound_test.rb
CHANGED
@@ -7,11 +7,6 @@ class RBStarboundTest < Minitest::Test
|
|
7
7
|
refute_nil ::RBStarbound::VERSION
|
8
8
|
end
|
9
9
|
|
10
|
-
def test_it_does_ping
|
11
|
-
expected_output = "Pong!\n"
|
12
|
-
assert_output(expected_output) { ::RBStarbound.ping }
|
13
|
-
end
|
14
|
-
|
15
10
|
def test_it_parses_save_file
|
16
11
|
expected_output = 'PlayerEntity'
|
17
12
|
output = ::RBStarbound.parse_player_save_file(SAVE_FILE_PATH)['name']
|
data/test/sbvj01_test.rb
CHANGED
@@ -5,9 +5,13 @@ require 'test_helper'
|
|
5
5
|
class SBVJ01Test < Minitest::Test
|
6
6
|
def test_it_raises_header_error
|
7
7
|
file = Tempfile.new('sbvj01_header_test_temp')
|
8
|
-
|
9
|
-
|
8
|
+
begin
|
9
|
+
assert_raises RBStarbound::SBVJ01Error do
|
10
|
+
::RBStarbound::SBVJ01.parse(file)
|
11
|
+
end
|
12
|
+
ensure
|
13
|
+
file.close
|
14
|
+
file.unlink
|
10
15
|
end
|
11
|
-
file.close
|
12
16
|
end
|
13
17
|
end
|
data/test/test_helper.rb
CHANGED
@@ -8,5 +8,7 @@ require 'minitest/autorun'
|
|
8
8
|
data_version = ENV['TEST_DATA_VERSION'] || '1.3.3'
|
9
9
|
|
10
10
|
SAVE_FILE_PATH = File.expand_path("test/data/#{data_version}/test.player")
|
11
|
+
YAML_FILE_PATH = File.expand_path("test/data/#{data_version}/test.yaml")
|
11
12
|
|
12
13
|
ERROR_MSG = 'An error occured: '
|
14
|
+
DATA_COUNT = 10
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbstarbound
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleh Fedorenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: clamp
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,11 +78,21 @@ files:
|
|
64
78
|
- README.md
|
65
79
|
- bin/rbstarbound
|
66
80
|
- lib/rbstarbound.rb
|
81
|
+
- lib/rbstarbound/commands/dump.rb
|
82
|
+
- lib/rbstarbound/commands/serialize.rb
|
67
83
|
- lib/rbstarbound/exceptions.rb
|
84
|
+
- lib/rbstarbound/exit_codes.rb
|
85
|
+
- lib/rbstarbound/main_command.rb
|
86
|
+
- lib/rbstarbound/player.rb
|
68
87
|
- lib/rbstarbound/sbon.rb
|
69
88
|
- lib/rbstarbound/sbvj01.rb
|
89
|
+
- lib/rbstarbound/utils.rb
|
70
90
|
- lib/rbstarbound/version.rb
|
91
|
+
- test/commands/dump_test.rb
|
92
|
+
- test/commands/serialize_test.rb
|
71
93
|
- test/data/1.3.3/test.player
|
94
|
+
- test/data/1.3.3/test.yaml
|
95
|
+
- test/player_test.rb
|
72
96
|
- test/rbstarbound_test.rb
|
73
97
|
- test/sbvj01_test.rb
|
74
98
|
- test/test_helper.rb
|
@@ -97,7 +121,11 @@ signing_key:
|
|
97
121
|
specification_version: 4
|
98
122
|
summary: A simple gem/library for working with Starbound files.
|
99
123
|
test_files:
|
124
|
+
- test/player_test.rb
|
100
125
|
- test/sbvj01_test.rb
|
101
126
|
- test/data/1.3.3/test.player
|
127
|
+
- test/data/1.3.3/test.yaml
|
102
128
|
- test/rbstarbound_test.rb
|
129
|
+
- test/commands/dump_test.rb
|
130
|
+
- test/commands/serialize_test.rb
|
103
131
|
- test/test_helper.rb
|