syncoku 0.0.6 → 0.0.7
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/README.md +6 -0
- data/lib/syncoku/local.rb +3 -3
- data/lib/syncoku/local_db.rb +8 -5
- data/lib/syncoku/remote.rb +2 -2
- data/lib/syncoku/remote_db.rb +6 -2
- data/lib/syncoku/s3.rb +1 -1
- data/lib/syncoku/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 732858d950417bfa203430c97f7515dd4f594d0a
|
4
|
+
data.tar.gz: beaaea06672bd0ab1fc383745745a895a41a2257
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 847c5735fe491420250f6909a03f20d8b6fb5686b830b36fcbc072975dc280fb29f6f600c45434973c817f8c66b5819875b4cc84fb94425a5b010aedccdfc659
|
7
|
+
data.tar.gz: 580b1adfaacd6fa28ce93d49696d907e03566d11df3120bb50af63ed5d02090d4841a206359a93b37d54b9178149c425a1281d48f8d09546b4315aa6a4d69f74
|
data/README.md
CHANGED
@@ -49,6 +49,12 @@ It will capture a backup of the database and download it to a local file called
|
|
49
49
|
|
50
50
|
If you define a rake task called `syncoku:after_sync` then it will automatically be run after the database has been restored and migrated. This is a good place to put anonymization tasks, for instance.
|
51
51
|
|
52
|
+
If you want to skip this task, even though it exists:
|
53
|
+
|
54
|
+
```
|
55
|
+
syncoku --skip-after-sync
|
56
|
+
```
|
57
|
+
|
52
58
|
## S3
|
53
59
|
|
54
60
|
If you add a file called `syncoku.yml` with the following information, it can sync between S3 buckets too:
|
data/lib/syncoku/local.rb
CHANGED
@@ -11,15 +11,15 @@ module Syncoku
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def db(args)
|
14
|
-
Syncoku::LocalDb.new.sync
|
14
|
+
Syncoku::LocalDb.new.sync(args)
|
15
15
|
end
|
16
16
|
|
17
17
|
def s3(args)
|
18
|
-
Syncoku::S3.new(:development).sync
|
18
|
+
Syncoku::S3.new(:development).sync(args)
|
19
19
|
end
|
20
20
|
|
21
21
|
def rebuild(args)
|
22
|
-
Syncoku::LocalDb.new.rebuild
|
22
|
+
Syncoku::LocalDb.new.rebuild(args)
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
data/lib/syncoku/local_db.rb
CHANGED
@@ -4,7 +4,7 @@ module Syncoku
|
|
4
4
|
include Runnable
|
5
5
|
include CaptureBackup
|
6
6
|
|
7
|
-
def sync
|
7
|
+
def sync(args)
|
8
8
|
if File.exist?("#{dump_filename}")
|
9
9
|
ask_to_download
|
10
10
|
else
|
@@ -13,11 +13,15 @@ module Syncoku
|
|
13
13
|
drop_and_create
|
14
14
|
pg_restore
|
15
15
|
migrate
|
16
|
-
|
16
|
+
if args.include?("--skip-after-sync")
|
17
|
+
puts "Skipping syncoku:after_sync task"
|
18
|
+
else
|
19
|
+
run_hook 'after_sync'
|
20
|
+
end
|
17
21
|
`touch tmp/restart.txt`
|
18
22
|
end
|
19
23
|
|
20
|
-
def rebuild
|
24
|
+
def rebuild(args)
|
21
25
|
kill_connections
|
22
26
|
puts "Rebuilding database"
|
23
27
|
run_command "bundle exec rake db:drop db:create db:migrate"
|
@@ -29,8 +33,7 @@ module Syncoku
|
|
29
33
|
|
30
34
|
def run_hook(name)
|
31
35
|
if test_command "rake syncoku:#{name}"
|
32
|
-
puts "
|
33
|
-
run_command "bundle exec rake syncoku:#{name}"
|
36
|
+
puts "#{name} hook run"
|
34
37
|
else
|
35
38
|
puts "Skipping #{name} hook. Define a Rake task called syncoku:#{name} to activate."
|
36
39
|
end
|
data/lib/syncoku/remote.rb
CHANGED
@@ -17,11 +17,11 @@ module Syncoku
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def db(args)
|
20
|
-
Syncoku::RemoteDb.new(app_name).sync
|
20
|
+
Syncoku::RemoteDb.new(app_name).sync(args)
|
21
21
|
end
|
22
22
|
|
23
23
|
def s3(args)
|
24
|
-
Syncoku::S3.new(remote).sync
|
24
|
+
Syncoku::S3.new(remote).sync(args)
|
25
25
|
end
|
26
26
|
|
27
27
|
def rebuild(args)
|
data/lib/syncoku/remote_db.rb
CHANGED
@@ -10,14 +10,18 @@ module Syncoku
|
|
10
10
|
@app_name = app_name
|
11
11
|
end
|
12
12
|
|
13
|
-
def sync
|
13
|
+
def sync(args)
|
14
14
|
puts "Switch on maintenance mode"
|
15
15
|
run_remotely "maintenance:on"
|
16
16
|
puts "Restoring database"
|
17
17
|
run_remotely "pg:reset DATABASE_URL --confirm #{app_name}"
|
18
18
|
run_remotely "pg:backups:restore '#{capture}' DATABASE_URL --confirm #{app_name}"
|
19
19
|
run_remotely "run rake db:migrate"
|
20
|
-
|
20
|
+
if args.include?("--skip-after-sync")
|
21
|
+
puts "Skipping syncoku:after_sync task"
|
22
|
+
else
|
23
|
+
run_remotely "run rake syncoku:after_sync"
|
24
|
+
end
|
21
25
|
run_remotely "restart"
|
22
26
|
puts "Switch off maintenance mode"
|
23
27
|
run_remotely "maintenance:off"
|
data/lib/syncoku/s3.rb
CHANGED
data/lib/syncoku/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syncoku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bill Horsman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.6.8
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Convenient way of syncing data from and to Heroku
|