Class: Prebundler::FileBackend
- Inherits:
-
Object
- Object
- Prebundler::FileBackend
- Defined in:
- lib/prebundler/file_backend.rb
Instance Attribute Summary collapse
-
#docker_mount_point ⇒ Object
readonly
Returns the value of attribute docker_mount_point.
-
#local_path ⇒ Object
readonly
Returns the value of attribute local_path.
Instance Method Summary collapse
- #docker_flags ⇒ Object
-
#initialize(options = {}) ⇒ FileBackend
constructor
A new instance of FileBackend.
- #list_files ⇒ Object
- #retrieve_file(source_file, dest_file) ⇒ Object
- #store_file(source_file, dest_file) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FileBackend
Returns a new instance of FileBackend.
7 8 9 10 |
# File 'lib/prebundler/file_backend.rb', line 7 def initialize( = {}) @local_path = .fetch(:local_path) @docker_mount_point = .fetch(:docker_mount_point) end |
Instance Attribute Details
#docker_mount_point ⇒ Object (readonly)
Returns the value of attribute docker_mount_point.
5 6 7 |
# File 'lib/prebundler/file_backend.rb', line 5 def docker_mount_point @docker_mount_point end |
#local_path ⇒ Object (readonly)
Returns the value of attribute local_path.
5 6 7 |
# File 'lib/prebundler/file_backend.rb', line 5 def local_path @local_path end |
Instance Method Details
#docker_flags ⇒ Object
24 25 26 |
# File 'lib/prebundler/file_backend.rb', line 24 def docker_flags ['-v', "#{File.(local_path)}:#{docker_mount_point}"] end |
#list_files ⇒ Object
20 21 22 |
# File 'lib/prebundler/file_backend.rb', line 20 def list_files Dir.chdir(docker_mount_point) { Dir.glob('**/*.*') } end |
#retrieve_file(source_file, dest_file) ⇒ Object
16 17 18 |
# File 'lib/prebundler/file_backend.rb', line 16 def retrieve_file(source_file, dest_file) FileUtils.cp(File.join(local_path, source_file), dest_file) end |
#store_file(source_file, dest_file) ⇒ Object
12 13 14 |
# File 'lib/prebundler/file_backend.rb', line 12 def store_file(source_file, dest_file) FileUtils.cp(source_file, File.join(docker_mount_point, dest_file)) end |