revolt 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/revolt/level.rb +1 -1
- data/lib/revolt/levels.rb +2 -2
- data/lib/revolt/package/archive/analyzer.rb +2 -1
- data/lib/revolt.rb +1 -1
- data/test/common.rb +12 -2
- data/test/fixtures/files/levels_ok_invalid_files.zip +0 -0
- data/test/fixtures/files/tmp/gfx/{levid.bmp → userXXX.bmp} +0 -0
- data/test/fixtures/files/tmp/gfx/{levid.bmq → userXXX.bmq} +0 -0
- data/test/fixtures/files/tmp/levels/levid/{levid.inf → UserXXX.inf} +0 -0
- data/test/fixtures/files/tmp/levels/levid/{Full Custom.inf → uSerXxx.w} +0 -0
- data/test/fixtures/files/tmp/levels/levid/{install/nhood1.fob → usErXxXa.bmp} +0 -0
- data/test/fixtures/{files/tmp/levels/levid/install/nhood1.inf → rv/gfx/userXXX.bmp} +0 -0
- data/test/fixtures/{files/tmp/levels/levid/levid.w → rv/gfx/userXXX.bmq} +0 -0
- data/test/fixtures/rv/levels/userxxx/UserXXX.inf +20 -0
- data/test/fixtures/{files/tmp/levels/levid/levida.bmp → rv/levels/userxxx/readme.txt} +0 -0
- data/test/fixtures/{files/tmp/levels/levid/models/ball.m → rv/levels/userxxx/uSerXxx.w} +0 -0
- data/test/fixtures/{files/tmp/levels/levid/sfx/3d sounds/birds1.wav → rv/levels/userxxx/usErXxXa.bmp} +0 -0
- data/test/tc_level_installer.rb +22 -0
- data/test/tc_level_package.rb +2 -2
- data/test/tc_levels.rb +43 -0
- metadata +15 -17
data/lib/revolt/level.rb
CHANGED
data/lib/revolt/levels.rb
CHANGED
@@ -329,11 +329,11 @@ module ReVolt
|
|
329
329
|
# Try replacing the start of the match
|
330
330
|
# with each known id and see if the
|
331
331
|
# result is a match
|
332
|
-
filebase = f.basename.to_s
|
332
|
+
filebase = f.basename.to_s.downcase
|
333
333
|
debug("rename_level: inspecting #{filebase}")
|
334
334
|
trymatch = filebase[0...oldid.to_s.size]
|
335
335
|
if filebase[0...oldid.to_s.size] == oldid.to_s
|
336
|
-
nfname = f.basename.to_s.sub(/^#{oldid}
|
336
|
+
nfname = f.basename.to_s.sub(/^#{oldid}/i, newid.to_s)
|
337
337
|
nf = base_path + f.dirname + nfname
|
338
338
|
of = base_path + f
|
339
339
|
debug("rename_level: #{of} -> #{nf}")
|
@@ -15,7 +15,8 @@ module ReVolt::Package::Archive
|
|
15
15
|
|
16
16
|
browser.each do |entry|
|
17
17
|
case entry.to_s
|
18
|
-
when /levels
|
18
|
+
when /levels\/([^\/]+)\/\1.inf/i: looks_like.add :normalized
|
19
|
+
# when /levels\//i: looks_like.add :normalized
|
19
20
|
when /.inf$/i: possible_infs.add entry
|
20
21
|
end
|
21
22
|
end
|
data/lib/revolt.rb
CHANGED
data/test/common.rb
CHANGED
@@ -18,17 +18,21 @@ module ReVolt
|
|
18
18
|
# Zips inside, same name
|
19
19
|
:zips_inside_sn => 'zips_inside_sn.zip',
|
20
20
|
:rickyd_style => 'rickyd_track.zip',
|
21
|
-
:nodirs_style => 'nodirs_track.zip'
|
21
|
+
:nodirs_style => 'nodirs_track.zip',
|
22
|
+
:levels_ok_invalid_files => 'levels_ok_invalid_files.zip'
|
22
23
|
}
|
23
24
|
ZIPS_IDS = {
|
24
25
|
:standard => [:levid],
|
25
|
-
:standard_full => [:levid]
|
26
|
+
:standard_full => [:levid],
|
27
|
+
:levels_ok_invalid_files => [:userxxx]
|
26
28
|
}
|
27
29
|
|
28
30
|
module_function
|
29
31
|
|
30
32
|
def setup
|
33
|
+
puts "common setup called"
|
31
34
|
@output_dir = Pathname.new(File.dirname(__FILE__)) + 'temp_out'
|
35
|
+
@rv_base_dir = Pathname.new(get_test_output_dir('rv'))# @output_dir + 'rv';
|
32
36
|
clean_working_dir
|
33
37
|
@output_dir.mkdir
|
34
38
|
end
|
@@ -55,6 +59,12 @@ module ReVolt
|
|
55
59
|
t.to_s
|
56
60
|
end
|
57
61
|
|
62
|
+
def installed_tracks(at = nil)
|
63
|
+
at ||= @rv_base_dir
|
64
|
+
dir = ReVolt::Util::FsBrowser.new(at)
|
65
|
+
dir.map {|f| Pathname.new(f).relative_path_from(at).to_s}
|
66
|
+
end
|
67
|
+
|
58
68
|
def stringify_and_order_structure(c)
|
59
69
|
operation_and_order_structure(c) {|a|
|
60
70
|
a = a.to_s
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
;----------------------------
|
2
|
+
; Revolt .INF file structure
|
3
|
+
;----------------------------
|
4
|
+
|
5
|
+
NAME 'Level ID'
|
6
|
+
STARTPOS 0.000000 -900.000000 0.000000
|
7
|
+
STARTPOSREV 0 0 0
|
8
|
+
STARTROT 0.80000
|
9
|
+
STARTROTREV 0.0
|
10
|
+
STARTGRID 3
|
11
|
+
STARTGRIDREV 0
|
12
|
+
FARCLIP 24000
|
13
|
+
FOGSTART 1500
|
14
|
+
FOGCOLOR 200 145 65
|
15
|
+
VERTFOGSTART 3000
|
16
|
+
VERTFOGEND 6000
|
17
|
+
WORLDRGBPER 100
|
18
|
+
MODELRGBPER 100
|
19
|
+
INSTANCERGBPER 100
|
20
|
+
REDBOOK 13 13
|
File without changes
|
File without changes
|
File without changes
|
data/test/tc_level_installer.rb
CHANGED
@@ -199,4 +199,26 @@ class LevelInstaller < Test::Unit::TestCase
|
|
199
199
|
stringify_and_order_structure(result))
|
200
200
|
end
|
201
201
|
|
202
|
+
def test_levels_ok_invalid_files
|
203
|
+
zip_id = :levels_ok_invalid_files
|
204
|
+
ids = @levels.install(get_test_file(ZIPS[zip_id]), @output_dir)
|
205
|
+
result = installed_tracks
|
206
|
+
expect = %w(
|
207
|
+
gfx
|
208
|
+
gfx/userXXX.bmp
|
209
|
+
gfx/userXXX.bmq
|
210
|
+
levels
|
211
|
+
levels/userxxx
|
212
|
+
levels/userxxx/UserXXX.inf
|
213
|
+
levels/userxxx/uSerXxx.w
|
214
|
+
levels/userxxx/usErXxXa.bmp
|
215
|
+
levels/userxxx/readme.txt
|
216
|
+
)
|
217
|
+
|
218
|
+
assert_equal(stringify_and_order_structure(expect),
|
219
|
+
stringify_and_order_structure(result))
|
220
|
+
assert_equal(stringify_and_order_structure(ids),
|
221
|
+
stringify_and_order_structure(ZIPS_IDS[zip_id]))
|
222
|
+
end
|
223
|
+
|
202
224
|
end
|
data/test/tc_level_package.rb
CHANGED
@@ -60,7 +60,7 @@ class LevelPackage < Test::Unit::TestCase
|
|
60
60
|
def do_package_test(src_pkg)
|
61
61
|
# zip_id = :standard
|
62
62
|
package = @rv_package_dir + src_pkg
|
63
|
-
ids1 = @levels1.install(get_test_file(src_pkg), @rv_base_dir1)
|
63
|
+
ids1 = @levels1.install(get_test_file(src_pkg)) # , @rv_base_dir1)
|
64
64
|
result1 = installed_tracks(@rv_base_dir1)
|
65
65
|
|
66
66
|
# Create package
|
@@ -74,7 +74,7 @@ class LevelPackage < Test::Unit::TestCase
|
|
74
74
|
|
75
75
|
# Then ensure the package can be installed and results
|
76
76
|
# in same files and ids
|
77
|
-
ids2 = @levels2.install(get_test_file(src_pkg), @rv_base_dir2)
|
77
|
+
ids2 = @levels2.install(get_test_file(src_pkg)) # , @rv_base_dir2)
|
78
78
|
result3 = installed_tracks(@rv_base_dir2)
|
79
79
|
assert_equal(ids1, ids2)
|
80
80
|
assert_equal(stringify_and_order_structure(result1),
|
data/test/tc_levels.rb
CHANGED
@@ -66,4 +66,47 @@ class LevelsTest < Test::Unit::TestCase
|
|
66
66
|
@level.parent = nil
|
67
67
|
assert_raise(RuntimeError) { @level.reload }
|
68
68
|
end
|
69
|
+
|
70
|
+
def test_level_rename
|
71
|
+
zip_id = :levels_ok_invalid_files
|
72
|
+
levels = ReVolt::Levels.new(@rv_base_dir)
|
73
|
+
levels.create_dir_structure
|
74
|
+
|
75
|
+
ids = levels.install(get_test_file(ZIPS[zip_id])) # , @output_dir)
|
76
|
+
result = installed_tracks
|
77
|
+
expect = %w(
|
78
|
+
gfx
|
79
|
+
gfx/userXXX.bmp
|
80
|
+
gfx/userXXX.bmq
|
81
|
+
levels
|
82
|
+
levels/userxxx
|
83
|
+
levels/userxxx/UserXXX.inf
|
84
|
+
levels/userxxx/uSerXxx.w
|
85
|
+
levels/userxxx/readme.txt
|
86
|
+
levels/userxxx/usErXxXa.bmp
|
87
|
+
)
|
88
|
+
|
89
|
+
assert_equal(stringify_and_order_structure(expect),
|
90
|
+
stringify_and_order_structure(result))
|
91
|
+
assert_equal(stringify_and_order_structure(ids),
|
92
|
+
stringify_and_order_structure(ZIPS_IDS[zip_id]))
|
93
|
+
ReVolt::Logger::enable
|
94
|
+
levels.rename(:userxxx, :renamedlevel)
|
95
|
+
|
96
|
+
result = installed_tracks
|
97
|
+
expect = %w(
|
98
|
+
gfx
|
99
|
+
gfx/renamedlevel.bmp
|
100
|
+
gfx/renamedlevel.bmq
|
101
|
+
levels
|
102
|
+
levels/renamedlevel
|
103
|
+
levels/renamedlevel/renamedlevel.inf
|
104
|
+
levels/renamedlevel/renamedlevel.w
|
105
|
+
levels/renamedlevel/renamedlevela.bmp
|
106
|
+
levels/renamedlevel/readme.txt
|
107
|
+
)
|
108
|
+
|
109
|
+
assert_equal(stringify_and_order_structure(expect),
|
110
|
+
stringify_and_order_structure(result))
|
111
|
+
end
|
69
112
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: revolt
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.8.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.8.3
|
7
|
+
date: 2007-04-04 00:00:00 +03:00
|
8
8
|
summary: Library for managing Re-Volt game, and some Commandline tools
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- Rakefile
|
80
80
|
- test/fixtures/files
|
81
81
|
- test/fixtures/rv
|
82
|
+
- test/fixtures/files/levels_ok_invalid_files.zip
|
82
83
|
- test/fixtures/files/nodirs_track.zip
|
83
84
|
- test/fixtures/files/readme.txt
|
84
85
|
- test/fixtures/files/rickyd_track.zip
|
@@ -91,23 +92,13 @@ files:
|
|
91
92
|
- test/fixtures/files/zips_inside_sn.zip
|
92
93
|
- test/fixtures/files/tmp/gfx
|
93
94
|
- test/fixtures/files/tmp/levels
|
94
|
-
- test/fixtures/files/tmp/gfx/
|
95
|
-
- test/fixtures/files/tmp/gfx/
|
95
|
+
- test/fixtures/files/tmp/gfx/userXXX.bmp
|
96
|
+
- test/fixtures/files/tmp/gfx/userXXX.bmq
|
96
97
|
- test/fixtures/files/tmp/levels/levid
|
97
|
-
- test/fixtures/files/tmp/levels/levid/Full Custom.inf
|
98
|
-
- test/fixtures/files/tmp/levels/levid/install
|
99
|
-
- test/fixtures/files/tmp/levels/levid/levid.inf
|
100
|
-
- test/fixtures/files/tmp/levels/levid/levid.w
|
101
|
-
- test/fixtures/files/tmp/levels/levid/levida.bmp
|
102
|
-
- test/fixtures/files/tmp/levels/levid/models
|
103
98
|
- test/fixtures/files/tmp/levels/levid/readme.txt
|
104
|
-
- test/fixtures/files/tmp/levels/levid/
|
105
|
-
- test/fixtures/files/tmp/levels/levid/
|
106
|
-
- test/fixtures/files/tmp/levels/levid/
|
107
|
-
- test/fixtures/files/tmp/levels/levid/install/nhood1.inf
|
108
|
-
- test/fixtures/files/tmp/levels/levid/models/ball.m
|
109
|
-
- test/fixtures/files/tmp/levels/levid/sfx/3d sounds
|
110
|
-
- test/fixtures/files/tmp/levels/levid/sfx/3d sounds/birds1.wav
|
99
|
+
- test/fixtures/files/tmp/levels/levid/UserXXX.inf
|
100
|
+
- test/fixtures/files/tmp/levels/levid/uSerXxx.w
|
101
|
+
- test/fixtures/files/tmp/levels/levid/usErXxXa.bmp
|
111
102
|
- test/fixtures/rv/gfx
|
112
103
|
- test/fixtures/rv/levels
|
113
104
|
- test/fixtures/rv/gfx/levid.bmp
|
@@ -115,10 +106,13 @@ files:
|
|
115
106
|
- test/fixtures/rv/gfx/levidrev.bmp
|
116
107
|
- test/fixtures/rv/gfx/levidrev.bmq
|
117
108
|
- test/fixtures/rv/gfx/tEsT Level.bmp
|
109
|
+
- test/fixtures/rv/gfx/userXXX.bmp
|
110
|
+
- test/fixtures/rv/gfx/userXXX.bmq
|
118
111
|
- test/fixtures/rv/levels/inf_missing_level
|
119
112
|
- test/fixtures/rv/levels/levid
|
120
113
|
- test/fixtures/rv/levels/levidrev
|
121
114
|
- test/fixtures/rv/levels/test lEveL
|
115
|
+
- test/fixtures/rv/levels/userxxx
|
122
116
|
- test/fixtures/rv/levels/levid/levid.inf
|
123
117
|
- test/fixtures/rv/levels/levid/levid.w
|
124
118
|
- test/fixtures/rv/levels/levid/levida.bmp
|
@@ -141,6 +135,10 @@ files:
|
|
141
135
|
- test/fixtures/rv/levels/test lEveL/reversed/TEst level.inf
|
142
136
|
- test/fixtures/rv/levels/test lEveL/reversed/TeST level.w
|
143
137
|
- test/fixtures/rv/levels/test lEveL/reversed/test LEVELa.bmp
|
138
|
+
- test/fixtures/rv/levels/userxxx/readme.txt
|
139
|
+
- test/fixtures/rv/levels/userxxx/UserXXX.inf
|
140
|
+
- test/fixtures/rv/levels/userxxx/uSerXxx.w
|
141
|
+
- test/fixtures/rv/levels/userxxx/usErXxXa.bmp
|
144
142
|
- README
|
145
143
|
test_files:
|
146
144
|
- test/ts_base.rb
|