vagrant-unbundled 2.0.3.0 → 2.0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -10
  3. data/Gemfile.lock +16 -2
  4. data/README.md +1 -0
  5. data/bin/vagrant +1 -1
  6. data/lib/vagrant/action/builtin/handle_box.rb +1 -1
  7. data/lib/vagrant/action/general/package.rb +1 -1
  8. data/lib/vagrant/action.rb +3 -1
  9. data/lib/vagrant/alias.rb +56 -0
  10. data/lib/vagrant/bundler.rb +1 -1
  11. data/lib/vagrant/capability_host.rb +1 -1
  12. data/lib/vagrant/cli.rb +8 -0
  13. data/lib/vagrant/config/version_base.rb +1 -1
  14. data/lib/vagrant/environment.rb +7 -1
  15. data/lib/vagrant/errors.rb +4 -0
  16. data/lib/vagrant/host.rb +1 -1
  17. data/lib/vagrant/machine.rb +1 -1
  18. data/lib/vagrant/machine_index.rb +1 -1
  19. data/lib/vagrant/plugin/v1/guest.rb +1 -1
  20. data/lib/vagrant/plugin/v1/host.rb +1 -1
  21. data/lib/vagrant/plugin/v1/plugin.rb +1 -1
  22. data/lib/vagrant/plugin/v1/provider.rb +1 -1
  23. data/lib/vagrant/plugin/v2/guest.rb +1 -1
  24. data/lib/vagrant/plugin/v2/host.rb +1 -1
  25. data/lib/vagrant/plugin/v2/plugin.rb +1 -1
  26. data/lib/vagrant/plugin/v2/provider.rb +1 -1
  27. data/lib/vagrant/shared_helpers.rb +30 -9
  28. data/lib/vagrant/util/checkpoint_client.rb +8 -0
  29. data/lib/vagrant/util/downloader.rb +1 -1
  30. data/lib/vagrant/util/platform.rb +11 -3
  31. data/lib/vagrant/util/powershell.rb +17 -1
  32. data/lib/vagrant/util/safe_exec.rb +1 -1
  33. data/lib/vagrant/util/ssh.rb +4 -1
  34. data/lib/vagrant/util/stacked_proc_runner.rb +1 -1
  35. data/lib/vagrant/util/template_renderer.rb +2 -2
  36. data/lib/vagrant/vagrantfile.rb +1 -1
  37. data/lib/vagrant.rb +8 -0
  38. data/plugins/commands/plugin/gem_helper.rb +1 -1
  39. data/plugins/commands/powershell/command.rb +2 -2
  40. data/plugins/commands/powershell/scripts/enable_psremoting.ps1 +1 -1
  41. data/plugins/communicators/ssh/communicator.rb +10 -1
  42. data/plugins/communicators/winrm/command_filters/mkdir.rb +4 -2
  43. data/plugins/communicators/winrm/command_filters/rm.rb +5 -3
  44. data/plugins/communicators/winrm/command_filters/test.rb +3 -1
  45. data/plugins/communicators/winrm/command_filters/which.rb +4 -2
  46. data/plugins/communicators/winrm/communicator.rb +3 -3
  47. data/plugins/guests/amazon/cap/flavor.rb +1 -1
  48. data/plugins/guests/coreos/cap/configure_networks.rb +1 -1
  49. data/plugins/guests/coreos/guest.rb +1 -1
  50. data/plugins/guests/debian/cap/configure_networks.rb +1 -1
  51. data/plugins/guests/freebsd/cap/configure_networks.rb +1 -1
  52. data/plugins/guests/photon/guest.rb +1 -1
  53. data/plugins/guests/windows/cap/change_host_name.rb +6 -1
  54. data/plugins/guests/windows/cap/mount_shared_folder.rb +1 -1
  55. data/plugins/hosts/alt/plugin.rb +1 -1
  56. data/plugins/hosts/arch/plugin.rb +1 -1
  57. data/plugins/hosts/gentoo/plugin.rb +1 -1
  58. data/plugins/hosts/linux/plugin.rb +1 -1
  59. data/plugins/hosts/redhat/plugin.rb +1 -1
  60. data/plugins/hosts/slackware/plugin.rb +2 -2
  61. data/plugins/kernel_v2/config/push.rb +1 -1
  62. data/plugins/kernel_v2/config/vm.rb +1 -1
  63. data/plugins/providers/docker/action/compare_synced_folders.rb +1 -1
  64. data/plugins/providers/virtualbox/action/network.rb +9 -5
  65. data/plugins/providers/virtualbox/action/network_fix_ipv6.rb +1 -1
  66. data/plugins/provisioners/chef/config/chef_zero.rb +1 -1
  67. data/plugins/provisioners/chef/provisioner/chef_solo.rb +2 -2
  68. data/plugins/provisioners/chef/provisioner/chef_zero.rb +3 -3
  69. data/plugins/provisioners/puppet/config/puppet.rb +2 -0
  70. data/plugins/provisioners/puppet/provisioner/puppet.rb +18 -1
  71. data/plugins/provisioners/salt/config.rb +6 -0
  72. data/plugins/provisioners/salt/provisioner.rb +11 -1
  73. data/templates/locales/command_ps.yml +1 -1
  74. data/templates/locales/en.yml +13 -4
  75. data/templates/locales/guest_windows.yml +1 -1
  76. data/templates/locales/providers_docker.yml +1 -1
  77. data/templates/locales/synced_folder_smb.yml +2 -2
  78. data/vagrant.gemspec +2 -0
  79. data/vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/vagrant-spec.gemspec +1 -1
  80. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.document +5 -0
  81. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.gitignore +17 -0
  82. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.travis.yml +21 -0
  83. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/CHANGELOG.md +209 -0
  84. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/Gemfile +4 -0
  85. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/LICENSE.txt +78 -0
  86. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/README.md +67 -0
  87. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/Rakefile +88 -0
  88. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/data/public_suffix_list.dat +12440 -0
  89. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/domain_name.gemspec +36 -0
  90. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/etld_data.rb +8474 -0
  91. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/etld_data.rb.erb +11 -0
  92. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/punycode.rb +283 -0
  93. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/version.rb +3 -0
  94. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name.rb +297 -0
  95. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/helper.rb +17 -0
  96. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/test_domain_name-punycode.rb +97 -0
  97. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/test_domain_name.rb +317 -0
  98. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/tool/gen_etld_data.rb +63 -0
  99. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/CHANGES +13 -0
  100. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/LICENSE +201 -0
  101. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/MANIFEST +9 -0
  102. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/README +48 -0
  103. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/Rakefile +42 -0
  104. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/certs/djberg96_pub.pem +21 -0
  105. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/ffi-win32-extensions.gemspec +25 -0
  106. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/lib/ffi/win32/extensions.rb +96 -0
  107. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/lib/ffi-win32-extensions.rb +1 -0
  108. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/test/test_ffi_extensions.rb +41 -0
  109. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/test/test_string_extensions.rb +20 -0
  110. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/CHANGES +235 -0
  111. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/MANIFEST +16 -0
  112. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/README +73 -0
  113. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/Rakefile +49 -0
  114. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/appveyor.yml +50 -0
  115. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/certs/djberg96_pub.pem +21 -0
  116. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/constants.rb +33 -0
  117. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/functions.rb +42 -0
  118. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/structs.rb +54 -0
  119. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file.rb +585 -0
  120. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32-file.rb +1 -0
  121. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_link.rb +141 -0
  122. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_misc.rb +16 -0
  123. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_path.rb +282 -0
  124. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_stat.rb +330 -0
  125. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/win32-file.gemspec +33 -0
  126. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/CHANGES +63 -0
  127. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/MANIFEST +18 -0
  128. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/README +47 -0
  129. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/Rakefile +66 -0
  130. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/appveyor.yml +53 -0
  131. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/certs/djberg96_pub.pem +21 -0
  132. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/constants.rb +149 -0
  133. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/functions.rb +63 -0
  134. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/structs.rb +68 -0
  135. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security.rb +963 -0
  136. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32-file-security.rb +1 -0
  137. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_acls.rb +34 -0
  138. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_constants.rb +54 -0
  139. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_encryption.rb +90 -0
  140. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_ffi.rb +33 -0
  141. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_ownership.rb +174 -0
  142. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_permissions.rb +88 -0
  143. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_version.rb +14 -0
  144. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/win32-file-security.gemspec +28 -0
  145. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/CHANGES +169 -0
  146. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/MANIFEST +12 -0
  147. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/README +94 -0
  148. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/Rakefile +28 -0
  149. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/appveyor.yml +48 -0
  150. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/certs/djberg96_pub.pem +21 -0
  151. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/stat.rb +1008 -0
  152. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/constants.rb +94 -0
  153. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/functions.rb +68 -0
  154. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/structs.rb +196 -0
  155. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32-file-stat.rb +1 -0
  156. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/test/test_file_stat.rb +677 -0
  157. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/win32-file-stat.gemspec +30 -0
  158. data/vendor/bundle/ruby/2.5.0/specifications/domain_name-0.5.20180417.gemspec +46 -0
  159. data/vendor/bundle/ruby/2.5.0/specifications/ffi-win32-extensions-1.0.3.gemspec +38 -0
  160. data/vendor/bundle/ruby/2.5.0/specifications/win32-file-0.8.1.gemspec +51 -0
  161. data/vendor/bundle/ruby/2.5.0/specifications/win32-file-security-1.0.10.gemspec +47 -0
  162. data/vendor/bundle/ruby/2.5.0/specifications/win32-file-stat-1.5.5.gemspec +48 -0
  163. data/version.txt +1 -1
  164. metadata +114 -2
@@ -0,0 +1,330 @@
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 'test-unit'
8
+ require 'fileutils'
9
+ require 'win32/file'
10
+ require 'win32/security'
11
+ require 'ffi'
12
+
13
+ class TC_Win32_File_Stat < Test::Unit::TestCase
14
+ extend FFI::Library
15
+ ffi_lib :kernel32
16
+
17
+ attach_function :GetDriveTypeA, [:string], :uint
18
+
19
+ def self.startup
20
+ @@txt_file = File.join(Dir.pwd, 'stat_test.txt')
21
+ @@exe_file = File.join(Dir.pwd, 'stat_test.exe')
22
+ @@sys_file = "C:/pagefile.sys"
23
+
24
+ Dir.chdir(File.expand_path(File.dirname(__FILE__)))
25
+ File.open(@@txt_file, 'w'){ |fh| fh.puts "This is a test." }
26
+
27
+ FileUtils.touch(@@exe_file)
28
+
29
+ @@java = RUBY_PLATFORM == 'java'
30
+ @@block_dev = nil
31
+ @@elevated = Win32::Security.elevated_security?
32
+
33
+ # Find a block device
34
+ 'A'.upto('Z'){ |volume|
35
+ volume += ":\\"
36
+ if [2,5,6].include?(GetDriveTypeA(volume))
37
+ @@block_dev = volume
38
+ break
39
+ end
40
+ }
41
+ end
42
+
43
+ def setup
44
+ @blksize = 4096 # Most likely
45
+ @time_file = 'stat_time.txt'
46
+ end
47
+
48
+ test "File::Stat class returned is from win32-file-stat library" do
49
+ assert_respond_to(File, :stat)
50
+ assert_kind_of(File::Stat, File.stat(@@txt_file))
51
+ assert_nothing_raised{ File.stat(@@txt_file).hidden? }
52
+ end
53
+
54
+ test "atime method basic functionality" do
55
+ assert_nothing_raised{ File.atime(@@txt_file) }
56
+ assert_kind_of(Time, File.atime(@@txt_file))
57
+ end
58
+
59
+ test "atime with two arguments sets the creation time" do
60
+ FileUtils.touch(@time_file)
61
+ original_time = File.atime(@time_file)
62
+ updated_time = original_time - 100000
63
+
64
+ assert_equal(updated_time, File.atime(@time_file, updated_time))
65
+ assert_equal(updated_time, File.atime(@time_file))
66
+ end
67
+
68
+ test "blksize basic functionality" do
69
+ assert_respond_to(File, :blksize)
70
+ assert_kind_of(Fixnum, File.blksize(@@txt_file))
71
+ end
72
+
73
+ test "blksize returns the expected value" do
74
+ assert_equal(@blksize, File.blksize(@@txt_file))
75
+ assert_equal(@blksize, File.blksize("C:/"))
76
+ end
77
+
78
+ test "blksize requires a single argument" do
79
+ assert_raises(ArgumentError){ File.blksize }
80
+ assert_raises(ArgumentError){ File.blksize(@@txt_file, 'foo') }
81
+ end
82
+
83
+ test "blockdev? basic functionality" do
84
+ assert_respond_to(File, :blockdev?)
85
+ assert_nothing_raised{ File.blockdev?("C:\\") }
86
+ assert_boolean(File.blockdev?('NUL'))
87
+ end
88
+
89
+ test "blockdev? returns false for non-block devices" do
90
+ assert_false(File.blockdev?(@@txt_file))
91
+ assert_false(File.blockdev?('NUL'))
92
+ assert_false(File.blockdev?('bogus'))
93
+ end
94
+
95
+ test "blockdev? returns true for block devices" do
96
+ omit_unless(@@block_dev)
97
+ omit_unless(File.exist?(@@block_dev), "No media in device - skipping")
98
+ assert_true(File.blockdev?(@@block_dev))
99
+ end
100
+
101
+ test "blockdev? requires a single argument" do
102
+ assert_raises(ArgumentError){ File.blockdev? }
103
+ assert_raises(ArgumentError){ File.blockdev?(@@txt_file, 'foo') }
104
+ end
105
+
106
+ test "chardev? basic functionality" do
107
+ assert_respond_to(File, :chardev?)
108
+ assert_nothing_raised{ File.chardev?("NUL") }
109
+ assert_boolean(File.chardev?(@@txt_file))
110
+ end
111
+
112
+ test "chardev? method returns the expected result for regular files" do
113
+ assert_false(File.chardev?(@@txt_file))
114
+ assert_false(File.chardev?('bogus'))
115
+ end
116
+
117
+ test "chardev? method returns the expected result for character devices" do
118
+ omit_if(@@java)
119
+ assert_true(File.chardev?('NUL'))
120
+ end
121
+
122
+ test "chardev? requires a single argument" do
123
+ assert_raises(ArgumentError){ File.chardev? }
124
+ assert_raises(ArgumentError){ File.chardev?(@@txt_file, 'foo') }
125
+ end
126
+
127
+ test "ctime method basic functionality" do
128
+ assert_nothing_raised{ File.ctime(@@txt_file) }
129
+ assert_kind_of(Time, File.ctime(@@txt_file))
130
+ end
131
+
132
+ test "ctime with two arguments sets the creation time" do
133
+ FileUtils.touch(@time_file)
134
+ original_time = File.ctime(@time_file)
135
+ updated_time = original_time - 100000
136
+
137
+ assert_equal(updated_time, File.ctime(@time_file, updated_time))
138
+ assert_equal(updated_time, File.ctime(@time_file))
139
+ end
140
+
141
+ test "lstat is an alias for stat" do
142
+ assert_respond_to(File, :lstat)
143
+ assert_alias_method(File, :stat, :lstat)
144
+ end
145
+
146
+ test "directory? method basic functionality" do
147
+ assert_respond_to(File, :directory?)
148
+ assert_nothing_raised{ File.directory?(Dir.pwd) }
149
+ assert_boolean(File.directory?(Dir.pwd))
150
+ end
151
+
152
+ test "directory? method returns expected results" do
153
+ assert_true(File.directory?(Dir.pwd))
154
+ assert_false(File.directory?(@@txt_file))
155
+ assert_false(File.directory?('NUL'))
156
+ assert_false(File.directory?('bogus'))
157
+ end
158
+
159
+ test "executable? method basic functionality" do
160
+ assert_respond_to(File, :executable?)
161
+ assert_nothing_raised{ File.executable?(Dir.pwd) }
162
+ assert_boolean(File.executable?(Dir.pwd))
163
+ end
164
+
165
+ test "executable? method returns expected results" do
166
+ assert_true(File.executable?(@@exe_file))
167
+ assert_false(File.executable?(@@txt_file))
168
+ assert_false(File.directory?('NUL'))
169
+ assert_false(File.directory?('bogus'))
170
+ end
171
+
172
+ test "file? method basic functionality" do
173
+ assert_respond_to(File, :file?)
174
+ assert_nothing_raised{ File.file?(Dir.pwd) }
175
+ assert_boolean(File.file?(Dir.pwd))
176
+ end
177
+
178
+ test "file? method returns expected results" do
179
+ assert_true(File.file?(@@txt_file))
180
+ assert_false(File.file?(Dir.pwd))
181
+ assert_false(File.file?('NUL'))
182
+ assert_false(File.file?('bogus'))
183
+ end
184
+
185
+ test "ftype method basic functionality" do
186
+ assert_respond_to(File, :ftype)
187
+ assert_nothing_raised{ File.ftype(Dir.pwd) }
188
+ assert_kind_of(String, File.ftype(Dir.pwd))
189
+ end
190
+
191
+ test "ftype returns the expected string" do
192
+ assert_equal('file', File.ftype(@@txt_file))
193
+ assert_equal('directory', File.ftype(Dir.pwd))
194
+ assert_equal('characterSpecial', File.ftype('NUL'))
195
+ end
196
+
197
+ test "grpowned? method basic functionality" do
198
+ assert_respond_to(File, :grpowned?)
199
+ assert_nothing_raised{ File.grpowned?(Dir.pwd) }
200
+ assert_boolean(File.grpowned?(Dir.pwd))
201
+ end
202
+
203
+ test "grpowned? returns expected results" do
204
+ assert_true(File.grpowned?(@@txt_file))
205
+ assert_false(File.grpowned?('NUL'))
206
+ assert_false(File.grpowned?('bogus'))
207
+ end
208
+
209
+ test "mtime method basic functionality" do
210
+ assert_nothing_raised{ File.mtime(@@txt_file) }
211
+ assert_kind_of(Time, File.mtime(@@txt_file))
212
+ end
213
+
214
+ test "mtime with two arguments sets the creation time" do
215
+ FileUtils.touch(@time_file)
216
+ original_time = File.mtime(@time_file)
217
+ updated_time = original_time - 100000
218
+
219
+ assert_equal(updated_time, File.mtime(@time_file, updated_time))
220
+ assert_equal(updated_time, File.mtime(@time_file))
221
+ end
222
+
223
+ test "owned? method basic functionality" do
224
+ assert_respond_to(File, :owned?)
225
+ assert_nothing_raised{ File.owned?(Dir.pwd) }
226
+ assert_boolean(File.owned?(Dir.pwd))
227
+ end
228
+
229
+ test "owned? returns expected results" do
230
+ if @@elevated
231
+ assert_false(File.owned?(@@txt_file))
232
+ else
233
+ assert_true(File.owned?(@@txt_file))
234
+ end
235
+ assert_false(File.owned?('NUL'))
236
+ assert_false(File.owned?('bogus'))
237
+ end
238
+
239
+ test "pipe? method basic functionality" do
240
+ assert_respond_to(File, :pipe?)
241
+ assert_nothing_raised{ File.pipe?(Dir.pwd) }
242
+ assert_boolean(File.pipe?(Dir.pwd))
243
+ end
244
+
245
+ test "pipe? returns expected results" do
246
+ assert_false(File.pipe?(@@txt_file))
247
+ assert_false(File.pipe?(Dir.pwd))
248
+ assert_false(File.pipe?('NUL'))
249
+ assert_false(File.pipe?('bogus'))
250
+ end
251
+
252
+ test "readable? basic functionality" do
253
+ assert_respond_to(File, :readable?)
254
+ assert_boolean(File.readable?(@@txt_file))
255
+ end
256
+
257
+ test "readable? returns expected value" do
258
+ assert_true(File.readable?(@@txt_file))
259
+ assert_true(File::Stat.new(Dir.pwd).readable?)
260
+ assert_false(File::Stat.new(@@sys_file).readable?)
261
+ end
262
+
263
+ test "readable_real? basic functionality" do
264
+ assert_respond_to(File, :readable_real?)
265
+ assert_boolean(File.readable_real?(@@txt_file))
266
+ end
267
+
268
+ test "readable_real? returns expected value" do
269
+ assert_true(File.readable_real?(@@txt_file))
270
+ end
271
+
272
+ test "socket? is an alias for pipe?" do
273
+ assert_respond_to(File, :socket?)
274
+ assert_alias_method(File, :socket?, :pipe?)
275
+ end
276
+
277
+ test "world_readable? basic functionality" do
278
+ assert_respond_to(File, :world_readable?)
279
+ assert_boolean(File.world_readable?(@@txt_file))
280
+ end
281
+
282
+ test "world_writable? returns expected value" do
283
+ assert_false(File.world_writable?(@@txt_file))
284
+ end
285
+
286
+ test "writable? basic functionality" do
287
+ assert_respond_to(File, :writable?)
288
+ assert_boolean(File.writable?(@@txt_file))
289
+ end
290
+
291
+ test "writable? returns expected value" do
292
+ assert_true(File.writable?(@@txt_file))
293
+ assert_true(File::Stat.new(Dir.pwd).writable?)
294
+ assert_false(File::Stat.new(@@sys_file).writable?)
295
+ end
296
+
297
+ test "writable_real? basic functionality" do
298
+ assert_respond_to(File, :writable_real?)
299
+ assert_boolean(File.writable_real?(@@txt_file))
300
+ end
301
+
302
+ test "writable_real? returns expected value" do
303
+ assert_true(File.writable_real?(@@txt_file))
304
+ end
305
+
306
+ test "check underlying custom stat attributes" do
307
+ File.open(@@txt_file){ |f|
308
+ assert_respond_to(f, :stat)
309
+ assert_kind_of(File::Stat, f.stat)
310
+ assert_false(f.stat.hidden?)
311
+ }
312
+ end
313
+
314
+ def teardown
315
+ File.delete(@time_file) if File.exist?(@time_file)
316
+
317
+ @blksize = nil
318
+ @time_file = nil
319
+ end
320
+
321
+ def self.shutdown
322
+ File.delete(@@txt_file) if File.exist?(@@txt_file)
323
+ File.delete(@@exe_file) if File.exist?(@@exe_file)
324
+ @@txt_file = nil
325
+ @@exe_file = nil
326
+ @@elevated = nil
327
+ @@block_dev = nil
328
+ @@java = nil
329
+ end
330
+ end
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'win32-file'
5
+ spec.version = '0.8.1'
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
+ spec.cert_chain = ['certs/djberg96_pub.pem']
14
+
15
+ spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
16
+ spec.required_ruby_version = ">= 1.9.0"
17
+
18
+ spec.add_dependency('ffi')
19
+ spec.add_dependency('ffi-win32-extensions')
20
+ spec.add_dependency('win32-file-stat', '>= 1.4.0')
21
+
22
+ spec.add_development_dependency('rake')
23
+ spec.add_development_dependency('test-unit')
24
+ spec.add_development_dependency('win32-security')
25
+
26
+ spec.description = <<-EOF
27
+ The win32-file library adds several methods to the core File class which
28
+ are specific to MS Windows, such as the ability to set and retrieve file
29
+ attributes. In addition, several core methods have been redefined in
30
+ order to work properly on MS Windows, such as File.blksize. See the
31
+ README file for more details.
32
+ EOF
33
+ end
@@ -0,0 +1,63 @@
1
+ = 1.0.10 - 16-Mar-2017
2
+ * Added the ffi-win32-extensions gem as a dependency. This should have been
3
+ added when I removed the helper file. Thanks go to Thomas Bernhart for the
4
+ spot.
5
+ * Explicitly freeze the WIN32_FILE_SECURITY_VERSION constant string and
6
+ add a test for it.
7
+
8
+ = 1.0.9 - 27-Feb-2017
9
+ * Fixed a bug in the File.set_permissions method. Thanks go to Thomas Bernhart
10
+ for the spot and the patch.
11
+ * Removed the helper.rb file, since the methods are already available from
12
+ the dependencies.
13
+ * Removed Ruby 1.9.x from the test matrix, and added Ruby 2.3.x.
14
+
15
+ = 1.0.8 - 30-Jan-2016
16
+ * Fixed an issue for account names that do not contain a backslash. Thanks go
17
+ to Ben Jansen for the spot and patch.
18
+
19
+ = 1.0.7 - 5-Nov-2015
20
+ * Updated some tests so that they ignore case on ownership and permissions
21
+ checks. Caught by Appveyor.
22
+ * This gem is now signed.
23
+ * All gem related tasks in the Rakefile now assume Rubygems 2.x.
24
+ * Added a win32-file-security.rb file for convenience.
25
+ * Bug fix for the ownership test suite where a segfault could occur.
26
+ * Added appveyor.yml file.
27
+
28
+ = 1.0.6 - 28-May-2015
29
+ * Handle the possibility of an empty/nil domain. Thanks go to n-nishizawa
30
+ for the spot.
31
+ * Helper methods are only defined if not already defined.
32
+ * Tests that were failing when run as admins in non-domain environments have
33
+ been modified to check for a domain first.
34
+
35
+ = 1.0.5 - 2-May-2015
36
+ * Added the File.supports_acls? singleton method.
37
+ * The File.get_permissions and File.set_permissions methods now explicitly
38
+ raise an error if the filesystem does not support ACL's.
39
+ * Fixed some deprecation warnings in the test suite.
40
+
41
+ = 1.0.4 - 2-May-2014
42
+ * All methods that accept a filename argument now honor objects that implement
43
+ either to_str or to_path.
44
+ * Added some pathname tests.
45
+ * Updated the gem:create Rakefile task.
46
+
47
+ = 1.0.3 - 15-Apr-2013
48
+ * Added the File.group method.
49
+ * Added a working implementation of File.grpowned?
50
+ * Pointer addition fixes that affected 64 bit versions of Ruby.
51
+
52
+ = 1.0.2 - 8-Apr-2013
53
+ * Fixed HANDLE prototype in underlying FFI code. This affects 64 bit
54
+ versions of Ruby.
55
+
56
+ = 1.0.1 - 1-Jan-2013
57
+ * Added a working implementation of File.owned?
58
+ * Added a working implementation of File.chown.
59
+ * Added the File.owner method.
60
+ * Made the FFI functions private.
61
+
62
+ = 1.0.0 - 19-Dec-2012
63
+ * Initial release as an independent library.
@@ -0,0 +1,18 @@
1
+ * CHANGES
2
+ * MANIFEST
3
+ * Rakefile
4
+ * README
5
+ * win32-file-security.gemspec
6
+ * certs/djberg96_pub.pem
7
+ * lib/win32-file-security.rb
8
+ * lib/win32/file/security.rb
9
+ * lib/win32/file/windows/constants.rb
10
+ * lib/win32/file/windows/functions.rb
11
+ * lib/win32/file/windows/structs.rb
12
+ * test/test_win32_file_security_acls.rb
13
+ * test/test_win32_file_security_constants.rb
14
+ * test/test_win32_file_security_encryption.rb
15
+ * test/test_win32_file_security_ffi.rb
16
+ * test/test_win32_file_security_ownership.rb
17
+ * test/test_win32_file_security_permissions.rb
18
+ * test/test_win32_file_security_version.rb
@@ -0,0 +1,47 @@
1
+ == Description
2
+ Additional methods for the File class that relate to file security on
3
+ the Microsoft Windows operating system.
4
+
5
+ == Prerequisites
6
+ * ffi
7
+
8
+ == Installation
9
+ gem install win32-file-security
10
+
11
+ == Synopsis
12
+
13
+ require 'win32/file/security
14
+
15
+ p File.get_permissions('file.txt')
16
+
17
+ p File.owner('file.txt')
18
+ p File.owned?('file.txt')
19
+
20
+ p File.group('file.txt')
21
+ p File.grpowned?('file.txt')
22
+
23
+ == Notes
24
+ Some of these methods already exist in the win32-file gem, so
25
+ you may not need this gem if you already have win32-file installed.
26
+
27
+ == Known issues or bugs
28
+ None that I'm aware of.
29
+
30
+ Please report any issues you find on the github page at:
31
+
32
+ https://github.com/djberg96/win32-file-security/issues
33
+
34
+ == License
35
+ Artistic 2.0
36
+
37
+ == Copyright
38
+ (C) 2003-2017, Daniel J. Berger, All Rights Reserved
39
+
40
+ == Warranty
41
+ This package is provided "as is" and without any express or
42
+ implied warranties, including, without limitation, the implied
43
+ warranties of merchantability and fitness for a particular purpose.
44
+
45
+ == Authors
46
+ * Daniel J. Berger
47
+ * Park Heesob
@@ -0,0 +1,66 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+
5
+ CLEAN.include('**/*.gem', '**/*.rbc')
6
+
7
+ namespace :gem do
8
+ desc 'Build the win32-file-security gem'
9
+ task :create => [:clean] do
10
+ require 'rubygems/package'
11
+ spec = eval(IO.read('win32-file-security.gemspec'))
12
+ spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
13
+ Gem::Package.build(spec, true)
14
+ end
15
+
16
+ desc "Install the win32-file-security gem"
17
+ task :install => [:create] do
18
+ file = Dir["*.gem"].first
19
+ sh "gem install -l #{file}"
20
+ end
21
+ end
22
+
23
+ namespace 'test' do
24
+ Rake::TestTask.new('all') do |t|
25
+ task :test => :clean
26
+ t.warning = true
27
+ t.verbose = true
28
+ end
29
+
30
+ Rake::TestTask.new('constants') do |t|
31
+ task :test => :clean
32
+ t.warning = true
33
+ t.verbose = true
34
+ t.test_files = FileList['test/test_win32_file_security_constants']
35
+ end
36
+
37
+ Rake::TestTask.new('encryption') do |t|
38
+ task :test => :clean
39
+ t.warning = true
40
+ t.verbose = true
41
+ t.test_files = FileList['test/test_win32_file_security_encryption']
42
+ end
43
+
44
+ Rake::TestTask.new('ffi') do |t|
45
+ task :test => :clean
46
+ t.warning = true
47
+ t.verbose = true
48
+ t.test_files = FileList['test/test_win32_file_security_ffi']
49
+ end
50
+
51
+ Rake::TestTask.new('ownership') do |t|
52
+ task :test => :clean
53
+ t.warning = true
54
+ t.verbose = true
55
+ t.test_files = FileList['test/test_win32_file_security_ownership']
56
+ end
57
+
58
+ Rake::TestTask.new('permissions') do |t|
59
+ task :test => :clean
60
+ t.warning = true
61
+ t.verbose = true
62
+ t.test_files = FileList['test/test_win32_file_security_permissions']
63
+ end
64
+ end
65
+
66
+ task :default => 'test:all'
@@ -0,0 +1,53 @@
1
+ version: '{build}'
2
+ branches:
3
+ only:
4
+ - master
5
+ skip_tags: true
6
+ clone_depth: 10
7
+ environment:
8
+ matrix:
9
+ - ruby_version: 200
10
+ ruby_dir: 2.0.0
11
+ - ruby_version: 200-x64
12
+ ruby_dir: 2.0.0
13
+ - ruby_version: 21
14
+ ruby_dir: 2.1.0
15
+ - ruby_version: 21-x64
16
+ ruby_dir: 2.1.0
17
+ - ruby_version: 22
18
+ ruby_dir: 2.2.0
19
+ - ruby_version: 22-x64
20
+ ruby_dir: 2.2.0
21
+ - ruby_version: 23
22
+ ruby_dir: 2.3.0
23
+ - ruby_version: 23-x64
24
+ ruby_dir: 2.3.0
25
+ install:
26
+ - ps: >-
27
+ $env:path = "C:\Ruby" + $env:ruby_version + "\bin;" + $env:path
28
+
29
+ $tpath = "C:\Ruby" + $env:ruby_version + "\lib\ruby\" + $env:ruby_dir + "\test"
30
+
31
+ if ((test-path $tpath) -eq $True){ rm -recurse -force $tpath }
32
+
33
+ gem update --system > $null
34
+
35
+ if ((gem query -i ffi) -eq $False){ gem install ffi --no-document }
36
+
37
+ if ((gem query -i test-unit -v ">= 3.0") -eq $False){ gem install test-unit --no-document }
38
+
39
+ if ((gem query -i sys-admin) -eq $False){ gem install sys-admin --no-document }
40
+
41
+ if ((gem query -i win32-security) -eq $False){ gem install win32-security --no-document }
42
+ cache:
43
+ - C:\Ruby200\lib\ruby\gems\2.0.0
44
+ - C:\Ruby200-x64\lib\ruby\gems\2.0.0
45
+ - C:\Ruby21\lib\ruby\gems\2.1.0
46
+ - C:\Ruby21-x64\lib\ruby\gems\2.1.0
47
+ - C:\Ruby22\lib\ruby\gems\2.2.0
48
+ - C:\Ruby22-x64\lib\ruby\gems\2.2.0
49
+ - C:\Ruby23\lib\ruby\gems\2.3.0
50
+ - C:\Ruby23-x64\lib\ruby\gems\2.3.0
51
+ build: off
52
+ test_script:
53
+ - cmd: rake
@@ -0,0 +1,21 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
3
+ cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
4
+ MB4XDTE2MTIxMjAwMTQ1M1oXDTE3MTIxMjAwMTQ1M1owPzERMA8GA1UEAwwIZGpi
5
+ ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
6
+ bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVtTm/wETO8yKVKRPBO
7
+ VgPRvE94iEfKryOb/tQrmhGhchG2ALqdw/r54cGJvLaXeItrYJ6N8pSE/FSnN5jM
8
+ xugUhHBprPl+AsQ4E+IBy0dKwyU8XjFoVYzWvT1wnqwQdSazdgFCfQqb51QCgUIT
9
+ PGGakKlyzCb3Mbq30is8+QlRrqXt/JbpkUZbQwUqCdAulMT4oyPBk/L+48pbVX0s
10
+ 4yj7YaVAqfGByAMTPXEmUS388lX+0xq8+GGir2Fuh0TpNW0ggr9BxprwqL0Mg4Oo
11
+ YhM5L1y8Plolo8mOTN3+K8I3afZ0lD0BtwniVb6g+Ut/4aBjKy2+GyFwwNOu0gSj
12
+ desCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJfg
13
+ HmQ0uDU3Z9A9hB1lQMjr5VZSMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
14
+ bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
15
+ ggEBACjRCHRP944MHIQJNCglZbDnZowybV2HxmG1uhnvRwrOjBA7CXemc+QSAL7K
16
+ 7eXC4FdojVEJrnU7ZxuCmfQU+fvkEQKOnah1osG1874aPiDlwtjHclpeqcDgTUI7
17
+ A7CF+OXK8x7ksFx205ruhPHKaPYtwVG/W/J+y7Wx8yl9rvwUgRBL5cVzTBiEz+AB
18
+ NRT7yoHXXfFXjuQWN1eHunSbNds2ZTGQd64yBCujb17Xdl+F9tu4klkTga3gxP3P
19
+ y3zoX1VttxnIZBojRM/s2A7c2aubMH2SVbXMR3ccVkB9XbYKl1OvCe7q85xEHit2
20
+ Kbpico5nnyHqf7YSPmvZe8bCU94=
21
+ -----END CERTIFICATE-----