win32-dir 0.3.5 → 0.3.6
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.
- data/CHANGES +8 -1
- data/MANIFEST +1 -1
- data/README +138 -141
- data/Rakefile +20 -11
- data/lib/win32/dir.rb +176 -171
- data/test/test_win32_dir.rb +356 -0
- data/win32-dir.gemspec +22 -24
- metadata +8 -8
- data/test/test_dir.rb +0 -353
data/win32-dir.gemspec
CHANGED
@@ -1,30 +1,28 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'win32-dir'
|
5
|
+
spec.version = '0.3.6'
|
6
|
+
spec.authors = ['Daniel J. Berger', 'Park Heesob']
|
7
|
+
spec.license = 'Artistic 2.0'
|
8
|
+
spec.email = 'djberg96@gmail.com'
|
9
|
+
spec.homepage = 'http://www.rubyforge.org/projects/win32utils'
|
10
|
+
spec.platform = Gem::Platform::RUBY
|
11
|
+
spec.summary = 'Extra constants and methods for the Dir class on Windows.'
|
12
|
+
spec.test_file = 'test/test_win32_dir.rb'
|
13
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
spec.rubyforge_project = 'win32utils'
|
16
|
+
spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
spec.add_dependency('windows-pr', '>= 1.0.9')
|
19
|
+
spec.add_development_dependency('test-unit', '>= 2.0.6')
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
spec.description = <<-EOF
|
22
|
+
The win32-dir library provides extra methods and constants for the
|
23
|
+
builtin Dir class. The constants provide a convenient way to identify
|
24
|
+
certain directories across all versions of Windows. Some methods have
|
25
|
+
been added, such as the ability to create junctions. Others have been
|
26
|
+
modified to provide a more consistent result for MS Windows.
|
27
|
+
EOF
|
28
28
|
end
|
29
|
-
|
30
|
-
Gem::Builder.new(spec).build
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-dir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2010-02-06 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
requirements:
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 0.9
|
24
|
+
version: 1.0.9
|
25
25
|
version:
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: test-unit
|
@@ -31,9 +31,9 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 2.0.
|
34
|
+
version: 2.0.6
|
35
35
|
version:
|
36
|
-
description: "
|
36
|
+
description: " The win32-dir library provides extra methods and constants for the\n builtin Dir class. The constants provide a convenient way to identify\n certain directories across all versions of Windows. Some methods have\n been added, such as the ability to create junctions. Others have been\n modified to provide a more consistent result for MS Windows.\n"
|
37
37
|
email: djberg96@gmail.com
|
38
38
|
executables: []
|
39
39
|
|
@@ -50,7 +50,7 @@ files:
|
|
50
50
|
- MANIFEST
|
51
51
|
- Rakefile
|
52
52
|
- README
|
53
|
-
- test/
|
53
|
+
- test/test_win32_dir.rb
|
54
54
|
- win32-dir.gemspec
|
55
55
|
has_rdoc: true
|
56
56
|
homepage: http://www.rubyforge.org/projects/win32utils
|
@@ -76,9 +76,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
requirements: []
|
77
77
|
|
78
78
|
rubyforge_project: win32utils
|
79
|
-
rubygems_version: 1.3.
|
79
|
+
rubygems_version: 1.3.5
|
80
80
|
signing_key:
|
81
81
|
specification_version: 3
|
82
82
|
summary: Extra constants and methods for the Dir class on Windows.
|
83
83
|
test_files:
|
84
|
-
- test/
|
84
|
+
- test/test_win32_dir.rb
|
data/test/test_dir.rb
DELETED
@@ -1,353 +0,0 @@
|
|
1
|
-
###########################################################################
|
2
|
-
# test_dir.rb
|
3
|
-
#
|
4
|
-
# Test suite for the win32-dir library. You should run this test case
|
5
|
-
# via the 'rake test' task.
|
6
|
-
###########################################################################
|
7
|
-
require 'rubygems'
|
8
|
-
gem 'test-unit'
|
9
|
-
|
10
|
-
require 'test/unit'
|
11
|
-
require 'win32/dir'
|
12
|
-
require 'fileutils'
|
13
|
-
|
14
|
-
class TC_Win32_Dir < Test::Unit::TestCase
|
15
|
-
def self.startup
|
16
|
-
@@test_home = File.dirname(File.expand_path(__FILE__))
|
17
|
-
end
|
18
|
-
|
19
|
-
def setup
|
20
|
-
Dir.chdir(@@test_home) unless File.basename(Dir.pwd) == 'test'
|
21
|
-
@@from = File.join(Dir.pwd, "test_from_directory")
|
22
|
-
|
23
|
-
@ascii_to = "test_to_directory"
|
24
|
-
@unicode_to = "Ελλάσ" # Greek - the word is 'Hellas'
|
25
|
-
@test_file = File.join(@@from, "test.txt")
|
26
|
-
Dir.mkdir(@@from)
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_version
|
30
|
-
assert_equal('0.3.5', Dir::VERSION)
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_create_junction_basic
|
34
|
-
assert_respond_to(Dir, :create_junction)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_create_junction_ascii
|
38
|
-
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
39
|
-
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
40
|
-
assert_equal(Dir.entries(@@from), Dir.entries(@ascii_to))
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_create_junction_unicode
|
44
|
-
assert_nothing_raised{ Dir.create_junction(@unicode_to, @@from) }
|
45
|
-
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
46
|
-
assert_equal(Dir.entries(@@from), Dir.entries(@unicode_to))
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_is_junction
|
50
|
-
assert_respond_to(Dir, :junction?)
|
51
|
-
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
52
|
-
assert_equal(false, Dir.junction?(@@from))
|
53
|
-
assert_equal(true, Dir.junction?(@ascii_to))
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_reparse_dir_alias
|
57
|
-
assert_respond_to(Dir, :reparse_dir?) # alias
|
58
|
-
assert_equal(true, Dir.method(:reparse_dir?) == Dir.method(:junction?))
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_is_empty
|
62
|
-
assert_respond_to(Dir, :empty?)
|
63
|
-
assert_equal(false, Dir.empty?("C:\\")) # One would think
|
64
|
-
assert_equal(true, Dir.empty?(@@from))
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_pwd_basic
|
68
|
-
assert_respond_to(Dir, :pwd)
|
69
|
-
assert_nothing_raised{ Dir.pwd }
|
70
|
-
assert_kind_of(String, Dir.pwd)
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_pwd_short_path
|
74
|
-
Dir.chdir("C:\\Progra~1")
|
75
|
-
assert_equal("C:\\Program Files", Dir.pwd)
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_pwd_long_path
|
79
|
-
Dir.chdir("C:\\Program Files")
|
80
|
-
assert_equal("C:\\Program Files", Dir.pwd)
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_pwd_caps
|
84
|
-
Dir.chdir("C:\\PROGRAM FILES")
|
85
|
-
assert_equal("C:\\Program Files", Dir.pwd)
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_pwd_forward_slash
|
89
|
-
Dir.chdir("C:/Program Files")
|
90
|
-
assert_equal("C:\\Program Files", Dir.pwd)
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_pwd_is_proper_alias
|
94
|
-
assert_true(Dir.method(:getwd) == Dir.method(:pwd))
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_admintools
|
98
|
-
assert_not_nil(Dir::ADMINTOOLS)
|
99
|
-
assert_kind_of(String, Dir::ADMINTOOLS)
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_altstartup
|
103
|
-
assert_not_nil(Dir::ALTSTARTUP)
|
104
|
-
assert_kind_of(String, Dir::ALTSTARTUP)
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_appdata
|
108
|
-
assert_not_nil(Dir::APPDATA)
|
109
|
-
assert_kind_of(String, Dir::APPDATA)
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_bitbucket
|
113
|
-
assert_not_nil(Dir::BITBUCKET)
|
114
|
-
assert_kind_of(String, Dir::BITBUCKET)
|
115
|
-
end
|
116
|
-
|
117
|
-
def test_cdburn_area
|
118
|
-
assert_not_nil(Dir::CDBURN_AREA)
|
119
|
-
assert_kind_of(String, Dir::CDBURN_AREA)
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_common_admintools
|
123
|
-
assert_not_nil(Dir::COMMON_ADMINTOOLS)
|
124
|
-
assert_kind_of(String, Dir::COMMON_ADMINTOOLS)
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_common_altstartup
|
128
|
-
assert_not_nil(Dir::COMMON_ALTSTARTUP)
|
129
|
-
assert_kind_of(String, Dir::COMMON_ALTSTARTUP)
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_common_appdata
|
133
|
-
assert_not_nil(Dir::COMMON_APPDATA)
|
134
|
-
assert_kind_of(String, Dir::COMMON_APPDATA)
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_common_desktopdirectory
|
138
|
-
assert_not_nil(Dir::COMMON_DESKTOPDIRECTORY)
|
139
|
-
assert_kind_of(String, Dir::COMMON_DESKTOPDIRECTORY)
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_common_documents
|
143
|
-
assert_not_nil(Dir::COMMON_DOCUMENTS)
|
144
|
-
assert_kind_of(String, Dir::COMMON_DOCUMENTS)
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_common_favorites
|
148
|
-
assert_not_nil(Dir::COMMON_FAVORITES)
|
149
|
-
assert_kind_of(String, Dir::COMMON_FAVORITES)
|
150
|
-
end
|
151
|
-
|
152
|
-
def test_common_music
|
153
|
-
assert_not_nil(Dir::COMMON_MUSIC)
|
154
|
-
assert_kind_of(String, Dir::COMMON_MUSIC)
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_common_pictures
|
158
|
-
assert_not_nil(Dir::COMMON_PICTURES)
|
159
|
-
assert_kind_of(String, Dir::COMMON_PICTURES)
|
160
|
-
end
|
161
|
-
|
162
|
-
def test_common_programs
|
163
|
-
assert_not_nil(Dir::COMMON_PROGRAMS)
|
164
|
-
assert_kind_of(String, Dir::COMMON_PROGRAMS)
|
165
|
-
end
|
166
|
-
|
167
|
-
def test_common_startmenu
|
168
|
-
assert_not_nil(Dir::COMMON_STARTMENU)
|
169
|
-
assert_kind_of(String, Dir::COMMON_STARTMENU)
|
170
|
-
end
|
171
|
-
|
172
|
-
def test_common_startup
|
173
|
-
assert_not_nil(Dir::COMMON_STARTUP)
|
174
|
-
assert_kind_of(String, Dir::COMMON_STARTUP)
|
175
|
-
end
|
176
|
-
|
177
|
-
def test_common_templates
|
178
|
-
assert_not_nil(Dir::COMMON_TEMPLATES)
|
179
|
-
assert_kind_of(String, Dir::COMMON_TEMPLATES)
|
180
|
-
end
|
181
|
-
|
182
|
-
def test_common_video
|
183
|
-
assert_not_nil(Dir::COMMON_VIDEO)
|
184
|
-
assert_kind_of(String, Dir::COMMON_VIDEO)
|
185
|
-
end
|
186
|
-
|
187
|
-
def test_controls
|
188
|
-
assert_not_nil(Dir::CONTROLS)
|
189
|
-
assert_kind_of(String, Dir::CONTROLS)
|
190
|
-
end
|
191
|
-
|
192
|
-
def test_cookies
|
193
|
-
assert_not_nil(Dir::COOKIES)
|
194
|
-
assert_kind_of(String, Dir::COOKIES)
|
195
|
-
end
|
196
|
-
|
197
|
-
def test_desktop
|
198
|
-
assert_not_nil(Dir::DESKTOP)
|
199
|
-
assert_kind_of(String, Dir::DESKTOP)
|
200
|
-
end
|
201
|
-
|
202
|
-
def test_desktopdirectory
|
203
|
-
assert_not_nil(Dir::DESKTOPDIRECTORY)
|
204
|
-
assert_kind_of(String, Dir::DESKTOPDIRECTORY)
|
205
|
-
end
|
206
|
-
|
207
|
-
def test_drives
|
208
|
-
assert_not_nil(Dir::DRIVES)
|
209
|
-
assert_kind_of(String, Dir::DRIVES)
|
210
|
-
end
|
211
|
-
|
212
|
-
def test_favorites
|
213
|
-
assert_not_nil(Dir::FAVORITES)
|
214
|
-
assert_kind_of(String, Dir::FAVORITES)
|
215
|
-
end
|
216
|
-
|
217
|
-
def test_fonts
|
218
|
-
assert_not_nil(Dir::FONTS)
|
219
|
-
assert_kind_of(String, Dir::FONTS)
|
220
|
-
end
|
221
|
-
|
222
|
-
def test_history
|
223
|
-
assert_not_nil(Dir::HISTORY)
|
224
|
-
assert_kind_of(String, Dir::HISTORY)
|
225
|
-
end
|
226
|
-
|
227
|
-
def test_internet
|
228
|
-
assert_not_nil(Dir::INTERNET)
|
229
|
-
assert_kind_of(String, Dir::INTERNET)
|
230
|
-
end
|
231
|
-
|
232
|
-
def test_internet_cache
|
233
|
-
assert_not_nil(Dir::INTERNET_CACHE)
|
234
|
-
assert_kind_of(String, Dir::INTERNET_CACHE)
|
235
|
-
end
|
236
|
-
|
237
|
-
def test_local_appdata
|
238
|
-
assert_not_nil(Dir::LOCAL_APPDATA)
|
239
|
-
assert_kind_of(String, Dir::LOCAL_APPDATA)
|
240
|
-
end
|
241
|
-
|
242
|
-
def test_mydocuments
|
243
|
-
assert_not_nil(Dir::MYDOCUMENTS)
|
244
|
-
assert_kind_of(String, Dir::MYDOCUMENTS)
|
245
|
-
end
|
246
|
-
|
247
|
-
def test_local_mymusic
|
248
|
-
assert_not_nil(Dir::MYMUSIC)
|
249
|
-
assert_kind_of(String, Dir::MYMUSIC)
|
250
|
-
end
|
251
|
-
|
252
|
-
def test_local_mypictures
|
253
|
-
assert_not_nil(Dir::MYPICTURES)
|
254
|
-
assert_kind_of(String, Dir::MYPICTURES)
|
255
|
-
end
|
256
|
-
|
257
|
-
def test_local_myvideo
|
258
|
-
assert_not_nil(Dir::MYVIDEO)
|
259
|
-
assert_kind_of(String, Dir::MYVIDEO)
|
260
|
-
end
|
261
|
-
|
262
|
-
def test_nethood
|
263
|
-
assert_not_nil(Dir::NETHOOD)
|
264
|
-
assert_kind_of(String, Dir::NETHOOD)
|
265
|
-
end
|
266
|
-
|
267
|
-
def test_network
|
268
|
-
assert_not_nil(Dir::NETWORK)
|
269
|
-
assert_kind_of(String, Dir::NETWORK)
|
270
|
-
end
|
271
|
-
|
272
|
-
def test_personal
|
273
|
-
assert_not_nil(Dir::PERSONAL)
|
274
|
-
assert_kind_of(String, Dir::PERSONAL)
|
275
|
-
end
|
276
|
-
|
277
|
-
def test_printers
|
278
|
-
assert_not_nil(Dir::PRINTERS)
|
279
|
-
assert_kind_of(String, Dir::PRINTERS)
|
280
|
-
end
|
281
|
-
|
282
|
-
def test_printhood
|
283
|
-
assert_not_nil(Dir::PRINTHOOD)
|
284
|
-
assert_kind_of(String, Dir::PRINTHOOD)
|
285
|
-
end
|
286
|
-
|
287
|
-
def test_profile
|
288
|
-
assert_not_nil(Dir::PROFILE)
|
289
|
-
assert_kind_of(String, Dir::PROFILE)
|
290
|
-
end
|
291
|
-
|
292
|
-
# Doesn't appear to actually exist
|
293
|
-
#def test_profiles
|
294
|
-
# assert_not_nil(Dir::PROFILES)
|
295
|
-
# assert_kind_of(String,Dir::PROFILES)
|
296
|
-
#end
|
297
|
-
|
298
|
-
def test_program_files
|
299
|
-
assert_not_nil(Dir::PROGRAM_FILES)
|
300
|
-
assert_kind_of(String, Dir::PROGRAM_FILES)
|
301
|
-
end
|
302
|
-
|
303
|
-
def test_program_files_common
|
304
|
-
assert_not_nil(Dir::PROGRAM_FILES_COMMON)
|
305
|
-
assert_kind_of(String, Dir::PROGRAM_FILES_COMMON)
|
306
|
-
end
|
307
|
-
|
308
|
-
def test_programs
|
309
|
-
assert_not_nil(Dir::PROGRAMS)
|
310
|
-
assert_kind_of(String, Dir::PROGRAMS)
|
311
|
-
end
|
312
|
-
|
313
|
-
def test_recent
|
314
|
-
assert_not_nil(Dir::RECENT)
|
315
|
-
assert_kind_of(String, Dir::RECENT)
|
316
|
-
end
|
317
|
-
|
318
|
-
def test_sendto
|
319
|
-
assert_not_nil(Dir::SENDTO)
|
320
|
-
assert_kind_of(String, Dir::SENDTO)
|
321
|
-
end
|
322
|
-
|
323
|
-
def test_startmenu
|
324
|
-
assert_not_nil(Dir::STARTMENU)
|
325
|
-
assert_kind_of(String, Dir::STARTMENU)
|
326
|
-
end
|
327
|
-
|
328
|
-
def test_startup
|
329
|
-
assert_not_nil(Dir::STARTUP)
|
330
|
-
assert_kind_of(String, Dir::STARTUP)
|
331
|
-
end
|
332
|
-
|
333
|
-
def test_system
|
334
|
-
assert_not_nil(Dir::SYSTEM)
|
335
|
-
assert_kind_of(String, Dir::SYSTEM)
|
336
|
-
end
|
337
|
-
|
338
|
-
def test_templates
|
339
|
-
assert_not_nil(Dir::TEMPLATES)
|
340
|
-
assert_kind_of(String, Dir::TEMPLATES)
|
341
|
-
end
|
342
|
-
|
343
|
-
def test_windows_dir
|
344
|
-
assert_not_nil(Dir::WINDOWS)
|
345
|
-
assert_kind_of(String, Dir::WINDOWS)
|
346
|
-
end
|
347
|
-
|
348
|
-
def teardown
|
349
|
-
FileUtils.rm_rf(@ascii_to)
|
350
|
-
FileUtils.rm_rf(@unicode_to)
|
351
|
-
FileUtils.rm_rf(@@from)
|
352
|
-
end
|
353
|
-
end
|