Class: Etna::Filesystem
- Inherits:
-
Object
show all
- Defined in:
- lib/etna/filesystem.rb
Overview
A class that encapsulates opening / reading file system entries that abstracts normal file access in order to make stubbing, substituting, and testing easier.
Defined Under Namespace
Modules: WithPipeConsumer
Classes: AsperaCliFilesystem, EmptyIO, GeneAsperaCliFilesystem, Mock
Instance Method Summary
collapse
Instance Method Details
#exist?(src) ⇒ Boolean
29
30
31
|
# File 'lib/etna/filesystem.rb', line 29
def exist?(src)
::File.exist?(src)
end
|
#mkdir_p(dir) ⇒ Object
17
18
19
|
# File 'lib/etna/filesystem.rb', line 17
def mkdir_p(dir)
::FileUtils.mkdir_p(dir)
end
|
#mv(src, dest) ⇒ Object
33
34
35
|
# File 'lib/etna/filesystem.rb', line 33
def mv(src, dest)
::FileUtils.mv(src, dest)
end
|
#rm_rf(dir) ⇒ Object
21
22
23
|
# File 'lib/etna/filesystem.rb', line 21
def rm_rf(dir)
::FileUtils.rm_rf(dir)
end
|
#tmpdir ⇒ Object
25
26
27
|
# File 'lib/etna/filesystem.rb', line 25
def tmpdir
::Dir.mktmpdir
end
|
#with_readable(src, opts = 'r', &block) ⇒ Object
13
14
15
|
# File 'lib/etna/filesystem.rb', line 13
def with_readable(src, opts = 'r', &block)
::File.open(src, opts, &block)
end
|
#with_writeable(dest, opts = 'w', size_hint: nil, &block) ⇒ Object
9
10
11
|
# File 'lib/etna/filesystem.rb', line 9
def with_writeable(dest, opts = 'w', size_hint: nil, &block)
::File.open(dest, opts, &block)
end
|