dumpcar 0.1.2 → 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 072d4fd45f4ca0e706115fb2e45f50dc9f9950e4c0fe87358092917318b91fde
4
- data.tar.gz: f57a226716065e3f34c9bb70c1e0cbc005255aed52204c137e913e850b9d2e25
3
+ metadata.gz: 36f1dd091285da9e5736495a0ffc53e2b73176cc327a6d138f2ea8663e0b4d6a
4
+ data.tar.gz: 38d4fe0b357fc007491a154b6203a31514d22f17a21f38c40cfb0fe64eb7d8c9
5
5
  SHA512:
6
- metadata.gz: 4914d13e5e7ac7c504d1194d62d1f2e64f735021d0acf6518b3c9aea29cad03496ac48cf923c3700321039fee4d72a95cd6b18832156b3d82a13a2a5a91477f6
7
- data.tar.gz: b4dbdf8e423a4e4393cfded8765cb0ae1d76e3426b4f5005de9791261cb278f4f89eb4812034662f1a75c8628952aae5c736037afbd05d22d967cceb5c905da3
6
+ metadata.gz: 0bbe63e7e62033e29df0e1ae907adfbe03edede801be02af50dd551bdc7d98bf41874ff2c46ca790813f18ec34068846f0905fbec696cd78fb61df31978675ec
7
+ data.tar.gz: a9f5a753441535c546e4c2b20af60f8b8b9ea3c4cb42ef9db7aa74bc68780ab84ede78d24d8fd8eea2f11d39a97341a1231d660e164eca8660fa1c07151c6fab
data/.standard.yml CHANGED
@@ -1,3 +1,5 @@
1
1
  # For available configuration options, see:
2
2
  # https://github.com/standardrb/standard
3
3
  ruby_version: 3.2
4
+ ignore:
5
+ - "gemfiles/*.gemfile"
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Dumpcar
2
2
 
3
+ [![Ruby Gem version](https://badge.fury.io/rb/dumpcar.svg)](https://rubygems.org/gems/dumpcar)
4
+
3
5
  Rake tasks for dumping and restoring the contents of the PostgreSQL database for your Rails application.
4
6
 
5
7
  - Dump (`rails dumpcar:dump`) and restore your last dump (`rails dumpcar:restore`) with a single command
@@ -6,16 +6,16 @@ gem "aruba", "~> 2.3"
6
6
  gem "irb"
7
7
  gem "rake", "~> 13.0"
8
8
  gem "rspec", "~> 3.0"
9
- gem "rspec-github", require: false
9
+ gem "rspec-github", :require => false
10
10
  gem "shoulda-matchers"
11
11
  gem "standard", "~> 1.3"
12
12
  gem "combustion"
13
13
  gem "pg"
14
14
  gem "rspec-rails"
15
15
  gem "database_cleaner-active_record"
16
- gem "appraisal", git: "https://github.com/pboling/appraisal.git", ref: "c353e3ee3105a3db8aab49d51df8c159959165a0"
16
+ gem "appraisal", :git => "https://github.com/pboling/appraisal.git", :ref => "c353e3ee3105a3db8aab49d51df8c159959165a0"
17
17
  gem "debug"
18
18
  gem "rails", "~> 6.0.0"
19
19
  gem "concurrent-ruby", "1.3.4"
20
20
 
21
- gemspec path: "../"
21
+ gemspec :path => "../"
@@ -6,16 +6,16 @@ gem "aruba", "~> 2.3"
6
6
  gem "irb"
7
7
  gem "rake", "~> 13.0"
8
8
  gem "rspec", "~> 3.0"
9
- gem "rspec-github", require: false
9
+ gem "rspec-github", :require => false
10
10
  gem "shoulda-matchers"
11
11
  gem "standard", "~> 1.3"
12
12
  gem "combustion"
13
13
  gem "pg"
14
14
  gem "rspec-rails"
15
15
  gem "database_cleaner-active_record"
16
- gem "appraisal", git: "https://github.com/pboling/appraisal.git", ref: "c353e3ee3105a3db8aab49d51df8c159959165a0"
16
+ gem "appraisal", :git => "https://github.com/pboling/appraisal.git", :ref => "c353e3ee3105a3db8aab49d51df8c159959165a0"
17
17
  gem "debug"
18
18
  gem "rails", "~> 6.1.0"
19
19
  gem "concurrent-ruby", "1.3.4"
20
20
 
21
- gemspec path: "../"
21
+ gemspec :path => "../"
@@ -6,16 +6,16 @@ gem "aruba", "~> 2.3"
6
6
  gem "irb"
7
7
  gem "rake", "~> 13.0"
8
8
  gem "rspec", "~> 3.0"
9
- gem "rspec-github", require: false
9
+ gem "rspec-github", :require => false
10
10
  gem "shoulda-matchers"
11
11
  gem "standard", "~> 1.3"
12
12
  gem "combustion"
13
13
  gem "pg"
14
14
  gem "rspec-rails"
15
15
  gem "database_cleaner-active_record"
16
- gem "appraisal", git: "https://github.com/pboling/appraisal.git", ref: "c353e3ee3105a3db8aab49d51df8c159959165a0"
16
+ gem "appraisal", :git => "https://github.com/pboling/appraisal.git", :ref => "c353e3ee3105a3db8aab49d51df8c159959165a0"
17
17
  gem "debug"
18
18
  gem "rails", "~> 7.0.0"
19
19
  gem "concurrent-ruby", "1.3.4"
20
20
 
21
- gemspec path: "../"
21
+ gemspec :path => "../"
@@ -6,15 +6,15 @@ gem "aruba", "~> 2.3"
6
6
  gem "irb"
7
7
  gem "rake", "~> 13.0"
8
8
  gem "rspec", "~> 3.0"
9
- gem "rspec-github", require: false
9
+ gem "rspec-github", :require => false
10
10
  gem "shoulda-matchers"
11
11
  gem "standard", "~> 1.3"
12
12
  gem "combustion"
13
13
  gem "pg"
14
14
  gem "rspec-rails"
15
15
  gem "database_cleaner-active_record"
16
- gem "appraisal", git: "https://github.com/pboling/appraisal.git", ref: "c353e3ee3105a3db8aab49d51df8c159959165a0"
16
+ gem "appraisal", :git => "https://github.com/pboling/appraisal.git", :ref => "c353e3ee3105a3db8aab49d51df8c159959165a0"
17
17
  gem "debug"
18
18
  gem "rails", "~> 7.1.0"
19
19
 
20
- gemspec path: "../"
20
+ gemspec :path => "../"
@@ -6,15 +6,15 @@ gem "aruba", "~> 2.3"
6
6
  gem "irb"
7
7
  gem "rake", "~> 13.0"
8
8
  gem "rspec", "~> 3.0"
9
- gem "rspec-github", require: false
9
+ gem "rspec-github", :require => false
10
10
  gem "shoulda-matchers"
11
11
  gem "standard", "~> 1.3"
12
12
  gem "combustion"
13
13
  gem "pg"
14
14
  gem "rspec-rails"
15
15
  gem "database_cleaner-active_record"
16
- gem "appraisal", git: "https://github.com/pboling/appraisal.git", ref: "c353e3ee3105a3db8aab49d51df8c159959165a0"
16
+ gem "appraisal", :git => "https://github.com/pboling/appraisal.git", :ref => "c353e3ee3105a3db8aab49d51df8c159959165a0"
17
17
  gem "debug"
18
18
  gem "rails", "~> 7.2.0"
19
19
 
20
- gemspec path: "../"
20
+ gemspec :path => "../"
@@ -6,15 +6,15 @@ gem "aruba", "~> 2.3"
6
6
  gem "irb"
7
7
  gem "rake", "~> 13.0"
8
8
  gem "rspec", "~> 3.0"
9
- gem "rspec-github", require: false
9
+ gem "rspec-github", :require => false
10
10
  gem "shoulda-matchers"
11
11
  gem "standard", "~> 1.3"
12
12
  gem "combustion"
13
13
  gem "pg"
14
14
  gem "rspec-rails"
15
15
  gem "database_cleaner-active_record"
16
- gem "appraisal", git: "https://github.com/pboling/appraisal.git", ref: "c353e3ee3105a3db8aab49d51df8c159959165a0"
16
+ gem "appraisal", :git => "https://github.com/pboling/appraisal.git", :ref => "c353e3ee3105a3db8aab49d51df8c159959165a0"
17
17
  gem "debug"
18
18
  gem "rails", "~> 8.0.0"
19
19
 
20
- gemspec path: "../"
20
+ gemspec :path => "../"
@@ -6,15 +6,15 @@ gem "aruba", "~> 2.3"
6
6
  gem "irb"
7
7
  gem "rake", "~> 13.0"
8
8
  gem "rspec", "~> 3.0"
9
- gem "rspec-github", require: false
9
+ gem "rspec-github", :require => false
10
10
  gem "shoulda-matchers"
11
11
  gem "standard", "~> 1.3"
12
12
  gem "combustion"
13
13
  gem "pg"
14
14
  gem "rspec-rails"
15
15
  gem "database_cleaner-active_record"
16
- gem "appraisal", git: "https://github.com/pboling/appraisal.git", ref: "c353e3ee3105a3db8aab49d51df8c159959165a0"
16
+ gem "appraisal", :git => "https://github.com/pboling/appraisal.git", :ref => "c353e3ee3105a3db8aab49d51df8c159959165a0"
17
17
  gem "debug"
18
- gem "rails", github: "rails/rails", branch: "main"
18
+ gem "rails", :github => "rails/rails", :branch => "main"
19
19
 
20
- gemspec path: "../"
20
+ gemspec :path => "../"
@@ -3,7 +3,7 @@ module Dumpcar
3
3
  attr_reader :location, :pg
4
4
  def initialize(base: Rails.root.join("db/dumps"))
5
5
  @location = Location.new(base)
6
- @pg = Pg.new(get_connection_db_config)
6
+ @pg = Pg.new(Dumpcar::Util.get_connection_db_config)
7
7
  end
8
8
 
9
9
  def dump
@@ -13,11 +13,5 @@ module Dumpcar
13
13
  def restore
14
14
  @pg.restore(@location.last)
15
15
  end
16
-
17
- private
18
-
19
- def get_connection_db_config
20
- (Rails.version < "6.1") ? ActiveRecord::Base.connection_config : ActiveRecord::Base.connection_db_config.configuration_hash
21
- end
22
16
  end
23
17
  end
data/lib/dumpcar/pg.rb CHANGED
@@ -12,9 +12,8 @@ module Dumpcar
12
12
  config => {password:, host:, port:, username:, database:}
13
13
  line = Terrapin::CommandLine.new("pg_restore",
14
14
  "--verbose --clean --no-acl --no-owner -h :host -U :username -d :database -p :port :filename",
15
- environment: {"PGPASSWORD" => password})
16
-
17
- puts line.command(password:, host:, port:, username:, database:, filename:)
15
+ environment: {"PGPASSWORD" => password},
16
+ logger:)
18
17
  line.run(password:, host:, port:, username:, database:, filename:)
19
18
  end
20
19
  end
@@ -24,8 +23,8 @@ module Dumpcar
24
23
  config => {password:, host:, port:, username:, database:}
25
24
  line = Terrapin::CommandLine.new("pg_dump",
26
25
  "--host :host --port :port --username :username --clean --format=c --create --if-exists --no-owner --no-acl :database --file=:filename",
27
- environment: {"PGPASSWORD" => password})
28
- puts line.command(password:, host:, port:, username:, database:, filename:)
26
+ environment: {"PGPASSWORD" => password},
27
+ logger:)
29
28
  line.run(password:, host:, port:, username:, database:, filename:)
30
29
  end
31
30
  end
@@ -34,6 +33,10 @@ module Dumpcar
34
33
  yield self.class.defaults.merge(connection)
35
34
  end
36
35
 
36
+ def logger
37
+ Dumpcar::Util.logger
38
+ end
39
+
37
40
  def self.defaults
38
41
  {
39
42
  host: "localhost",
@@ -0,0 +1,9 @@
1
+ module Dumpcar::Util
2
+ def self.get_connection_db_config
3
+ (Rails.version < "6.1") ? ActiveRecord::Base.connection_config : ActiveRecord::Base.connection_db_config.configuration_hash
4
+ end
5
+
6
+ def self.logger
7
+ Rails.logger
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dumpcar
4
- VERSION = "0.1.2"
4
+ VERSION = "0.2"
5
5
  end
data/lib/dumpcar.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "dumpcar/version"
2
2
  require "dumpcar/location"
3
3
  require "dumpcar/pg"
4
+ require "dumpcar/util"
4
5
  require "dumpcar/instance"
5
6
  require "dumpcar/railtie" if defined?(Rails)
6
7
 
data/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "lint-staged": {
11
11
  "*.{js,css,md,yml}": "prettier --write",
12
- "*.{rb,rake,gemspec,ru,gemfile}": "bin/standardrb --fix",
12
+ "*.{rb,rake,gemspec,ru}": "bin/standardrb --fix",
13
13
  "Gemfile": "bin/standardrb --fix"
14
14
  }
15
15
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dumpcar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Schultz
@@ -75,6 +75,7 @@ files:
75
75
  - lib/dumpcar/location.rb
76
76
  - lib/dumpcar/pg.rb
77
77
  - lib/dumpcar/railtie.rb
78
+ - lib/dumpcar/util.rb
78
79
  - lib/dumpcar/version.rb
79
80
  - lib/rails/commands/dumpcar_command.rb
80
81
  - package-lock.json