Class: RakeSecrets::Storage::FileSystem
- Defined in:
- lib/rake_secrets/storage/file_system.rb
Instance Method Summary collapse
Instance Method Details
#remove(path) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rake_secrets/storage/file_system.rb', line 21 def remove(path) ensure_path_exists(path) File.delete(path) rescue SystemCallError raise( RakeSecrets::Errors::RemoveError, "Failed to remove from path: '#{path}'." ) end |
#retrieve(path) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rake_secrets/storage/file_system.rb', line 32 def retrieve(path) ensure_path_exists(path) File.read(path) rescue SystemCallError raise( RakeSecrets::Errors::RetrieveError, "Failed to retrieve from path: '#{path}'." ) end |
#store(path, content) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/rake_secrets/storage/file_system.rb', line 11 def store(path, content) FileUtils.mkdir_p(File.dirname(path)) File.write(path, content) rescue SystemCallError, IOError raise( RakeSecrets::Errors::StoreError, "Failed to store at path: '#{path}'." ) end |