snapshot_archive 0.14.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 980e40563a31fda449526df407ff72c4a6e5ffdbd6f0e0cff9b69eab414fa195
4
- data.tar.gz: e7582633c0c5e9d9d5811da112dc49ee66d5556eb1773c633434a8872e96deb2
3
+ metadata.gz: 6e85e9702884bba227f834ba3ca4c7d347803bd063b245d22b85bae0808285b4
4
+ data.tar.gz: f961470cf8cf6f94be884bb5a52962088cacd6d0c6905685381c295ec0cfaeea
5
5
  SHA512:
6
- metadata.gz: 265c065142b8d3db6048623456394dda63fd03172e5a53dd22551c389296228a56c762d66612a67b4edfcdb9606a263f41a32fe1722c515f9fc37fe5ba169da9
7
- data.tar.gz: 9192e94cb6a62bda59a0b21c393cd080e8ce829bb2244a71fbdd21daea4299d5c6392974bd9078f3d4a7ab2b811cccb7fdbf9e8a54be485087ec13f906773ea0
6
+ metadata.gz: dc227fea293c769b9af048f23eeb98e4bcfe95a109ec8608a9f06a58576a76cafe3c9004cceb73181c3cf701c0026769c008141bc4c7e08b0f31cfad093c7497
7
+ data.tar.gz: 639891a32eff28125d49c070a8cd4251046cb01230c4f672d5cc27370b0d923e7aebef7903590c48639f97340cd7b2d0e1e0e56ef68d4220baf499f522573dc1
data/README.md CHANGED
@@ -130,7 +130,7 @@ SnapshotArchive.configure do |config|
130
130
  # Using an object:
131
131
 
132
132
  class MyCustomStore
133
- def backup(dir:, id:, args: [])
133
+ def backup(dir:, id:, name:, args: [])
134
134
  path = File.join(dir, "my_custom_store.txt")
135
135
  File.write(path, "received args: #{args}")
136
136
 
@@ -148,7 +148,7 @@ SnapshotArchive.configure do |config|
148
148
  # Using the store builder:
149
149
 
150
150
  config.register_store("my_custom_store") do |store|
151
- store.backup do |dir:, id:, args: []|
151
+ store.backup do |dir:, id:, name:, args: []|
152
152
  path = File.join(dir, "my_custom_store.txt")
153
153
  File.write(path, "received args: #{args}")
154
154
 
@@ -19,7 +19,7 @@ module SnapshotArchive
19
19
  File
20
20
  .join(dir, name)
21
21
  .tap { FileUtils.mkdir(_1) }
22
- .then { store.backup(dir: _1, id: id)&.merge(type: name) }
22
+ .then { store.backup(dir: _1, id: id, name: name)&.merge(type: name) }
23
23
  }
24
24
  .compact
25
25
  )
@@ -67,8 +67,9 @@ module SnapshotArchive
67
67
  end
68
68
 
69
69
  def delete(id)
70
- metadata = JSON.parse(File.read(File.join(path, id, "metadata.json")))
71
- raise ArgumentError.new("unknown snapshot: #{id}") unless File.exist?(metadata)
70
+ md_path = File.read(File.join(path, id, "metadata.json"))
71
+ raise ArgumentError.new("unknown snapshot: #{id}") unless File.exist?(md_path)
72
+ metadata = JSON.parse(md_path)
72
73
 
73
74
  Cfg.shell.info("Running delete hooks: #{id}")
74
75
  Archives::Delete.call(metadata.dig("archive"))
@@ -9,8 +9,8 @@ module SnapshotArchive
9
9
  @args = args
10
10
  end
11
11
 
12
- def backup(dir:, id:)
13
- store.backup(dir: dir, id: id, args: args)
12
+ def backup(**opts)
13
+ store.backup(args: args, **opts)
14
14
  end
15
15
 
16
16
  def restore(...)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SnapshotArchive
4
- VERSION = "0.14.0"
4
+ VERSION = "0.16.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapshot_archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Kinnecom