backhoe 0.4.1 → 0.6.1
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 +4 -4
- data/.github/workflows/ci.yml +26 -0
- data/.gitignore +2 -0
- data/Appraisals +4 -8
- data/README.md +16 -20
- data/backhoe.gemspec +2 -1
- data/gemfiles/{activerecord_5.1.gemfile → activerecord_7.0.gemfile} +1 -1
- data/lib/backhoe/backup.rb +28 -0
- data/lib/backhoe/database.rb +42 -0
- data/lib/backhoe/{mysql.rb → dump.rb} +34 -37
- data/lib/backhoe/load.rb +45 -0
- data/lib/backhoe/version.rb +1 -1
- data/lib/backhoe.rb +10 -19
- metadata +27 -18
- data/.travis.yml +0 -11
- data/gemfiles/activerecord_5.1.gemfile.lock +0 -65
- data/gemfiles/activerecord_5.2.gemfile +0 -7
- data/gemfiles/activerecord_5.2.gemfile.lock +0 -65
- data/gemfiles/activerecord_6.0.gemfile.lock +0 -65
- data/gemfiles/activerecord_6.1.gemfile.lock +0 -64
- data/lib/backhoe/base.rb +0 -14
- data/lib/backhoe/postgresql.rb +0 -18
- data/lib/backhoe/sqlite.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da54b2284a8f477b20d0175cdb1023ffd28e03365598000e8cdf7403fb12dc4
|
4
|
+
data.tar.gz: a298c3b656be2bd65b52731ae749d27317b5bbd26e2401370a4ccbbfc22f73c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90cf47702daa8c845795bfba48175718016f3f929b34c3924d86ad3d51979ca91e2cfae4973d2839197ec333e8735c92b02347095256674f444998ec951118e8
|
7
|
+
data.tar.gz: 335c9e882afd7c4f8591f8b449b4cc1dc3205d74d7194a1112a0b2b9492af30223ebddad7c18583db96471ac2663e7b360eb569a40e8b9e91bd5ba6db4af32a2
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
strategy:
|
6
|
+
fail-fast: false
|
7
|
+
matrix:
|
8
|
+
gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0 ]
|
9
|
+
ruby: [ '3.0', 3.1, 3.2 ]
|
10
|
+
|
11
|
+
runs-on: ubuntu-20.04
|
12
|
+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
13
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
14
|
+
steps:
|
15
|
+
- name: Set up MySQL
|
16
|
+
run: |
|
17
|
+
sudo /etc/init.d/mysql start
|
18
|
+
sudo mysql -uroot -proot -e"ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '';"
|
19
|
+
- uses: actions/checkout@v3
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
24
|
+
cache-version: 10
|
25
|
+
- run: bundle exec rake
|
26
|
+
|
data/.gitignore
CHANGED
data/Appraisals
CHANGED
@@ -1,11 +1,3 @@
|
|
1
|
-
appraise "activerecord-5.1" do
|
2
|
-
gem "activerecord", "~>5.1.0"
|
3
|
-
end
|
4
|
-
|
5
|
-
appraise "activerecord-5.2" do
|
6
|
-
gem "activerecord", "~>5.2.0"
|
7
|
-
end
|
8
|
-
|
9
1
|
appraise "activerecord-6.0" do
|
10
2
|
gem "activerecord", "~>6.0.0"
|
11
3
|
end
|
@@ -14,3 +6,7 @@ appraise "activerecord-6.1" do
|
|
14
6
|
gem "activerecord", "~>6.1.0"
|
15
7
|
end
|
16
8
|
|
9
|
+
appraise "activerecord-7.0" do
|
10
|
+
gem "activerecord", "~>7.0.0"
|
11
|
+
end
|
12
|
+
|
data/README.md
CHANGED
@@ -1,33 +1,29 @@
|
|
1
1
|
# Backhoe
|
2
|
-
[](https://github.com/botandrose/backhoe/actions?query=workflow%3ACI+branch%3Amaster)
|
3
3
|
|
4
4
|
Dump and load current ActiveRecord database to and from a file.
|
5
5
|
|
6
|
-
##
|
7
|
-
|
8
|
-
Add this line to your application's Gemfile:
|
6
|
+
## Usage
|
9
7
|
|
10
8
|
```ruby
|
11
|
-
|
9
|
+
# Dump
|
10
|
+
Backhoe.dump "data.sql" # dumps db to db/data.sql
|
11
|
+
Backhoe.dump "data.sql.gz" # => can also dump a gzipped sql file
|
12
|
+
Backhoe.dump "data.sql", skip_tables: [:comments], skip_columns: { users: [:password] } # can skip whole tables or just specific columns
|
13
|
+
|
14
|
+
# Load
|
15
|
+
Backhoe.load "data.sql" # loads db from db/data.sql
|
16
|
+
Backhoe.load "data.sql.gz" # => can also load a gzipped sql file
|
17
|
+
Backhoe.load "data.sql", drop_and_create: true # injects DROP and CREATE statements into the SQL invocation
|
18
|
+
|
19
|
+
# Backup db to S3
|
20
|
+
Backhoe.backup "bucket-name/folder" # => dumps db to e.g. s3://bucket-name/folder/2023-04-09T16:41:26Z.sql.gz via AWS CLI, assuming that credentials are already configured.
|
21
|
+
Backhoe.backup "bucket-name/folder", access_key: "abc123", secret_key: "def456" # => manually specify AWS creds
|
12
22
|
```
|
13
23
|
|
14
|
-
And then execute:
|
15
|
-
|
16
|
-
$ bundle
|
17
|
-
|
18
|
-
Or install it yourself as:
|
19
|
-
|
20
|
-
$ gem install backhoe
|
21
|
-
|
22
|
-
## Usage
|
23
|
-
|
24
|
-
TODO: Write usage instructions here
|
25
|
-
|
26
24
|
## Development
|
27
25
|
|
28
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake
|
29
|
-
|
30
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
26
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
27
|
|
32
28
|
## Contributing
|
33
29
|
|
data/backhoe.gemspec
CHANGED
@@ -23,9 +23,10 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_dependency "activerecord"
|
25
25
|
|
26
|
-
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rake"
|
27
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
28
28
|
spec.add_development_dependency "appraisal"
|
29
29
|
spec.add_development_dependency "mysql2"
|
30
30
|
spec.add_development_dependency "byebug"
|
31
|
+
spec.add_development_dependency "timecop"
|
31
32
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Backhoe
|
2
|
+
class Backup < Struct.new(:s3_path, :access_key, :secret_key)
|
3
|
+
def call
|
4
|
+
Backhoe.dump path
|
5
|
+
Kernel.system "#{creds} aws s3 mv #{path} s3://#{s3_path}/#{filename}".strip
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def creds
|
11
|
+
if access_key && secret_key
|
12
|
+
"AWS_ACCESS_KEY_ID=#{access_key} AWS_SECRET_ACCESS_KEY=#{secret_key}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def path
|
17
|
+
"/tmp/#{filename}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def filename
|
21
|
+
@filename ||= begin
|
22
|
+
require "time"
|
23
|
+
"#{Time.now.utc.iso8601}.sql.gz"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Backhoe
|
2
|
+
class Database
|
3
|
+
def initialize config=load_config
|
4
|
+
@config = config
|
5
|
+
end
|
6
|
+
|
7
|
+
attr_reader :config
|
8
|
+
|
9
|
+
def current_environment_name
|
10
|
+
[
|
11
|
+
defined?(Rails) && Rails.env,
|
12
|
+
ENV["RAILS_ENV"],
|
13
|
+
"development",
|
14
|
+
].find(&:itself)
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_mysql_options
|
18
|
+
options = " -u #{config["username"]}"
|
19
|
+
options += " -p'#{config["password"]}'" if config["password"]
|
20
|
+
options += " -h #{config["host"]}" if config["host"]
|
21
|
+
options += " -S #{config["socket"]}" if config["socket"]
|
22
|
+
options
|
23
|
+
end
|
24
|
+
|
25
|
+
def name
|
26
|
+
config["database"]
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def load_config
|
32
|
+
configs = ActiveRecord::Base.configurations
|
33
|
+
config = configs.configs_for(env_name: current_environment_name).first
|
34
|
+
hash = if config.respond_to?(:configuration_hash)
|
35
|
+
config.configuration_hash # rails 7
|
36
|
+
else
|
37
|
+
config.config # rails 6
|
38
|
+
end
|
39
|
+
HashWithIndifferentAccess.new(hash)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,50 +1,49 @@
|
|
1
|
-
require "
|
1
|
+
require "rake"
|
2
2
|
|
3
3
|
module Backhoe
|
4
|
-
class
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
class Dump < Struct.new(:database, :file_path, :skip_tables, :skip_columns)
|
5
|
+
include Rake::DSL
|
6
|
+
|
7
|
+
def initialize *args
|
8
|
+
super
|
9
|
+
self.skip_tables ||= []
|
10
|
+
self.skip_columns ||= {}
|
9
11
|
end
|
10
12
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
def call
|
14
|
+
if skip_columns.any?
|
15
|
+
SanitizedDatabase.new(skip_columns, file_path).dump do |tables|
|
16
|
+
self.skip_tables += tables
|
17
|
+
dump
|
18
|
+
end
|
19
|
+
else
|
20
|
+
dump
|
21
|
+
end
|
15
22
|
end
|
16
23
|
|
17
24
|
private
|
18
25
|
|
19
|
-
def
|
20
|
-
|
21
|
-
"--ignore-table=#{config["database"]}.#{table}"
|
22
|
-
end.join(" ")
|
26
|
+
def dump
|
27
|
+
sh "#{mysqldump} --no-create-db --single-transaction --quick -e #{skip_table_options} #{database.to_mysql_options} #{database.name} | #{pipe} > #{file_path}"
|
23
28
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def mysqldump
|
33
|
+
cmd = `which mysqldump`.strip
|
34
|
+
raise RuntimeError, "Cannot find mysqldump." if cmd.blank?
|
35
|
+
cmd
|
31
36
|
end
|
32
|
-
end
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
if skip_columns = options.delete(:skip_columns)
|
37
|
-
SanitizedDatabase.new(skip_columns, file_path).dump do |skip_tables|
|
38
|
-
options[:skip_tables] ||= []
|
39
|
-
options[:skip_tables] += skip_tables
|
40
|
-
super options
|
41
|
-
end
|
42
|
-
else
|
43
|
-
super
|
44
|
-
end
|
38
|
+
def pipe
|
39
|
+
file_path =~ /\.gz$/ ? "gzip -9f" : "cat"
|
45
40
|
end
|
46
41
|
|
47
|
-
|
42
|
+
def skip_table_options
|
43
|
+
skip_tables.map do |table|
|
44
|
+
"--ignore-table=#{database.name}.#{table}"
|
45
|
+
end.join(" ")
|
46
|
+
end
|
48
47
|
|
49
48
|
class SanitizedDatabase < Struct.new(:config, :file_path)
|
50
49
|
def dump
|
@@ -89,8 +88,6 @@ module Backhoe
|
|
89
88
|
end
|
90
89
|
end
|
91
90
|
end
|
92
|
-
Mysql.prepend MysqlSkipColumns
|
93
|
-
|
94
|
-
Mysql2 = Mysql
|
95
91
|
end
|
96
92
|
|
93
|
+
|
data/lib/backhoe/load.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require "rake"
|
2
|
+
|
3
|
+
module Backhoe
|
4
|
+
class Load < Struct.new(:database, :file_path, :drop_and_create)
|
5
|
+
include Rake::DSL
|
6
|
+
|
7
|
+
def call
|
8
|
+
sh command
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def command
|
14
|
+
cmd = "#{cat} #{file_path} | "
|
15
|
+
cmd += if drop_and_create
|
16
|
+
"#{pipe} | #{mysql} #{database.to_mysql_options}"
|
17
|
+
else
|
18
|
+
"#{mysql} #{database.to_mysql_options} #{database.name}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def cat
|
23
|
+
file_path =~ /\.gz$/ ? "zcat" : "cat"
|
24
|
+
end
|
25
|
+
|
26
|
+
def pipe
|
27
|
+
if drop_and_create
|
28
|
+
"(echo -n '#{<<~SQL}' && cat)"
|
29
|
+
DROP DATABASE IF EXISTS #{database.name};
|
30
|
+
CREATE DATABASE #{database.name};
|
31
|
+
USE #{database.name};
|
32
|
+
SQL
|
33
|
+
else
|
34
|
+
"cat"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def mysql
|
39
|
+
cmd = `which mysql`.strip
|
40
|
+
raise RuntimeError, "Cannot find mysql." if cmd.blank?
|
41
|
+
cmd
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
data/lib/backhoe/version.rb
CHANGED
data/lib/backhoe.rb
CHANGED
@@ -1,31 +1,22 @@
|
|
1
1
|
require "backhoe/version"
|
2
|
-
require "backhoe/
|
3
|
-
require "backhoe/
|
4
|
-
require "backhoe/
|
2
|
+
require "backhoe/dump"
|
3
|
+
require "backhoe/load"
|
4
|
+
require "backhoe/backup"
|
5
|
+
require "backhoe/database"
|
5
6
|
require "active_record"
|
6
7
|
|
7
8
|
module Backhoe
|
8
|
-
mattr_accessor(:file_path) { "db/data.sql" }
|
9
|
-
|
10
9
|
class << self
|
11
|
-
def dump file_path:
|
12
|
-
|
10
|
+
def dump file_path, skip_tables: [], skip_columns: {}
|
11
|
+
Dump.new(Database.new, file_path, skip_tables, skip_columns).call
|
13
12
|
end
|
14
13
|
|
15
|
-
def load file_path:
|
16
|
-
|
14
|
+
def load file_path, drop_and_create: false
|
15
|
+
Load.new(Database.new, file_path, drop_and_create).call
|
17
16
|
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
def autodetect_adapter
|
22
|
-
const_get(database_config["adapter"].camelize)
|
23
|
-
end
|
24
|
-
|
25
|
-
def database_config
|
26
|
-
env = Rails.env || "development"
|
27
|
-
config = ActiveRecord::Base.configurations[env]
|
28
|
-
HashWithIndifferentAccess.new(config)
|
18
|
+
def backup s3_path, access_key: nil, secret_key: nil
|
19
|
+
Backup.new(s3_path, access_key, secret_key).call
|
29
20
|
end
|
30
21
|
end
|
31
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backhoe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: timecop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Dump and load current database to and from a file.
|
98
112
|
email:
|
99
113
|
- micah@botandrose.com
|
@@ -101,9 +115,9 @@ executables: []
|
|
101
115
|
extensions: []
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
118
|
+
- ".github/workflows/ci.yml"
|
104
119
|
- ".gitignore"
|
105
120
|
- ".rspec"
|
106
|
-
- ".travis.yml"
|
107
121
|
- Appraisals
|
108
122
|
- Gemfile
|
109
123
|
- LICENSE.txt
|
@@ -113,19 +127,14 @@ files:
|
|
113
127
|
- bin/console
|
114
128
|
- bin/setup
|
115
129
|
- gemfiles/.bundle/config
|
116
|
-
- gemfiles/activerecord_5.1.gemfile
|
117
|
-
- gemfiles/activerecord_5.1.gemfile.lock
|
118
|
-
- gemfiles/activerecord_5.2.gemfile
|
119
|
-
- gemfiles/activerecord_5.2.gemfile.lock
|
120
130
|
- gemfiles/activerecord_6.0.gemfile
|
121
|
-
- gemfiles/activerecord_6.0.gemfile.lock
|
122
131
|
- gemfiles/activerecord_6.1.gemfile
|
123
|
-
- gemfiles/
|
132
|
+
- gemfiles/activerecord_7.0.gemfile
|
124
133
|
- lib/backhoe.rb
|
125
|
-
- lib/backhoe/
|
126
|
-
- lib/backhoe/
|
127
|
-
- lib/backhoe/
|
128
|
-
- lib/backhoe/
|
134
|
+
- lib/backhoe/backup.rb
|
135
|
+
- lib/backhoe/database.rb
|
136
|
+
- lib/backhoe/dump.rb
|
137
|
+
- lib/backhoe/load.rb
|
129
138
|
- lib/backhoe/version.rb
|
130
139
|
homepage: https://github.com/botandrose/backhoe
|
131
140
|
licenses:
|
@@ -146,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
155
|
- !ruby/object:Gem::Version
|
147
156
|
version: '0'
|
148
157
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
158
|
+
rubygems_version: 3.3.26
|
150
159
|
signing_key:
|
151
160
|
specification_version: 4
|
152
161
|
summary: Dump and load current database to and from a file.
|
data/.travis.yml
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
backhoe (0.4.0)
|
5
|
-
activerecord
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activemodel (5.1.7)
|
11
|
-
activesupport (= 5.1.7)
|
12
|
-
activerecord (5.1.7)
|
13
|
-
activemodel (= 5.1.7)
|
14
|
-
activesupport (= 5.1.7)
|
15
|
-
arel (~> 8.0)
|
16
|
-
activesupport (5.1.7)
|
17
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>= 0.7, < 2)
|
19
|
-
minitest (~> 5.1)
|
20
|
-
tzinfo (~> 1.1)
|
21
|
-
appraisal (2.3.0)
|
22
|
-
bundler
|
23
|
-
rake
|
24
|
-
thor (>= 0.14.0)
|
25
|
-
arel (8.0.0)
|
26
|
-
byebug (11.1.3)
|
27
|
-
concurrent-ruby (1.1.8)
|
28
|
-
diff-lcs (1.4.4)
|
29
|
-
i18n (1.8.7)
|
30
|
-
concurrent-ruby (~> 1.0)
|
31
|
-
minitest (5.14.3)
|
32
|
-
mysql2 (0.5.3)
|
33
|
-
rake (10.5.0)
|
34
|
-
rspec (3.10.0)
|
35
|
-
rspec-core (~> 3.10.0)
|
36
|
-
rspec-expectations (~> 3.10.0)
|
37
|
-
rspec-mocks (~> 3.10.0)
|
38
|
-
rspec-core (3.10.1)
|
39
|
-
rspec-support (~> 3.10.0)
|
40
|
-
rspec-expectations (3.10.1)
|
41
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.10.0)
|
43
|
-
rspec-mocks (3.10.2)
|
44
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.10.0)
|
46
|
-
rspec-support (3.10.2)
|
47
|
-
thor (1.1.0)
|
48
|
-
thread_safe (0.3.6)
|
49
|
-
tzinfo (1.2.9)
|
50
|
-
thread_safe (~> 0.1)
|
51
|
-
|
52
|
-
PLATFORMS
|
53
|
-
ruby
|
54
|
-
|
55
|
-
DEPENDENCIES
|
56
|
-
activerecord (~> 5.1.0)
|
57
|
-
appraisal
|
58
|
-
backhoe!
|
59
|
-
byebug
|
60
|
-
mysql2
|
61
|
-
rake (~> 10.0)
|
62
|
-
rspec (~> 3.0)
|
63
|
-
|
64
|
-
BUNDLED WITH
|
65
|
-
1.17.2
|
@@ -1,65 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
backhoe (0.4.0)
|
5
|
-
activerecord
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activemodel (5.2.4.4)
|
11
|
-
activesupport (= 5.2.4.4)
|
12
|
-
activerecord (5.2.4.4)
|
13
|
-
activemodel (= 5.2.4.4)
|
14
|
-
activesupport (= 5.2.4.4)
|
15
|
-
arel (>= 9.0)
|
16
|
-
activesupport (5.2.4.4)
|
17
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>= 0.7, < 2)
|
19
|
-
minitest (~> 5.1)
|
20
|
-
tzinfo (~> 1.1)
|
21
|
-
appraisal (2.3.0)
|
22
|
-
bundler
|
23
|
-
rake
|
24
|
-
thor (>= 0.14.0)
|
25
|
-
arel (9.0.0)
|
26
|
-
byebug (11.1.3)
|
27
|
-
concurrent-ruby (1.1.8)
|
28
|
-
diff-lcs (1.4.4)
|
29
|
-
i18n (1.8.7)
|
30
|
-
concurrent-ruby (~> 1.0)
|
31
|
-
minitest (5.14.3)
|
32
|
-
mysql2 (0.5.3)
|
33
|
-
rake (10.5.0)
|
34
|
-
rspec (3.10.0)
|
35
|
-
rspec-core (~> 3.10.0)
|
36
|
-
rspec-expectations (~> 3.10.0)
|
37
|
-
rspec-mocks (~> 3.10.0)
|
38
|
-
rspec-core (3.10.1)
|
39
|
-
rspec-support (~> 3.10.0)
|
40
|
-
rspec-expectations (3.10.1)
|
41
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.10.0)
|
43
|
-
rspec-mocks (3.10.2)
|
44
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.10.0)
|
46
|
-
rspec-support (3.10.2)
|
47
|
-
thor (1.1.0)
|
48
|
-
thread_safe (0.3.6)
|
49
|
-
tzinfo (1.2.9)
|
50
|
-
thread_safe (~> 0.1)
|
51
|
-
|
52
|
-
PLATFORMS
|
53
|
-
ruby
|
54
|
-
|
55
|
-
DEPENDENCIES
|
56
|
-
activerecord (~> 5.2.0)
|
57
|
-
appraisal
|
58
|
-
backhoe!
|
59
|
-
byebug
|
60
|
-
mysql2
|
61
|
-
rake (~> 10.0)
|
62
|
-
rspec (~> 3.0)
|
63
|
-
|
64
|
-
BUNDLED WITH
|
65
|
-
1.17.2
|
@@ -1,65 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
backhoe (0.4.0)
|
5
|
-
activerecord
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activemodel (6.0.3.4)
|
11
|
-
activesupport (= 6.0.3.4)
|
12
|
-
activerecord (6.0.3.4)
|
13
|
-
activemodel (= 6.0.3.4)
|
14
|
-
activesupport (= 6.0.3.4)
|
15
|
-
activesupport (6.0.3.4)
|
16
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (>= 0.7, < 2)
|
18
|
-
minitest (~> 5.1)
|
19
|
-
tzinfo (~> 1.1)
|
20
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
21
|
-
appraisal (2.3.0)
|
22
|
-
bundler
|
23
|
-
rake
|
24
|
-
thor (>= 0.14.0)
|
25
|
-
byebug (11.1.3)
|
26
|
-
concurrent-ruby (1.1.8)
|
27
|
-
diff-lcs (1.4.4)
|
28
|
-
i18n (1.8.7)
|
29
|
-
concurrent-ruby (~> 1.0)
|
30
|
-
minitest (5.14.3)
|
31
|
-
mysql2 (0.5.3)
|
32
|
-
rake (10.5.0)
|
33
|
-
rspec (3.10.0)
|
34
|
-
rspec-core (~> 3.10.0)
|
35
|
-
rspec-expectations (~> 3.10.0)
|
36
|
-
rspec-mocks (~> 3.10.0)
|
37
|
-
rspec-core (3.10.1)
|
38
|
-
rspec-support (~> 3.10.0)
|
39
|
-
rspec-expectations (3.10.1)
|
40
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.10.0)
|
42
|
-
rspec-mocks (3.10.2)
|
43
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.10.0)
|
45
|
-
rspec-support (3.10.2)
|
46
|
-
thor (1.1.0)
|
47
|
-
thread_safe (0.3.6)
|
48
|
-
tzinfo (1.2.9)
|
49
|
-
thread_safe (~> 0.1)
|
50
|
-
zeitwerk (2.4.2)
|
51
|
-
|
52
|
-
PLATFORMS
|
53
|
-
ruby
|
54
|
-
|
55
|
-
DEPENDENCIES
|
56
|
-
activerecord (~> 6.0.0)
|
57
|
-
appraisal
|
58
|
-
backhoe!
|
59
|
-
byebug
|
60
|
-
mysql2
|
61
|
-
rake (~> 10.0)
|
62
|
-
rspec (~> 3.0)
|
63
|
-
|
64
|
-
BUNDLED WITH
|
65
|
-
1.17.2
|
@@ -1,64 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
backhoe (0.4.0)
|
5
|
-
activerecord
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activemodel (6.1.1)
|
11
|
-
activesupport (= 6.1.1)
|
12
|
-
activerecord (6.1.1)
|
13
|
-
activemodel (= 6.1.1)
|
14
|
-
activesupport (= 6.1.1)
|
15
|
-
activesupport (6.1.1)
|
16
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (>= 1.6, < 2)
|
18
|
-
minitest (>= 5.1)
|
19
|
-
tzinfo (~> 2.0)
|
20
|
-
zeitwerk (~> 2.3)
|
21
|
-
appraisal (2.3.0)
|
22
|
-
bundler
|
23
|
-
rake
|
24
|
-
thor (>= 0.14.0)
|
25
|
-
byebug (11.1.3)
|
26
|
-
concurrent-ruby (1.1.8)
|
27
|
-
diff-lcs (1.4.4)
|
28
|
-
i18n (1.8.7)
|
29
|
-
concurrent-ruby (~> 1.0)
|
30
|
-
minitest (5.14.3)
|
31
|
-
mysql2 (0.5.3)
|
32
|
-
rake (10.5.0)
|
33
|
-
rspec (3.10.0)
|
34
|
-
rspec-core (~> 3.10.0)
|
35
|
-
rspec-expectations (~> 3.10.0)
|
36
|
-
rspec-mocks (~> 3.10.0)
|
37
|
-
rspec-core (3.10.1)
|
38
|
-
rspec-support (~> 3.10.0)
|
39
|
-
rspec-expectations (3.10.1)
|
40
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.10.0)
|
42
|
-
rspec-mocks (3.10.2)
|
43
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.10.0)
|
45
|
-
rspec-support (3.10.2)
|
46
|
-
thor (1.1.0)
|
47
|
-
tzinfo (2.0.4)
|
48
|
-
concurrent-ruby (~> 1.0)
|
49
|
-
zeitwerk (2.4.2)
|
50
|
-
|
51
|
-
PLATFORMS
|
52
|
-
ruby
|
53
|
-
|
54
|
-
DEPENDENCIES
|
55
|
-
activerecord (~> 6.1.0)
|
56
|
-
appraisal
|
57
|
-
backhoe!
|
58
|
-
byebug
|
59
|
-
mysql2
|
60
|
-
rake (~> 10.0)
|
61
|
-
rspec (~> 3.0)
|
62
|
-
|
63
|
-
BUNDLED WITH
|
64
|
-
1.17.2
|
data/lib/backhoe/base.rb
DELETED
data/lib/backhoe/postgresql.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require "backhoe/base"
|
2
|
-
|
3
|
-
module Backhoe
|
4
|
-
class Postgresql < Base
|
5
|
-
def dump **_
|
6
|
-
pg_dump = `which pg_dump`.strip
|
7
|
-
raise RuntimeError, "Cannot find pg_dump." if pg_dump.blank?
|
8
|
-
sh "#{pg_dump} -c -f#{file_path} #{database}"
|
9
|
-
end
|
10
|
-
|
11
|
-
def load
|
12
|
-
psql = `which psql`.strip
|
13
|
-
raise RuntimeError, "Cannot find psql." if psql.blank?
|
14
|
-
sh "#{psql} -P pager=off -q -d#{database} -f#{file_path}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
data/lib/backhoe/sqlite.rb
DELETED