win32-file-stat 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +9 -0
- data/README +20 -16
- data/lib/win32/file/stat.rb +14 -6
- data/test/test_file_stat.rb +11 -5
- data/win32-file-stat.gemspec +27 -21
- metadata +11 -10
data/CHANGES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 1.3.4 - 13-Aug-2009
|
2
|
+
* Changed license to Artistic 2.0.
|
3
|
+
* Some gemspec updates, including the addition of a license, an updated
|
4
|
+
description, and changing test-unit from a runtime dependency to a
|
5
|
+
development dependency.
|
6
|
+
* Some documentation updates, mostly to make certain things invisible that
|
7
|
+
aren't meant for public consumption.
|
8
|
+
* One test now skipped on 64-bit versions of Windows.
|
9
|
+
|
1
10
|
== 1.3.3 - 9-Feb-2009
|
2
11
|
* Fixed a bug where File::Stat.new failed on locked files. Thanks go to
|
3
12
|
Montgomery Kosma for the spot.
|
data/README
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
|
1
|
+
== Description
|
2
2
|
A redefinition of the File::Stat class for MS Windows.
|
3
3
|
|
4
|
-
|
4
|
+
== Prerequisites
|
5
5
|
* Ruby 1.8.2 or later.
|
6
6
|
* windows-pr 0.9.1 or later.
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
== Installation
|
9
|
+
=== Remote Installation
|
10
10
|
gem install win32-file-stat
|
11
11
|
|
12
|
-
|
13
|
-
rake install
|
12
|
+
=== Local Installation
|
13
|
+
rake install
|
14
14
|
|
15
|
-
|
15
|
+
== Synopsis
|
16
16
|
# Don't 'require' like this in practice - see 'Known Issues' below
|
17
17
|
require 'win32/file/stat'
|
18
18
|
|
@@ -21,7 +21,7 @@ rake install (non-gem) OR rake install_gem (gems)
|
|
21
21
|
stat.readonly?
|
22
22
|
stat.hidden?
|
23
23
|
|
24
|
-
|
24
|
+
== Differences between Ruby's File::Stat and this version:
|
25
25
|
* The File::Stat#blksize method returns a meaningful value.
|
26
26
|
* The File::Stat#blockdev method works more accurately.
|
27
27
|
* The File::Stat#blocks method returns a meaningful value.
|
@@ -39,7 +39,7 @@ rake install (non-gem) OR rake install_gem (gems)
|
|
39
39
|
hidden, etc.
|
40
40
|
* The inspect and pretty print output has been customized.
|
41
41
|
|
42
|
-
|
42
|
+
== Known issues
|
43
43
|
You should not require 'win32/file/stat' directly. Instead, require the
|
44
44
|
win32-file library which will, in turn, require win32-file-stat. This is
|
45
45
|
the preferred approach because some modules (i.e. 'find') use the pass-through
|
@@ -54,22 +54,26 @@ and that will likely cause problems.
|
|
54
54
|
Also, a 32 bit Ruby attempting to access a locked system file on a 64 bit
|
55
55
|
version of MS Windows will fail.
|
56
56
|
|
57
|
-
|
57
|
+
== Known bugs
|
58
58
|
None that I'm aware of beyond the Known Issues listed above. Please report any
|
59
59
|
bugs you find on the project page at:
|
60
60
|
|
61
61
|
http://www.rubyforge.org/projects/win32utils.
|
62
62
|
|
63
|
-
|
63
|
+
== Miscellaneous
|
64
64
|
I had to require 'pp' explicitly in order to deal with the fact that pp.rb
|
65
65
|
has a builtin pretty_print method for File::Stat. If I didn't do this
|
66
66
|
you would end up using the pretty_print in pp.rb, which would break.
|
67
67
|
|
68
|
-
|
69
|
-
This library will eventually be merged with the win32-file library.
|
68
|
+
== Future Plans
|
69
|
+
This library will eventually be merged with the win32-file library. It will
|
70
|
+
also be refactored to use FindFirstFile().
|
70
71
|
|
71
|
-
|
72
|
-
|
72
|
+
== Copyright
|
73
|
+
(C) 2003-2009, Daniel J. Berger, All Rights Reserved.
|
74
|
+
|
75
|
+
== License
|
76
|
+
Artistic 2.0
|
73
77
|
|
74
78
|
= Warranty
|
75
79
|
This library is provided "as is" and without any express or
|
@@ -78,4 +82,4 @@ warranties of merchantability and fitness for a particular purpose.
|
|
78
82
|
|
79
83
|
= Authors
|
80
84
|
Daniel J. Berger
|
81
|
-
Park Heesob
|
85
|
+
Park Heesob
|
data/lib/win32/file/stat.rb
CHANGED
@@ -29,10 +29,12 @@ class File::Stat
|
|
29
29
|
include Windows::NTFS::Winternl
|
30
30
|
include Comparable
|
31
31
|
|
32
|
-
# The version of
|
33
|
-
VERSION = '1.3.
|
32
|
+
# The version of the win32-file-stat library
|
33
|
+
VERSION = '1.3.4'
|
34
34
|
|
35
35
|
private
|
36
|
+
|
37
|
+
# :stopdoc:
|
36
38
|
|
37
39
|
# Defined in Ruby's win32.h. Not meant for public consumption.
|
38
40
|
S_IWGRP = 0020
|
@@ -40,7 +42,7 @@ class File::Stat
|
|
40
42
|
|
41
43
|
# This is the only way to avoid a -w warning for initialize. We remove
|
42
44
|
# it later, after we've defined our initialize method.
|
43
|
-
alias old_init initialize
|
45
|
+
alias old_init initialize
|
44
46
|
|
45
47
|
# Make this library -w clean
|
46
48
|
undef_method(:atime, :blksize, :blockdev?, :blocks, :chardev?, :ctime)
|
@@ -53,7 +55,13 @@ class File::Stat
|
|
53
55
|
|
54
56
|
public
|
55
57
|
|
56
|
-
|
58
|
+
# Always nil. Provided for interface compatibility only.
|
59
|
+
attr_reader :dev_major
|
60
|
+
attr_reader :dev_minor
|
61
|
+
attr_reader :rdev_major
|
62
|
+
attr_reader :rdev_minor
|
63
|
+
|
64
|
+
# :startdoc:
|
57
65
|
|
58
66
|
# Creates and returns a File::Stat object, which encapsulate common status
|
59
67
|
# information for File objects on MS Windows sytems. The information is
|
@@ -437,8 +445,8 @@ class File::Stat
|
|
437
445
|
# Returns the number of blocks used by the file, where a block is defined
|
438
446
|
# as size divided by blksize, rounded up.
|
439
447
|
#
|
440
|
-
|
441
|
-
# This is a fudge.
|
448
|
+
#--
|
449
|
+
# This is a fudge. A search of the internet reveals different ways people
|
442
450
|
# have defined st_blocks on MS Windows.
|
443
451
|
#
|
444
452
|
def blocks
|
data/test/test_file_stat.rb
CHANGED
@@ -6,15 +6,18 @@
|
|
6
6
|
#####################################################################
|
7
7
|
require 'rubygems'
|
8
8
|
gem 'test-unit'
|
9
|
+
|
9
10
|
require 'test/unit'
|
10
11
|
require 'win32/file/stat'
|
11
|
-
include Windows::Volume
|
12
12
|
|
13
13
|
class TC_Win32_File_Stat < Test::Unit::TestCase
|
14
14
|
include Windows::File
|
15
|
+
include Windows::Process
|
16
|
+
include Windows::Volume
|
17
|
+
extend Windows::Volume
|
15
18
|
|
16
19
|
def self.startup
|
17
|
-
Dir.chdir(
|
20
|
+
Dir.chdir(File.expand_path(File.dirname(__FILE__)))
|
18
21
|
|
19
22
|
'A'.upto('Z'){ |volume|
|
20
23
|
volume += ":\\"
|
@@ -27,6 +30,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
27
30
|
|
28
31
|
@@txt_file = 'test_file.txt'
|
29
32
|
@@exe_file = 'test_file.exe'
|
33
|
+
@@sys_file = 'C:/pagefile.sys'
|
30
34
|
|
31
35
|
File.open(@@txt_file, "w"){ |fh| fh.print "This is a test\nHello" }
|
32
36
|
File.open(@@exe_file, "wb"){ |fh| fh.print "This is a test" }
|
@@ -36,11 +40,10 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
36
40
|
@dir = Dir.pwd
|
37
41
|
@stat = File::Stat.new(@@txt_file)
|
38
42
|
@attr = GetFileAttributes(@@txt_file)
|
39
|
-
@sys = 'C:/pagefile.sys'
|
40
43
|
end
|
41
44
|
|
42
45
|
def test_version
|
43
|
-
assert_equal('1.3.
|
46
|
+
assert_equal('1.3.4', File::Stat::VERSION)
|
44
47
|
end
|
45
48
|
|
46
49
|
# One or more tests will fail if the archive attribute on @@text_file
|
@@ -270,7 +273,8 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
270
273
|
end
|
271
274
|
|
272
275
|
def test_size_system_file
|
273
|
-
|
276
|
+
omit_if(windows_64?, 'skipping system file test on 64-bit OS')
|
277
|
+
assert_nothing_raised{ File::Stat.new(@@sys_file).size }
|
274
278
|
end
|
275
279
|
|
276
280
|
def test_size_bool
|
@@ -341,8 +345,10 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
341
345
|
def self.shutdown
|
342
346
|
File.delete(@@txt_file) if File.exists?(@@txt_file)
|
343
347
|
File.delete(@@exe_file) if File.exists?(@@exe_file)
|
348
|
+
|
344
349
|
@@block_dev = nil
|
345
350
|
@@txt_file = nil
|
346
351
|
@@exe_file = nil
|
352
|
+
@@sys_file = nil
|
347
353
|
end
|
348
354
|
end
|
data/win32-file-stat.gemspec
CHANGED
@@ -1,26 +1,32 @@
|
|
1
|
-
require
|
1
|
+
require 'rubygems'
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |gem|
|
4
|
-
gem.name
|
5
|
-
gem.version
|
6
|
-
gem.authors
|
7
|
-
gem.
|
8
|
-
gem.
|
9
|
-
gem.
|
10
|
-
gem.
|
11
|
-
gem.
|
12
|
-
gem.test_file
|
13
|
-
gem.has_rdoc
|
14
|
-
gem.files
|
15
|
-
|
16
|
-
gem.require_path = "lib"
|
17
|
-
gem.extra_rdoc_files = ["README", "CHANGES"]
|
18
|
-
gem.add_dependency("windows-pr", ">= 1.0.0")
|
19
|
-
gem.add_dependency("test-unit", ">= 2.0.2")
|
4
|
+
gem.name = 'win32-file-stat'
|
5
|
+
gem.version = '1.3.4'
|
6
|
+
gem.authors = ['Daniel J. Berger', 'Park Heesob']
|
7
|
+
gem.license = 'Artistic 2.0'
|
8
|
+
gem.email = 'djberg96@gmail.com'
|
9
|
+
gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
|
10
|
+
gem.platform = Gem::Platform::RUBY
|
11
|
+
gem.summary = 'A File::Stat class tailored to MS Windows'
|
12
|
+
gem.test_file = 'test/test_file_stat.rb'
|
13
|
+
gem.has_rdoc = true
|
14
|
+
gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') }
|
15
|
+
|
20
16
|
gem.rubyforge_project = 'Win32Utils'
|
21
|
-
|
17
|
+
gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
22
18
|
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
gem.add_dependency('windows-pr', '>= 1.0.0')
|
20
|
+
gem.add_development_dependency('test-unit', '>= 2.0.2')
|
21
|
+
|
22
|
+
gem.description = <<-EOF
|
23
|
+
The win32-file-stat library provides a custom File::Stat class
|
24
|
+
specifically tailored for MS Windows. Examples include the ability
|
25
|
+
to retrieve file attributes (hidden, archive, etc) as well as the
|
26
|
+
redefinition of certain core methods that either aren't implemented
|
27
|
+
at all, such as File.blksize, or methods that aren't implemented
|
28
|
+
properly, such as File.size.
|
29
|
+
EOF
|
26
30
|
end
|
31
|
+
|
32
|
+
Gem::Builder.new(spec).build
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-file-stat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
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: 2009-
|
13
|
+
date: 2009-08-13 00:00:00 -06:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
version:
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: test-unit
|
28
|
-
type: :
|
28
|
+
type: :development
|
29
29
|
version_requirement:
|
30
30
|
version_requirements: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 2.0.2
|
35
35
|
version:
|
36
|
-
description:
|
36
|
+
description: " The win32-file-stat library provides a custom File::Stat class\n specifically tailored for MS Windows. Examples include the ability\n to retrieve file attributes (hidden, archive, etc) as well as the\n redefinition of certain core methods that either aren't implemented\n at all, such as File.blksize, or methods that aren't implemented\n properly, such as File.size.\n"
|
37
37
|
email: djberg96@gmail.com
|
38
38
|
executables: []
|
39
39
|
|
@@ -42,18 +42,19 @@ extensions: []
|
|
42
42
|
extra_rdoc_files:
|
43
43
|
- README
|
44
44
|
- CHANGES
|
45
|
+
- MANIFEST
|
45
46
|
files:
|
46
|
-
- lib/win32/file/stat.rb
|
47
47
|
- CHANGES
|
48
|
-
- lib
|
48
|
+
- lib/win32/file/stat.rb
|
49
49
|
- MANIFEST
|
50
50
|
- Rakefile
|
51
51
|
- README
|
52
|
-
- test
|
53
|
-
- win32-file-stat.gemspec
|
54
52
|
- test/test_file_stat.rb
|
53
|
+
- win32-file-stat.gemspec
|
55
54
|
has_rdoc: true
|
56
55
|
homepage: http://www.rubyforge.org/projects/win32utils
|
56
|
+
licenses:
|
57
|
+
- Artistic 2.0
|
57
58
|
post_install_message:
|
58
59
|
rdoc_options: []
|
59
60
|
|
@@ -74,9 +75,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
75
|
requirements: []
|
75
76
|
|
76
77
|
rubyforge_project: Win32Utils
|
77
|
-
rubygems_version: 1.3.
|
78
|
+
rubygems_version: 1.3.5
|
78
79
|
signing_key:
|
79
|
-
specification_version:
|
80
|
+
specification_version: 3
|
80
81
|
summary: A File::Stat class tailored to MS Windows
|
81
82
|
test_files:
|
82
83
|
- test/test_file_stat.rb
|