bard-backup 0.3.3 → 0.4.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: 452af7bfaa1d38372eb29a727e0b78200d479cb8f3eec98088aad4734bfae827
4
- data.tar.gz: 7408415418eda357aceda59944720a63e50d19f10f34b29d43b2709ec713fd2e
3
+ metadata.gz: 71a87dace6348cc41462c0192446af581cb9253d218d4c32c0c98667fe26c73a
4
+ data.tar.gz: 86eac09b1520f87f7bedd20bff84afd94496416d715947ea49f6047fdc45ed72
5
5
  SHA512:
6
- metadata.gz: 8c16a1f42236bfc41d42a68db41b1e7e806c737508a0b7b0aac5c87984107d5e77fd1446445b4daf1ba460c24e7ac6870eb62e612d49091febf74902325e3e22
7
- data.tar.gz: cb10ae30ececa98bbf031ed4a6500cde3b73a5a1564891d39a517f4c7f252da27108432ba50cabf894160c81e489cbcf84d28c6fc592daf6f2d8cb21f7c4825d
6
+ metadata.gz: 40fa5aa6fa1ee989cad053b08a529173376ebb3d18ee38d72024a5bbe5a0fe0cd222698664791490edc799200e77f7df7685eec8d561c995925f597a0121f36b
7
+ data.tar.gz: 384b78be14d95ee94dafd9941242818b84b073acc11e6833ace1cd011f95583630aeef27d22428c5a1b9864175989bbe40d292196c1908d884461310f138aa81
@@ -1,10 +1,12 @@
1
+ require "backhoe"
2
+
1
3
  module Bard
2
4
  module Backup
3
- class Controller < Struct.new(:dumper, :s3_dir, :now)
4
- def call
5
+ class LocalBackhoe
6
+ def self.call s3_dir, now
5
7
  filename = "#{now.iso8601}.sql.gz"
6
8
  path = "/tmp/#{filename}"
7
- dumper.dump path
9
+ Backhoe.dump path
8
10
  s3_dir.mv path
9
11
  end
10
12
  end
@@ -21,6 +21,15 @@ module Bard
21
21
  })
22
22
  end
23
23
 
24
+ def presigned_url file_path
25
+ presigner = Aws::S3::Presigner.new(client: client)
26
+ presigner.presigned_url(
27
+ :put_object,
28
+ bucket: bucket_name,
29
+ key: [folder_prefix, File.basename(file_path)].compact.join("/"),
30
+ )
31
+ end
32
+
24
33
  def mv file_path, body: File.read(file_path)
25
34
  put file_path, body: body
26
35
  FileUtils.rm file_path
@@ -1,6 +1,6 @@
1
1
  module Bard
2
2
  module Backup
3
- VERSION = "0.3.3"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
6
6
 
data/lib/bard/backup.rb CHANGED
@@ -1,14 +1,12 @@
1
- require "bard/backup/controller"
2
- require "bard/backup/deleter"
3
1
  require "bard/backup/s3_dir"
4
- require "backhoe"
2
+ require "bard/backup/local_backhoe"
3
+ require "bard/backup/deleter"
5
4
 
6
5
  module Bard
7
6
  module Backup
8
- def self.call s3_path, access_key:, secret_key:, region: "us-west-2", now: Time.now.utc
9
- dumper = Backhoe
7
+ def self.call s3_path, access_key:, secret_key:, region: "us-west-2", now: Time.now.utc, strategy: LocalBackhoe
10
8
  s3_dir = S3Dir.new(path: s3_path, access_key:, secret_key:, region:)
11
- Controller.new(dumper, s3_dir, now).call
9
+ strategy.call(s3_dir, now)
12
10
  Deleter.new(s3_dir, now).call
13
11
  end
14
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-08 00:00:00.000000000 Z
11
+ date: 2024-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backhoe
@@ -81,8 +81,8 @@ files:
81
81
  - Rakefile
82
82
  - lib/bard-backup.rb
83
83
  - lib/bard/backup.rb
84
- - lib/bard/backup/controller.rb
85
84
  - lib/bard/backup/deleter.rb
85
+ - lib/bard/backup/local_backhoe.rb
86
86
  - lib/bard/backup/s3_dir.rb
87
87
  - lib/bard/backup/version.rb
88
88
  - sig/bard/backup.rbs