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.
13
14
15
16
17
|
# File 'lib/train/extras/windows_file.rb', line 13
def initialize(backend, path)
@backend = backend
@path = path
@spath = Shellwords.escape(@path)
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
12
13
14
|
# File 'lib/train/extras/windows_file.rb', line 12
def path
@path
end
|
Instance Method Details
#content ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/train/extras/windows_file.rb', line 19
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
28
29
30
31
32
|
# File 'lib/train/extras/windows_file.rb', line 28
def exist?
return @exist if defined?(@exist)
@exist = @backend.run_command(
"(Test-Path -Path \"#{@spath}\").ToString()").stdout.chomp == 'True'
end
|
#file_version ⇒ Object
62
63
64
|
# File 'lib/train/extras/windows_file.rb', line 62
def file_version
nil
end
|
#link_path ⇒ Object
38
39
40
|
# File 'lib/train/extras/windows_file.rb', line 38
def link_path
nil
end
|
#link_target ⇒ Object
34
35
36
|
# File 'lib/train/extras/windows_file.rb', line 34
def link_target
nil
end
|
#mounted ⇒ Object
42
43
44
|
# File 'lib/train/extras/windows_file.rb', line 42
def mounted
nil
end
|
#product_version ⇒ Object
58
59
60
|
# File 'lib/train/extras/windows_file.rb', line 58
def product_version
nil
end
|
#stat ⇒ Object
66
67
68
|
# File 'lib/train/extras/windows_file.rb', line 66
def stat
nil
end
|
#type ⇒ Object
46
47
48
|
# File 'lib/train/extras/windows_file.rb', line 46
def type
:unknown
end
|