win32-file 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,66 +1,66 @@
1
- ##############################################################################
2
- # test_win32_file_security.rb
3
- #
4
- # Test case for security related methods of win32-file. You should use the
5
- # 'rake test' or 'rake test_security' task to run this.
6
- #
7
- # Note that I've removed some tests that looked for explicit security
8
- # accounts, since it's impossible to determine how any given system is setup.
9
- ##############################################################################
10
- require 'rubygems'
11
- gem 'test-unit'
12
-
13
- require 'test/unit'
14
- require 'win32/file'
15
- require 'socket'
16
-
17
- class TC_Win32_File_Security < Test::Unit::TestCase
18
- def self.startup
19
- Dir.chdir(File.dirname(File.expand_path(File.basename(__FILE__))))
20
- @@host = Socket.gethostname
21
- @@file = File.join(Dir.pwd, 'security_test.txt')
22
- File.open(@@file, 'w'){ |fh| fh.puts "This is a security test." }
23
- end
24
-
25
- def setup
26
- @perms = nil
27
- end
28
-
29
- # This will fail if there is no "Users" builtin. Not to worry.
30
- def test_get_permissions
31
- assert_respond_to(File, :get_permissions)
32
- assert_nothing_raised{ File.get_permissions(@@file) }
33
- assert_kind_of(Hash, File.get_permissions(@@file))
34
- end
35
-
36
- def test_get_permissions_with_host
37
- assert_nothing_raised{ File.get_permissions(@@file, @@host) }
38
- assert_kind_of(Hash, File.get_permissions(@@file))
39
- end
40
-
41
- def test_set_permissions
42
- assert_respond_to(File, :set_permissions)
43
- assert_nothing_raised{ @perms = File.get_permissions(@@file) }
44
- assert_nothing_raised{ File.set_permissions(@@file, @perms) }
45
- end
46
-
47
- def test_securities
48
- assert_respond_to(File, :securities)
49
- assert_nothing_raised{ @perms = File.get_permissions(@@file) }
50
-
51
- @perms.each{ |acct, mask|
52
- assert_nothing_raised{ File.securities(mask) }
53
- assert_kind_of(Array, File.securities(mask))
54
- }
55
- end
56
-
57
- def teardown
58
- @perms = nil
59
- end
60
-
61
- def self.shutdown
62
- File.delete(@@file) if File.exists?(@@file)
63
- @@file = nil
64
- @@host = nil
65
- end
66
- end
1
+ ##############################################################################
2
+ # test_win32_file_security.rb
3
+ #
4
+ # Test case for security related methods of win32-file. You should use the
5
+ # 'rake test' or 'rake test_security' task to run this.
6
+ #
7
+ # Note that I've removed some tests that looked for explicit security
8
+ # accounts, since it's impossible to determine how any given system is setup.
9
+ ##############################################################################
10
+ require 'rubygems'
11
+ gem 'test-unit'
12
+
13
+ require 'test/unit'
14
+ require 'win32/file'
15
+ require 'socket'
16
+
17
+ class TC_Win32_File_Security < Test::Unit::TestCase
18
+ def self.startup
19
+ Dir.chdir(File.dirname(File.expand_path(File.basename(__FILE__))))
20
+ @@host = Socket.gethostname
21
+ @@file = File.join(Dir.pwd, 'security_test.txt')
22
+ File.open(@@file, 'w'){ |fh| fh.puts "This is a security test." }
23
+ end
24
+
25
+ def setup
26
+ @perms = nil
27
+ end
28
+
29
+ # This will fail if there is no "Users" builtin. Not to worry.
30
+ def test_get_permissions
31
+ assert_respond_to(File, :get_permissions)
32
+ assert_nothing_raised{ File.get_permissions(@@file) }
33
+ assert_kind_of(Hash, File.get_permissions(@@file))
34
+ end
35
+
36
+ def test_get_permissions_with_host
37
+ assert_nothing_raised{ File.get_permissions(@@file, @@host) }
38
+ assert_kind_of(Hash, File.get_permissions(@@file))
39
+ end
40
+
41
+ def test_set_permissions
42
+ assert_respond_to(File, :set_permissions)
43
+ assert_nothing_raised{ @perms = File.get_permissions(@@file) }
44
+ assert_nothing_raised{ File.set_permissions(@@file, @perms) }
45
+ end
46
+
47
+ def test_securities
48
+ assert_respond_to(File, :securities)
49
+ assert_nothing_raised{ @perms = File.get_permissions(@@file) }
50
+
51
+ @perms.each{ |acct, mask|
52
+ assert_nothing_raised{ File.securities(mask) }
53
+ assert_kind_of(Array, File.securities(mask))
54
+ }
55
+ end
56
+
57
+ def teardown
58
+ @perms = nil
59
+ end
60
+
61
+ def self.shutdown
62
+ File.delete(@@file) if File.exists?(@@file)
63
+ @@file = nil
64
+ @@host = nil
65
+ end
66
+ end
@@ -1,114 +1,114 @@
1
- #####################################################################
2
- # test_win32_file_stat.rb
3
- #
4
- # Test case for stat related methods of win32-file. You should run
5
- # this via the 'rake test' or 'rake test_stat' task.
6
- #####################################################################
7
- require 'rubygems'
8
- gem 'test-unit'
9
-
10
- require 'test/unit'
11
- require 'win32/file'
12
-
13
- class TC_Win32_File_Stat < Test::Unit::TestCase
14
- include Windows::Volume
15
- extend Windows::Volume
16
-
17
- def self.startup
18
- Dir.chdir(File.dirname(File.expand_path(File.basename(__FILE__))))
19
- @@file = File.join(Dir.pwd, 'stat_test.txt')
20
- File.open(@@file, 'w'){ |fh| fh.puts "This is a test." }
21
-
22
- @@block_dev = nil
23
-
24
- # Find a block device
25
- 'A'.upto('Z'){ |volume|
26
- volume += ":\\"
27
- case GetDriveType(volume)
28
- when DRIVE_REMOVABLE, DRIVE_CDROM, DRIVE_RAMDISK
29
- @@block_dev = volume
30
- break
31
- end
32
- }
33
- end
34
-
35
- # Although I don't perform a test against a file it works in my own tests.
36
- def test_size
37
- assert_respond_to(File, :size)
38
- assert_equal(17, File.size(@@file))
39
- end
40
-
41
- def test_blksize
42
- msg = "+The blksize may be different - ignore+"
43
- assert_respond_to(File, :blksize)
44
- assert_kind_of(Fixnum, File.blksize("C:\\Program Files\\Windows NT"))
45
- assert_kind_of(Fixnum, File.blksize(@@file))
46
- assert_equal(4096, File.blksize(@@file), msg)
47
- end
48
-
49
- def test_blksize_expected_errors
50
- assert_raises(ArgumentError){ File.blksize }
51
- assert_raises(ArgumentError){ File.blksize(@@file, "foo") }
52
- end
53
-
54
- # The test for a block device will fail unless the D: drive is a CDROM.
55
- def test_blockdev
56
- assert_respond_to(File, :blockdev?)
57
- assert_nothing_raised{ File.blockdev?("C:\\") }
58
- assert_equal(false, File.blockdev?("NUL"))
59
-
60
- omit_unless(@@block_dev, "Could not find block device")
61
- omit_unless(File.exists?(@@block_dev), "No media in device - skipping")
62
- assert_equal(true, File.blockdev?(@@block_dev))
63
- end
64
-
65
- def test_blockdev_expected_errors
66
- assert_raises(ArgumentError){ File.blockdev? }
67
- assert_raises(ArgumentError){ File.blockdev?(@@file, "foo") }
68
- end
69
-
70
- def test_chardev
71
- assert_respond_to(File, :chardev?)
72
- assert_nothing_raised{ File.chardev?("NUL") }
73
- assert_equal(true, File.chardev?("NUL"))
74
- assert_equal(false, File.chardev?(@@file))
75
- end
76
-
77
- def test_chardev_expected_errors
78
- assert_raises(ArgumentError){ File.chardev? }
79
- assert_raises(ArgumentError){ File.chardev?(@@file, "foo") }
80
- end
81
-
82
- # Ensure that not only does the File class respond to the stat method,
83
- # but also that it's returning the File::Stat class from the
84
- # win32-file-stat package.
85
- #
86
- def test_stat_class
87
- assert_respond_to(File, :stat)
88
- assert_kind_of(File::Stat, File.stat(@@file))
89
- assert_equal(false, File.stat(@@file).hidden?)
90
- end
91
-
92
- # This was added after it was discovered that lstat is not aliased
93
- # to stat automatically on Windows.
94
- #
95
- def test_lstat_class
96
- assert_respond_to(File, :lstat)
97
- assert_kind_of(File::Stat, File.lstat(@@file))
98
- assert_equal(false, File.stat(@@file).hidden?)
99
- end
100
-
101
- def test_stat_instance
102
- File.open(@@file){ |f|
103
- assert_respond_to(f, :stat)
104
- assert_kind_of(File::Stat, f.stat)
105
- assert_equal(false, f.stat.hidden?)
106
- }
107
- end
108
-
109
- def self.shutdown
110
- File.delete(@@file) if File.exists?(@@file)
111
- @@file = nil
112
- @@block_dev = nil
113
- end
114
- end
1
+ #####################################################################
2
+ # test_win32_file_stat.rb
3
+ #
4
+ # Test case for stat related methods of win32-file. You should run
5
+ # this via the 'rake test' or 'rake test_stat' task.
6
+ #####################################################################
7
+ require 'rubygems'
8
+ gem 'test-unit'
9
+
10
+ require 'test/unit'
11
+ require 'win32/file'
12
+
13
+ class TC_Win32_File_Stat < Test::Unit::TestCase
14
+ include Windows::Volume
15
+ extend Windows::Volume
16
+
17
+ def self.startup
18
+ Dir.chdir(File.dirname(File.expand_path(File.basename(__FILE__))))
19
+ @@file = File.join(Dir.pwd, 'stat_test.txt')
20
+ File.open(@@file, 'w'){ |fh| fh.puts "This is a test." }
21
+
22
+ @@block_dev = nil
23
+
24
+ # Find a block device
25
+ 'A'.upto('Z'){ |volume|
26
+ volume += ":\\"
27
+ case GetDriveType(volume)
28
+ when DRIVE_REMOVABLE, DRIVE_CDROM, DRIVE_RAMDISK
29
+ @@block_dev = volume
30
+ break
31
+ end
32
+ }
33
+ end
34
+
35
+ # Although I don't perform a test against a file it works in my own tests.
36
+ def test_size
37
+ assert_respond_to(File, :size)
38
+ assert_equal(17, File.size(@@file))
39
+ end
40
+
41
+ def test_blksize
42
+ msg = "+The blksize may be different - ignore+"
43
+ assert_respond_to(File, :blksize)
44
+ assert_kind_of(Fixnum, File.blksize("C:\\Program Files\\Windows NT"))
45
+ assert_kind_of(Fixnum, File.blksize(@@file))
46
+ assert_equal(4096, File.blksize(@@file), msg)
47
+ end
48
+
49
+ def test_blksize_expected_errors
50
+ assert_raises(ArgumentError){ File.blksize }
51
+ assert_raises(ArgumentError){ File.blksize(@@file, "foo") }
52
+ end
53
+
54
+ # The test for a block device will fail unless the D: drive is a CDROM.
55
+ def test_blockdev
56
+ assert_respond_to(File, :blockdev?)
57
+ assert_nothing_raised{ File.blockdev?("C:\\") }
58
+ assert_equal(false, File.blockdev?("NUL"))
59
+
60
+ omit_unless(@@block_dev, "Could not find block device")
61
+ omit_unless(File.exists?(@@block_dev), "No media in device - skipping")
62
+ assert_equal(true, File.blockdev?(@@block_dev))
63
+ end
64
+
65
+ def test_blockdev_expected_errors
66
+ assert_raises(ArgumentError){ File.blockdev? }
67
+ assert_raises(ArgumentError){ File.blockdev?(@@file, "foo") }
68
+ end
69
+
70
+ def test_chardev
71
+ assert_respond_to(File, :chardev?)
72
+ assert_nothing_raised{ File.chardev?("NUL") }
73
+ assert_equal(true, File.chardev?("NUL"))
74
+ assert_equal(false, File.chardev?(@@file))
75
+ end
76
+
77
+ def test_chardev_expected_errors
78
+ assert_raises(ArgumentError){ File.chardev? }
79
+ assert_raises(ArgumentError){ File.chardev?(@@file, "foo") }
80
+ end
81
+
82
+ # Ensure that not only does the File class respond to the stat method,
83
+ # but also that it's returning the File::Stat class from the
84
+ # win32-file-stat package.
85
+ #
86
+ def test_stat_class
87
+ assert_respond_to(File, :stat)
88
+ assert_kind_of(File::Stat, File.stat(@@file))
89
+ assert_equal(false, File.stat(@@file).hidden?)
90
+ end
91
+
92
+ # This was added after it was discovered that lstat is not aliased
93
+ # to stat automatically on Windows.
94
+ #
95
+ def test_lstat_class
96
+ assert_respond_to(File, :lstat)
97
+ assert_kind_of(File::Stat, File.lstat(@@file))
98
+ assert_equal(false, File.stat(@@file).hidden?)
99
+ end
100
+
101
+ def test_stat_instance
102
+ File.open(@@file){ |f|
103
+ assert_respond_to(f, :stat)
104
+ assert_kind_of(File::Stat, f.stat)
105
+ assert_equal(false, f.stat.hidden?)
106
+ }
107
+ end
108
+
109
+ def self.shutdown
110
+ File.delete(@@file) if File.exists?(@@file)
111
+ @@file = nil
112
+ @@block_dev = nil
113
+ end
114
+ end
data/win32-file.gemspec CHANGED
@@ -1,30 +1,31 @@
1
- require 'rubygems'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'win32-file'
5
- spec.version = '0.6.8'
6
- spec.authors = ['Daniel J. Berger', 'Park Heesob']
7
- spec.license = 'Artistic 2.0'
8
- spec.email = 'djberg96@gmail.com'
9
- spec.homepage = 'http://github.com/djberg96/win32-file'
10
- spec.summary = 'Extra or redefined methods for the File class on Windows.'
11
- spec.test_files = Dir['test/test*']
12
- spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
-
14
- spec.rubyforge_project = 'win32utils'
15
- spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
16
-
17
- spec.add_dependency('win32-api', '>= 1.2.1')
18
- spec.add_dependency('win32-file-stat', '>= 1.3.2')
19
- spec.add_dependency('windows-pr', '>= 1.0.8')
20
-
21
- spec.add_development_dependency('test-unit')
22
-
23
- spec.description = <<-EOF
24
- The win32-file library adds several methods to the core File class which
25
- are specific to MS Windows, such as the ability to set and retrieve file
26
- attributes. In addition, several core methods have been redefined in
27
- order to work properly on MS Windows, such as File.blksize. See the
28
- README file for more details.
29
- EOF
30
- end
1
+ require 'rubygems'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'win32-file'
5
+ spec.version = '0.6.9'
6
+ spec.authors = ['Daniel J. Berger', 'Park Heesob']
7
+ spec.license = 'Artistic 2.0'
8
+ spec.email = 'djberg96@gmail.com'
9
+ spec.homepage = 'http://github.com/djberg96/win32-file'
10
+ spec.summary = 'Extra or redefined methods for the File class on Windows.'
11
+ spec.test_files = Dir['test/test*']
12
+ spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
+
14
+ spec.rubyforge_project = 'win32utils'
15
+ spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
16
+
17
+ spec.add_dependency('win32-api', '>= 1.5.0')
18
+ spec.add_dependency('win32-file-stat', '>= 1.3.6', '< 1.4.0')
19
+ spec.add_dependency('windows-pr', '>= 1.2.0')
20
+
21
+ spec.add_development_dependency('rake')
22
+ spec.add_development_dependency('test-unit')
23
+
24
+ spec.description = <<-EOF
25
+ The win32-file library adds several methods to the core File class which
26
+ are specific to MS Windows, such as the ability to set and retrieve file
27
+ attributes. In addition, several core methods have been redefined in
28
+ order to work properly on MS Windows, such as File.blksize. See the
29
+ README file for more details.
30
+ EOF
31
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-file
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
5
- prerelease:
4
+ version: 0.6.9
6
5
  platform: ruby
7
6
  authors:
8
7
  - Daniel J. Berger
@@ -10,57 +9,90 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-04-06 00:00:00.000000000 Z
12
+ date: 2013-12-11 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: win32-api
17
- requirement: &22484120 !ruby/object:Gem::Requirement
18
- none: false
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  requirements:
20
- - - ! '>='
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
- version: 1.2.1
20
+ version: 1.5.0
23
21
  type: :runtime
24
22
  prerelease: false
25
- version_requirements: *22484120
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: 1.5.0
26
28
  - !ruby/object:Gem::Dependency
27
29
  name: win32-file-stat
28
- requirement: &22483860 !ruby/object:Gem::Requirement
29
- none: false
30
+ requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - ! '>='
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: 1.3.6
35
+ - - <
32
36
  - !ruby/object:Gem::Version
33
- version: 1.3.2
37
+ version: 1.4.0
34
38
  type: :runtime
35
39
  prerelease: false
36
- version_requirements: *22483860
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: 1.3.6
45
+ - - <
46
+ - !ruby/object:Gem::Version
47
+ version: 1.4.0
37
48
  - !ruby/object:Gem::Dependency
38
49
  name: windows-pr
39
- requirement: &22483570 !ruby/object:Gem::Requirement
40
- none: false
50
+ requirement: !ruby/object:Gem::Requirement
41
51
  requirements:
42
- - - ! '>='
52
+ - - '>='
43
53
  - !ruby/object:Gem::Version
44
- version: 1.0.8
54
+ version: 1.2.0
45
55
  type: :runtime
46
56
  prerelease: false
47
- version_requirements: *22483570
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.2.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
48
76
  - !ruby/object:Gem::Dependency
49
77
  name: test-unit
50
- requirement: &22483320 !ruby/object:Gem::Requirement
51
- none: false
78
+ requirement: !ruby/object:Gem::Requirement
52
79
  requirements:
53
- - - ! '>='
80
+ - - '>='
54
81
  - !ruby/object:Gem::Version
55
82
  version: '0'
56
83
  type: :development
57
84
  prerelease: false
58
- version_requirements: *22483320
59
- description: ! " The win32-file library adds several methods to the core File class
60
- which\n are specific to MS Windows, such as the ability to set and retrieve file\n
61
- \ attributes. In addition, several core methods have been redefined in\n order
62
- to work properly on MS Windows, such as File.blksize. See the\n README file for
63
- more details.\n"
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ description: |2
91
+ The win32-file library adds several methods to the core File class which
92
+ are specific to MS Windows, such as the ability to set and retrieve file
93
+ attributes. In addition, several core methods have been redefined in
94
+ order to work properly on MS Windows, such as File.blksize. See the
95
+ README file for more details.
64
96
  email: djberg96@gmail.com
65
97
  executables: []
66
98
  extensions: []
@@ -84,27 +116,26 @@ files:
84
116
  homepage: http://github.com/djberg96/win32-file
85
117
  licenses:
86
118
  - Artistic 2.0
119
+ metadata: {}
87
120
  post_install_message:
88
121
  rdoc_options: []
89
122
  require_paths:
90
123
  - lib
91
124
  required_ruby_version: !ruby/object:Gem::Requirement
92
- none: false
93
125
  requirements:
94
- - - ! '>='
126
+ - - '>='
95
127
  - !ruby/object:Gem::Version
96
128
  version: '0'
97
129
  required_rubygems_version: !ruby/object:Gem::Requirement
98
- none: false
99
130
  requirements:
100
- - - ! '>='
131
+ - - '>='
101
132
  - !ruby/object:Gem::Version
102
133
  version: '0'
103
134
  requirements: []
104
135
  rubyforge_project: win32utils
105
- rubygems_version: 1.8.11
136
+ rubygems_version: 2.0.3
106
137
  signing_key:
107
- specification_version: 3
138
+ specification_version: 4
108
139
  summary: Extra or redefined methods for the File class on Windows.
109
140
  test_files:
110
141
  - test/test_win32_file_attributes.rb