mys3ql 1.3.0 → 1.3.1

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
  SHA1:
3
- metadata.gz: 86d0a66ce7dab918b298c22eb4d667df2cb9ac7c
4
- data.tar.gz: cd9527db20ae5a07349b3456e544a0aa3552f9bd
3
+ metadata.gz: a48a2b78903816b36dda8e140c0a437d7321b9de
4
+ data.tar.gz: 698c6f810ec61c7b66313e4d0c6831c2ee62576a
5
5
  SHA512:
6
- metadata.gz: 25abe9f3cc7daee801c8402dbd07b8827608d139ed4a2ca95ec089ed1a7d4335dfbfaa8fd30f10ea06118159d3513fa90c866ac9fa09976b48dc8d05645ac105
7
- data.tar.gz: 340d29d1230eda51d4408b8f5fb3597ed7da31276171608469092c10fbe04ceb5f3e0640f3758cbdbe14c2af99804bc5ebb81dd27e6097c661c492d4339d56f4
6
+ metadata.gz: 652a2869f4a3f54b2a7c63f8ec16aa0d26c59550cf27de8f2a7eca34202f746f53d9ac332000c4a79dac59307bdca42ad809cb5f613ab4a19eb43899dc1f04e9
7
+ data.tar.gz: c71c414fb1431c41899e5ccb438bb3e62fcef18e8f33fcb5580312a0f322bb4fce09ad560df66f3f6dec7893ae9cf3ff5042d11e148001ad2b5a3cdb9eae4bd2
data/lib/mys3ql/mysql.rb CHANGED
@@ -45,9 +45,10 @@ module Mys3ql
45
45
  # https://dev.mysql.com/doc/refman/5.7/en/flush.html#flush-logs
46
46
  # https://dev.mysql.com/doc/refman/5.7/en/flush.html#flush-binary-logs
47
47
  execute 'flush logs'
48
- logs = Dir.glob("#{@config.bin_log}.[0-9]*").sort_by { |f| f[/\d+/].to_i }
49
- logs_to_backup = logs[0..-2] # all logs except the last, which is newly created
50
- logs_to_backup.each do |log_file|
48
+ Dir.glob("#{@config.bin_log}.[0-9]*")
49
+ .sort_by { |f| f[/\d+/].to_i }
50
+ .slice(0..-2) # all logs except the last, which is newly created
51
+ .each do |log_file|
51
52
  yield log_file
52
53
  end
53
54
  end
data/lib/mys3ql/s3.rb CHANGED
@@ -14,7 +14,7 @@ module Mys3ql
14
14
  s3_file = save file, key
15
15
  if dump && s3_file
16
16
  copy_key = key_for :latest
17
- s3_file.copy_to key: copy_key
17
+ s3_file.copy_to bucket: bucket_name, key: copy_key
18
18
  log "s3: copied #{key} to #{copy_key}"
19
19
  end
20
20
  end
@@ -50,7 +50,7 @@ module Mys3ql
50
50
  def get(s3_key, local_file_name)
51
51
  s3.get_object(
52
52
  response_target: local_file_name,
53
- bucket: @config.bucket,
53
+ bucket: bucket_name,
54
54
  key: s3_key
55
55
  )
56
56
  log "s3: pulled #{s3_key} to #{local_file_name}"
@@ -88,20 +88,22 @@ module Mys3ql
88
88
  access_key_id: @config.access_key_id,
89
89
  region: @config.region
90
90
  )
91
- log 's3: connected'
92
91
  client
93
92
  end
94
93
  end
95
94
 
96
95
  def bucket
97
96
  @bucket ||= begin
98
- b = Aws::S3::Bucket.new @config.bucket, client: s3
99
- raise "S3 bucket #{@config.bucket} not found" unless b.exists?
100
- log "s3: opened bucket #{@config.bucket}"
97
+ b = Aws::S3::Bucket.new bucket_name, client: s3
98
+ raise "S3 bucket #{bucket_name} not found" unless b.exists?
101
99
  b
102
100
  end
103
101
  end
104
102
 
103
+ def bucket_name
104
+ @config.bucket
105
+ end
106
+
105
107
  def dumps_prefix
106
108
  "#{@config.database}/dumps"
107
109
  end
@@ -109,9 +111,5 @@ module Mys3ql
109
111
  def bin_logs_prefix
110
112
  "#{@config.database}/bin_logs"
111
113
  end
112
-
113
- def bin_logs_exist?
114
- @config.bin_log && @config.bin_log.length > 0 && File.exist?(@config.bin_log)
115
- end
116
114
  end
117
115
  end
@@ -1,3 +1,3 @@
1
1
  module Mys3ql
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mys3ql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Stewart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-08 00:00:00.000000000 Z
11
+ date: 2021-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3