backy_rb 0.1.6 → 0.1.8

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: 5869c45131402a06e9bd79a71e3cc82a3a0e867006fa9fa9b9f46bb7f1bd60b8
4
- data.tar.gz: 614e88a654a7fd62d4426f8bbe1966ac3727229dbfe3d38dd5b171ae76e0bd9f
3
+ metadata.gz: 9d66c6c91f2f5538af37756b5dc6e2759330b0b33914647cf0aa0b1f3ee376cc
4
+ data.tar.gz: 20856cc301a8590f8d60200664995b0ab408f76f15e077bc931d3c828fc11658
5
5
  SHA512:
6
- metadata.gz: c731f5764a173ba08cae49dc3abf6b4212b4b9b5f66757849b88b9be49511c13cd92fe8d64fb65e468992108b32ac877e1c2049afb5d390d8529f29092e746c4
7
- data.tar.gz: 6e068f09ffaecbe95b9857cd947584a86ba3c0b18b70698cb709b91aa0711706de950121d47dbd03af91d0d3e610d790c2317296e742fcdf7e56456721f76abe
6
+ metadata.gz: 62cd5a81471ef89e5ff57195b32ae4e9307a3f31a14f3bc9ee1a931b6534c4922406198aa30756fda197f2c60c279fefd76b46912419d348f3fe8922bccca978
7
+ data.tar.gz: 1541af37d97d53e039b598da4ce53dd1a119e69f77fed1d9251ea6f839a31a72e3d06a324ed3832f053670d0c41350e013b40418ad425971ee73f31df1d95e76
data/CHANGELOG.md CHANGED
@@ -1,8 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to `Backy` will be documented in this file.
4
+
1
5
  ## [Unreleased]
2
6
 
3
- ## [0.1.4] - 2023-12-28
4
- - Adds CLI
7
+ ## [0.1.8] - 2024-06-22
8
+ ### Fixed
9
+ - Ensure that the dependencies are installed
10
+
11
+ ## [0.1.7] - 2024-06-21
12
+ ### Added
13
+ - Support for setting database params via PG_URL
14
+ - Make S3 bucket prefix configurable
15
+
16
+ ## [0.1.6] - 2023-12-28
17
+ ### Added
18
+ - Support for parallel pg_dump processes.
19
+ - Support for parallel pg_restore processes.
20
+ - Added CLI
5
21
 
6
- ## [0.1.0] - 2023-03-30
22
+ ### Changed
23
+ - Improved performance of the backup process.
24
+ - Rename gem from `backy` to `backy_rb`.
7
25
 
8
- - Initial release
26
+ ## [0.1.3] - 2023-06-23
27
+ - Initial release of `Backy`.
28
+ - Support for AWS S3 integration.
29
+ - Rails application auto-configuration feature.
data/Gemfile CHANGED
@@ -11,10 +11,4 @@ gem "rspec", "~> 3.0"
11
11
 
12
12
  gem "standard", "~> 1.3"
13
13
 
14
- gem "aws-sdk-s3", "~> 1.117"
15
-
16
- gem "pg"
17
-
18
- gem "thor", "~> 1.2"
19
-
20
14
  gem "puma"
data/Gemfile.lock CHANGED
@@ -1,10 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- backy_rb (0.1.3)
4
+ backy_rb (0.1.8)
5
5
  activerecord (>= 4.0)
6
6
  activesupport (>= 4.0)
7
7
  aws-sdk-s3 (>= 1.117)
8
+ pg (~> 1.5)
9
+ thor (~> 1.2)
8
10
 
9
11
  GEM
10
12
  remote: https://rubygems.org/
@@ -136,7 +138,7 @@ GEM
136
138
  parallel (1.22.1)
137
139
  parser (3.2.1.1)
138
140
  ast (~> 2.4.1)
139
- pg (1.5.3)
141
+ pg (1.5.6)
140
142
  puma (6.3.0)
141
143
  nio4r (~> 2.0)
142
144
  racc (1.7.1)
@@ -228,14 +230,13 @@ GEM
228
230
 
229
231
  PLATFORMS
230
232
  arm64-darwin-22
233
+ arm64-darwin-23
231
234
  x86_64-linux
232
235
 
233
236
  DEPENDENCIES
234
- aws-sdk-s3 (~> 1.117)
235
237
  backy_rb!
236
238
  brakeman (~> 5.4)
237
239
  faker (>= 3.1)
238
- pg
239
240
  puma
240
241
  rails (>= 4.0)
241
242
  rake (~> 13.0)
@@ -245,7 +246,6 @@ DEPENDENCIES
245
246
  rubocop-rake (~> 0.6.0)
246
247
  rubocop-rspec (~> 2.18)
247
248
  standard (~> 1.3)
248
- thor (~> 1.2)
249
249
  timecop (~> 0.9.6)
250
250
  zlib (~> 3.0)
251
251
 
data/backy_rb.gemspec CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.version = Backy::VERSION
8
8
  spec.authors = ["Alexey Kharchenko", "Martin Ulleberg", "Pål André Sundt"]
9
9
  spec.email = ["akharchenko@gmail.com", "martin.ulleberg@gmail.com", "pal@rubynor.com"]
10
+ spec.license = "MIT"
10
11
 
11
12
  spec.summary = "Backy is a powerful and user-friendly database backup gem designed specifically for Ruby on Rails applications. It streamlines the backup process, ensuring your data is safe, secure, and easily retrievable. With its versatile features and easy integration, Backy is the go-to solution for Rails developers looking to protect their valuable information."
12
13
  spec.description = "Backy is a comprehensive database backup solution for Ruby on Rails applications, created to help developers manage and safeguard their data with ease. This robust gem offers a wide range of features"
@@ -43,6 +44,9 @@ Gem::Specification.new do |spec|
43
44
  spec.add_dependency "activerecord", ">= 4.0"
44
45
  spec.add_dependency "activesupport", ">= 4.0"
45
46
  spec.add_dependency "aws-sdk-s3", ">= 1.117"
47
+ spec.add_dependency "pg", "~> 1.5"
48
+ spec.add_dependency "thor", "~> 1.2"
49
+
46
50
  # For more information and examples about making a new gem, check out our
47
51
  # guide at: https://bundler.io/guides/creating_gem.html
48
52
  end
@@ -10,6 +10,7 @@ module Backy
10
10
  :s3_access_key,
11
11
  :s3_secret,
12
12
  :s3_bucket,
13
+ :s3_prefix,
13
14
  :app_name,
14
15
  :environment,
15
16
  :use_parallel,
@@ -25,6 +26,20 @@ module Backy
25
26
  load_from_file(config_file) if File.exist?(config_file)
26
27
  end
27
28
 
29
+ def pg_url=(url)
30
+ @pg_url = url
31
+ pg_config = parse_postgres_uri(url)
32
+ @pg_host = pg_config[:host]
33
+ @pg_port = pg_config[:port]
34
+ @pg_username = pg_config[:username]
35
+ @pg_password = pg_config[:password]
36
+ @pg_database = pg_config[:database_name]
37
+ end
38
+
39
+ def pg_url
40
+ @pg_url ||= ENV["PG_URL"]
41
+ end
42
+
28
43
  def pg_host
29
44
  @pg_host ||= ENV["PG_HOST"]
30
45
  end
@@ -61,6 +76,12 @@ module Backy
61
76
  @s3_bucket ||= ENV["S3_BUCKET"]
62
77
  end
63
78
 
79
+ def s3_prefix
80
+ @s3_prefix ||= ENV["S3_PREFIX"].presence || "/db/dump/"
81
+ end
82
+
83
+
84
+
64
85
  def use_parallel
65
86
  @use_parallel ||= ENV["BACKY_USE_PARALLEL"] == "true"
66
87
  end
@@ -113,17 +134,36 @@ module Backy
113
134
  @s3_secret = configuration.dig("defaults", "s3", "secret_access_key")
114
135
  @s3_region = configuration.dig("defaults", "s3", "region")
115
136
  @s3_bucket = configuration.dig("defaults", "s3", "bucket")
137
+ @s3_prefix = configuration.dig("defaults", "s3", "prefix") || s3_prefix
116
138
 
117
- @pg_host = configuration.dig("defaults", "database", "host")
118
- @pg_port = configuration.dig("defaults", "database", "port")
119
- @pg_username = configuration.dig("defaults", "database", "username")
120
- @pg_password = configuration.dig("defaults", "database", "password")
121
- @pg_database = configuration.dig("defaults", "database", "database_name")
139
+ @pg_url = configuration.dig("defaults", "database", "pg_url")
140
+ if @pg_url
141
+ self.pg_url = @pg_url
142
+ else
143
+ @pg_host = configuration.dig("defaults", "database", "host")
144
+ @pg_port = configuration.dig("defaults", "database", "port")
145
+ @pg_username = configuration.dig("defaults", "database", "username")
146
+ @pg_password = configuration.dig("defaults", "database", "password")
147
+ @pg_database = configuration.dig("defaults", "database", "database_name")
148
+ end
122
149
 
123
150
  @app_name = configuration.dig("defaults", "app_name") || "backy"
124
151
  @environment = configuration.dig("defaults", "environment") || "development"
125
152
  @log_file = configuration.dig("defaults", "log", "file") || default_log_file
126
153
  @use_parallel = configuration.dig("defaults", "use_parallel") || false
127
154
  end
155
+
156
+ def parse_postgres_uri(uri)
157
+ parsed_uri = URI.parse(uri)
158
+
159
+ {
160
+ adapter: "postgresql",
161
+ host: parsed_uri.host,
162
+ port: parsed_uri.port,
163
+ username: parsed_uri.user,
164
+ password: parsed_uri.password,
165
+ database_name: parsed_uri.path[1..]
166
+ }
167
+ end
128
168
  end
129
169
  end
data/lib/backy/s3.rb CHANGED
@@ -11,6 +11,7 @@ module Backy
11
11
  def_delegator "Backy.configuration", :s3_secret, :secret
12
12
  def_delegator "Backy.configuration", :s3_bucket, :bucket
13
13
  def_delegator "Backy.configuration", :s3_access_key, :access_key
14
+ def_delegator "Backy.configuration", :s3_prefix, :prefix
14
15
 
15
16
  def s3
16
17
  @s3 ||= Aws::S3::Client.new(region: region, credentials: s3_credentials)
data/lib/backy/s3_list.rb CHANGED
@@ -2,12 +2,6 @@ module Backy
2
2
  class S3List
3
3
  include S3
4
4
 
5
- DEFAULT_PREFIX = "db/dump/"
6
-
7
- def initialize(prefix: nil)
8
- @prefix = prefix || DEFAULT_PREFIX
9
- end
10
-
11
5
  def call
12
6
  return [] unless s3_configured?
13
7
 
@@ -23,9 +17,5 @@ module Backy
23
17
 
24
18
  result.sort
25
19
  end
26
-
27
- private
28
-
29
- attr_reader :prefix
30
20
  end
31
21
  end
data/lib/backy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Backy
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backy_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Kharchenko
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-12-28 00:00:00.000000000 Z
13
+ date: 2024-06-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -208,6 +208,34 @@ dependencies:
208
208
  - - ">="
209
209
  - !ruby/object:Gem::Version
210
210
  version: '1.117'
211
+ - !ruby/object:Gem::Dependency
212
+ name: pg
213
+ requirement: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - "~>"
216
+ - !ruby/object:Gem::Version
217
+ version: '1.5'
218
+ type: :runtime
219
+ prerelease: false
220
+ version_requirements: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - "~>"
223
+ - !ruby/object:Gem::Version
224
+ version: '1.5'
225
+ - !ruby/object:Gem::Dependency
226
+ name: thor
227
+ requirement: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - "~>"
230
+ - !ruby/object:Gem::Version
231
+ version: '1.2'
232
+ type: :runtime
233
+ prerelease: false
234
+ version_requirements: !ruby/object:Gem::Requirement
235
+ requirements:
236
+ - - "~>"
237
+ - !ruby/object:Gem::Version
238
+ version: '1.2'
211
239
  description: Backy is a comprehensive database backup solution for Ruby on Rails applications,
212
240
  created to help developers manage and safeguard their data with ease. This robust
213
241
  gem offers a wide range of features
@@ -252,7 +280,8 @@ files:
252
280
  - lib/backy_rb.rb
253
281
  - lib/tasks/backy_tasks.rake
254
282
  homepage: https://rubynor.com
255
- licenses: []
283
+ licenses:
284
+ - MIT
256
285
  metadata:
257
286
  homepage_uri: https://rubynor.com
258
287
  source_code_uri: https://github.com/rubynor/backy
@@ -272,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
301
  - !ruby/object:Gem::Version
273
302
  version: '0'
274
303
  requirements: []
275
- rubygems_version: 3.4.22
304
+ rubygems_version: 3.5.5
276
305
  signing_key:
277
306
  specification_version: 4
278
307
  summary: Backy is a powerful and user-friendly database backup gem designed specifically