Class: Train::Extras::WindowsFile
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from FileCommon
#block_device?, #character_device?, #directory?, #file?, #grouped_into?, #linked_to?, #md5sum, #mode?, #mounted?, #owned_by?, #pipe?, #sha256sum, #socket?, #symlink?, #unix_mode_mask, #version?
Constructor Details
#initialize(backend, path) ⇒ WindowsFile
Returns a new instance of WindowsFile.
14
15
16
17
18
|
# File 'lib/train/extras/file_windows.rb', line 14
def initialize(backend, path)
@backend = backend
@path = path
@spath = Shellwords.escape(@path)
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
13
14
15
|
# File 'lib/train/extras/file_windows.rb', line 13
def path
@path
end
|
Instance Method Details
#basename(suffix = nil, sep = '\\') ⇒ Object
20
21
22
|
# File 'lib/train/extras/file_windows.rb', line 20
def basename(suffix = nil, sep = '\\')
super(suffix, sep)
end
|
#content ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/train/extras/file_windows.rb', line 24
def content
return @content if defined?(@content)
@content = @backend.run_command(
"Get-Content(\"#{@spath}\") | Out-String").stdout
return @content unless @content.empty?
@content = nil if directory? @content
end
|
#exist? ⇒ Boolean
33
34
35
36
37
|
# File 'lib/train/extras/file_windows.rb', line 33
def exist?
return @exist if defined?(@exist)
@exist = @backend.run_command(
"(Test-Path -Path \"#{@spath}\").ToString()").stdout.chomp == 'True'
end
|
#file_version ⇒ Object
67
68
69
|
# File 'lib/train/extras/file_windows.rb', line 67
def file_version
nil
end
|
#link_path ⇒ Object
43
44
45
|
# File 'lib/train/extras/file_windows.rb', line 43
def link_path
nil
end
|
#link_target ⇒ Object
39
40
41
|
# File 'lib/train/extras/file_windows.rb', line 39
def link_target
nil
end
|
#mounted ⇒ Object
47
48
49
|
# File 'lib/train/extras/file_windows.rb', line 47
def mounted
nil
end
|
#product_version ⇒ Object
63
64
65
|
# File 'lib/train/extras/file_windows.rb', line 63
def product_version
nil
end
|
#stat ⇒ Object
71
72
73
|
# File 'lib/train/extras/file_windows.rb', line 71
def stat
nil
end
|
#type ⇒ Object
51
52
53
|
# File 'lib/train/extras/file_windows.rb', line 51
def type
:unknown
end
|