dumpcar 0.1.1.1 → 0.1.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: b2ab13e4c4ec4b67f0fa62cd68525e308e976bbd40fbf9471588518e4de1db87
4
- data.tar.gz: e7553577c3fe9e2943ec58e5aa5e377ece8d00b9fe02433ce8572ba4ebe98bd8
3
+ metadata.gz: 072d4fd45f4ca0e706115fb2e45f50dc9f9950e4c0fe87358092917318b91fde
4
+ data.tar.gz: f57a226716065e3f34c9bb70c1e0cbc005255aed52204c137e913e850b9d2e25
5
5
  SHA512:
6
- metadata.gz: 167de13c0087212017f8279554ff6568fabe5128548f3e275ea7f35025d06d4bab57eae6a9b7a8897dab711146e5eaa8172c6acf32cc0492f9d8dd09aab21ebb
7
- data.tar.gz: 9f8074cfa59529bfae515a15c5d821f1f4bb65fcdbb3fab16802a2ce2e4ff06aee3609bff57571e1397939a9145b9e5bcde67f64275acd3373d262d4441cc5b1
6
+ metadata.gz: 4914d13e5e7ac7c504d1194d62d1f2e64f735021d0acf6518b3c9aea29cad03496ac48cf923c3700321039fee4d72a95cd6b18832156b3d82a13a2a5a91477f6
7
+ data.tar.gz: b4dbdf8e423a4e4393cfded8765cb0ae1d76e3426b4f5005de9791261cb278f4f89eb4812034662f1a75c8628952aae5c736037afbd05d22d967cceb5c905da3
data/README.md CHANGED
@@ -57,3 +57,4 @@ Everyone interacting in the Dumpcar project's codebases, issue trackers, chat ro
57
57
 
58
58
  1. Update the version in the `lib/dumpcar/version.rb`
59
59
  2. Run the Push Gem workflow
60
+ 3. Create a new release from the UI for the new tag
data/lib/dumpcar/pg.rb CHANGED
@@ -3,24 +3,30 @@ module Dumpcar
3
3
  attr_reader :connection
4
4
 
5
5
  def initialize(connection)
6
+ require "terrapin"
6
7
  @connection = connection
7
8
  end
8
9
 
9
10
  def restore(filename)
10
11
  with_database_config do |config|
11
12
  config => {password:, host:, port:, username:, database:}
12
- result = "PGPASSWORD=#{password} pg_restore --verbose --clean --no-acl --no-owner -h #{host} -U #{username} -d #{database} -p #{port} #{filename}"
13
- puts result
14
- `#{result} `
13
+ line = Terrapin::CommandLine.new("pg_restore",
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:)
18
+ line.run(password:, host:, port:, username:, database:, filename:)
15
19
  end
16
20
  end
17
21
 
18
22
  def dump(filename)
19
23
  with_database_config do |config|
20
24
  config => {password:, host:, port:, username:, database:}
21
- result = "PGPASSWORD=#{password} pg_dump --host #{host} --port #{port} --username #{username} --clean --format=c --create --if-exists --no-owner --no-acl #{database} --file=#{filename}"
22
- puts result
23
- `#{result} `
25
+ line = Terrapin::CommandLine.new("pg_dump",
26
+ "--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:)
29
+ line.run(password:, host:, port:, username:, database:, filename:)
24
30
  end
25
31
  end
26
32
 
@@ -1,9 +1,5 @@
1
1
  module Dumpcar
2
2
  class Railtie < Rails::Railtie
3
- rake_tasks do
4
- load "dumpcar/tasks/dump.rake"
5
- end
6
-
7
3
  generators do
8
4
  load "dumpcar/generators/dumpcar_generator.rb"
9
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dumpcar
4
- VERSION = "0.1.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -0,0 +1,15 @@
1
+ class DumpcarCommand < Rails::Command::Base
2
+ class_option :base, type: :string, desc: "the location of your DB dumps, defaults to Rails.root.join('db/dumps')"
3
+
4
+ desc "dump", "Dump postgres backup file"
5
+ def dump
6
+ require "dumpcar"
7
+ Dumpcar::Instance.new.dump
8
+ end
9
+
10
+ desc "restore", "Restore postgres backup file"
11
+ def restore
12
+ require "dumpcar"
13
+ Dumpcar::Instance.new.restore
14
+ end
15
+ end
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Schultz
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '6'
26
+ - !ruby/object:Gem::Dependency
27
+ name: terrapin
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '1'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '1'
26
40
  email:
27
41
  - eric@wwahammy.com
28
42
  executables: []
@@ -61,8 +75,8 @@ files:
61
75
  - lib/dumpcar/location.rb
62
76
  - lib/dumpcar/pg.rb
63
77
  - lib/dumpcar/railtie.rb
64
- - lib/dumpcar/tasks/dump.rake
65
78
  - lib/dumpcar/version.rb
79
+ - lib/rails/commands/dumpcar_command.rb
66
80
  - package-lock.json
67
81
  - package.json
68
82
  homepage: https://github.com/wwahammy/dumpcar
@@ -87,5 +101,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
101
  requirements: []
88
102
  rubygems_version: 3.6.7
89
103
  specification_version: 4
90
- summary: Rake tasks for dumping and restoring Rails PostgreSQL database contents
104
+ summary: Commands for dumping and restoring Rails PostgreSQL database contents
91
105
  test_files: []
@@ -1,17 +0,0 @@
1
- namespace :dumpcar do
2
- namespace :pg do
3
- desc "Dumped postgres backup file"
4
- task dump: :environment do
5
- Dumpcar.dump
6
- end
7
-
8
- desc "Load dumped postgres backup file"
9
- task restore: :environment do
10
- Dumpcar.restore
11
- end
12
-
13
- def say(something)
14
- puts(something)
15
- end
16
- end
17
- end