capistrano-rails-synchronizer 0.1.4 → 0.3.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 +5 -5
- data/lib/synchronizer.rb +5 -1
- data/lib/synchronizer/assets.rb +11 -4
- data/lib/synchronizer/helper.rb +17 -2
- data/lib/tasks/sync.rake +41 -8
- metadata +4 -26
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fc5b003b760cf8cdeacbbc4b289457d571f0a6b0ad92f50cf7ac1e706ebc9618
|
4
|
+
data.tar.gz: 80d675d04fc83de09b24ac619c0c0395244947b9d9395d8ca40c312c105ed2e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e4b1789f5c384ff2f042cbdef58828c205c596ec7fe20537b8b57e5fea204d423cda2b8fd8e3183dd8d45dacb4fe81802c1fc579bda588448a0ffaa32d8a10e
|
7
|
+
data.tar.gz: 20ebdd629b82cb8853b572b56171e7037cb48a980055d0ffffbb72467253046197b598de60a35580b23cd24e06e60c590009b518f0292a5b0cef5574005e6ef2
|
data/lib/synchronizer.rb
CHANGED
@@ -2,4 +2,8 @@ require 'synchronizer/db'
|
|
2
2
|
require 'synchronizer/assets'
|
3
3
|
require 'synchronizer/helper'
|
4
4
|
|
5
|
-
|
5
|
+
begin
|
6
|
+
load File.expand_path("../tasks/sync.rake", __FILE__)
|
7
|
+
rescue
|
8
|
+
puts "WARNING: make sure to add 'require: false' to gem 'capistrano-rails-synchronizer' your Gemfile"
|
9
|
+
end
|
data/lib/synchronizer/assets.rb
CHANGED
@@ -3,28 +3,35 @@ module Assets
|
|
3
3
|
def pack_assets
|
4
4
|
on roles :web do
|
5
5
|
execute "cd #{shared_path}; #{pack_assets_cmd}"
|
6
|
+
execute "cd #{shared_path}; #{pack_storage_cmd}"
|
6
7
|
end
|
7
8
|
end
|
8
9
|
|
9
|
-
|
10
10
|
def copy_assets_to_local
|
11
11
|
download! "#{fetch(:assets_archive_file)}", "#{fetch(:assets_archive_file).split('/')[-1]}"
|
12
|
+
download! "#{fetch(:storage_archive_file)}", "#{fetch(:storage_archive_file).split('/')[-1]}"
|
12
13
|
end
|
13
14
|
|
14
15
|
def copy_assets_cmd
|
15
16
|
if dest = fetch(:sync_assets_to, nil)
|
16
17
|
scp_file(fetch(:assets_archive_file), dest)
|
18
|
+
scp_file(fetch(:storage_archive_file), dest)
|
17
19
|
else
|
18
20
|
raise "missing variable sync_assets_to"
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
|
23
|
-
private
|
24
|
+
private
|
24
25
|
|
25
26
|
def pack_assets_cmd
|
26
27
|
assets_archive = "#{shared_path}/public-#{fetch(:stage)}.tgz"
|
27
28
|
set :assets_archive_file, assets_archive
|
28
|
-
"tar cvfzp #{assets_archive} ./public"
|
29
|
+
"tar cvfzp #{assets_archive} ./public"
|
30
|
+
end
|
31
|
+
|
32
|
+
def pack_storage_cmd
|
33
|
+
storage_archive = "#{shared_path}/storage-#{fetch(:stage)}.tgz"
|
34
|
+
set :storage_archive_file, storage_archive
|
35
|
+
"tar cvfzp #{storage_archive} ./storage"
|
29
36
|
end
|
30
37
|
end
|
data/lib/synchronizer/helper.rb
CHANGED
@@ -4,11 +4,11 @@ module Helper
|
|
4
4
|
puts "deprecated... will vanish soon..."
|
5
5
|
_stage = fetch(:stage, nil).to_s
|
6
6
|
dest = fetch(:sync_to, nil)
|
7
|
-
if dest
|
7
|
+
if dest
|
8
8
|
dest
|
9
9
|
else
|
10
10
|
ask(:sync_to, stages.delete_if { |x| x == _stage }.join('|') )
|
11
|
-
dest = fetch(:sync_to, nil)
|
11
|
+
dest = fetch(:sync_to, nil)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -21,4 +21,19 @@ module Helper
|
|
21
21
|
set(name, *args, &block)
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
def clean_db_dump
|
26
|
+
if test("[ -f '#{fetch(:db_dump_file)}' ]")
|
27
|
+
execute :rm, '-v', fetch(:db_dump_file)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def clean_assets_dump
|
32
|
+
if test("[ -f '#{fetch(:assets_archive_file)}' ]")
|
33
|
+
execute :rm, '-v', fetch(:assets_archive_file)
|
34
|
+
end
|
35
|
+
if test("[ -f '#{fetch(:storage_archive_file)}' ]")
|
36
|
+
execute :rm, '-v', fetch(:storage_archive_file)
|
37
|
+
end
|
38
|
+
end
|
24
39
|
end
|
data/lib/tasks/sync.rake
CHANGED
@@ -5,13 +5,9 @@ include DB
|
|
5
5
|
include Assets
|
6
6
|
include Helper
|
7
7
|
|
8
|
-
|
9
8
|
desc 'copies database and assets to destination'
|
10
9
|
task :sync do
|
11
|
-
|
12
|
-
info "synchronizing data to #{destination}"
|
13
|
-
end
|
14
|
-
invoke 'sync:db:transfer'
|
10
|
+
invoke 'sync:db:transfer'
|
15
11
|
invoke 'sync:assets:transfer'
|
16
12
|
end
|
17
13
|
|
@@ -23,12 +19,20 @@ namespace :sync do
|
|
23
19
|
invoke 'sync:assets:to_local'
|
24
20
|
end
|
25
21
|
|
22
|
+
namespace :local do
|
23
|
+
desc 'syncs db and assets to local (keep remote dumps)'
|
24
|
+
task :keep do
|
25
|
+
invoke 'sync:db:to_local:keep'
|
26
|
+
invoke 'sync:assets:to_local:keep'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
26
30
|
desc 'dumps the database and copies the dump to destination stage'
|
27
31
|
task :db do
|
28
|
-
invoke 'sync:db:transfer'
|
32
|
+
invoke 'sync:db:transfer'
|
29
33
|
end
|
30
34
|
|
31
|
-
|
35
|
+
|
32
36
|
desc 'tars assets and copies the archive to destination stage'
|
33
37
|
task :assets do
|
34
38
|
invoke 'sync:assets:transfer'
|
@@ -56,6 +60,17 @@ namespace :sync do
|
|
56
60
|
on roles :db do
|
57
61
|
invoke 'sync:db:dump'
|
58
62
|
copy_db_to_local
|
63
|
+
invoke 'sync:db:clean_dumps'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
namespace :to_local do
|
68
|
+
desc 'create db-dump and copy to local (but keep remote dump)'
|
69
|
+
task :keep do
|
70
|
+
on roles :db do
|
71
|
+
invoke 'sync:db:dump'
|
72
|
+
copy_db_to_local
|
73
|
+
end
|
59
74
|
end
|
60
75
|
end
|
61
76
|
|
@@ -68,6 +83,11 @@ namespace :sync do
|
|
68
83
|
end
|
69
84
|
end
|
70
85
|
|
86
|
+
task :clean_dumps do
|
87
|
+
on roles :db do
|
88
|
+
clean_db_dump
|
89
|
+
end
|
90
|
+
end
|
71
91
|
end
|
72
92
|
|
73
93
|
namespace :assets do
|
@@ -86,9 +106,17 @@ namespace :sync do
|
|
86
106
|
on roles :web do
|
87
107
|
invoke 'sync:assets:pack'
|
88
108
|
copy_assets_to_local
|
109
|
+
invoke 'sync:assets:clean_dumps'
|
89
110
|
end
|
90
111
|
end
|
91
112
|
|
113
|
+
namespace :to_local do
|
114
|
+
desc 'copy assets to local (but keep artifacts remotely)'
|
115
|
+
task :keep do
|
116
|
+
invoke 'sync:assets:pack'
|
117
|
+
copy_assets_to_local
|
118
|
+
end
|
119
|
+
end
|
92
120
|
|
93
121
|
#desc 'pack, copy and unpack assets on other stage'
|
94
122
|
#task :unpack do
|
@@ -104,6 +132,11 @@ namespace :sync do
|
|
104
132
|
pack_assets
|
105
133
|
end
|
106
134
|
end
|
135
|
+
|
136
|
+
task :clean_dumps do
|
137
|
+
on roles :web do
|
138
|
+
clean_assets_dump
|
139
|
+
end
|
140
|
+
end
|
107
141
|
end
|
108
|
-
|
109
142
|
end
|
metadata
CHANGED
@@ -1,35 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-rails-synchronizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rene paulokat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDXDCCAkSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA6MQ0wCwYDVQQDDARyZW5l
|
14
|
-
MRQwEgYKCZImiZPyLGQBGRYEc28zNjETMBEGCgmSJomT8ixkARkWA25ldDAeFw0x
|
15
|
-
NTA3MTAxNTMyNDRaFw0xNjA3MDkxNTMyNDRaMDoxDTALBgNVBAMMBHJlbmUxFDAS
|
16
|
-
BgoJkiaJk/IsZAEZFgRzbzM2MRMwEQYKCZImiZPyLGQBGRYDbmV0MIIBIjANBgkq
|
17
|
-
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8RqRHqGzIcZgYV9cC5DygM6rA5T3sadk
|
18
|
-
guHNaqV+VH8+eYOUpHFt4ej1iEPya5jBErsHZEKXLhQZ1Sh6yKpqvT4sQLrTkQ0Y
|
19
|
-
naOmQmueOvOoeJOE8eUMIGiCqsBmPFcUzIcpgZ2Sibu0VZsOGzurpT7Lzj6fXiu/
|
20
|
-
OugAVvclfVMy+MB8orB0GV2nmZ2Hs6V0DmspIvLXhp2c+y4HXWiqXvleFx9dTwWc
|
21
|
-
k5OND1vR9tYN+3EBte5ETnQ5N26ZYRgeuEKxVbxrDODzfeZUCSrfIqHqH8KDvc7X
|
22
|
-
0ZvKlOZ58ZZ0TEm7BDLfCg9JdfJ5CPFwEuCDxZAyFfk7bFtobI0ubQIDAQABo20w
|
23
|
-
azAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU//+NDAgo3pOzGygK
|
24
|
-
S3orEjBTxJQwGAYDVR0RBBEwD4ENcmVuZUBzbzM2Lm5ldDAYBgNVHRIEETAPgQ1y
|
25
|
-
ZW5lQHNvMzYubmV0MA0GCSqGSIb3DQEBBQUAA4IBAQBmSt3BBM2Gf3y1YugJFpCj
|
26
|
-
J+XD0OjuRNfkXS67JkRcPeVydr6RZPS7IAx7LHmyvqSeMRLP4jp0VUyJbI/qNCN1
|
27
|
-
hhXMVdLM2bANjn/rlJEPvpdDgypuXk7AuMjXQpUU3EGq+EcPbot+RfSlGg4Ndn3D
|
28
|
-
cfD4sx2+gWoBefqQXp3D8DKUFWbny2sC3raPXdHVd0qQ03mldyrxMHxqPYmqDiOs
|
29
|
-
oSb+3px5AogC7i+BxZ28l/vs8zx8OnlDmS631gRSLH777KsaR6/oWntvsvPm8Jgr
|
30
|
-
EePKDI8r9ZSVkkt3XFn5MWAfX5hxvegGS5ExfyNtFeE8e+3B2Ha6ge9B6HTn+chR
|
31
|
-
-----END CERTIFICATE-----
|
32
|
-
date: 2015-07-10 00:00:00.000000000 Z
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-08 00:00:00.000000000 Z
|
33
12
|
dependencies:
|
34
13
|
- !ruby/object:Gem::Dependency
|
35
14
|
name: capistrano-rails
|
@@ -78,8 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
57
|
- !ruby/object:Gem::Version
|
79
58
|
version: '0'
|
80
59
|
requirements: []
|
81
|
-
|
82
|
-
rubygems_version: 2.4.8
|
60
|
+
rubygems_version: 3.0.6
|
83
61
|
signing_key:
|
84
62
|
specification_version: 4
|
85
63
|
summary: Rails specific Capistrano tasks to synchonize stages
|
checksums.yaml.gz.sig
DELETED
Binary file
|
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
��G!z � ���Q�>oԻ�el�S3�*tQʢ3�ϭ�|���!��R%��͑ؿ��h�yxL^��S���!^�߂�}������1H���d���+[����z�n gK5g��fa�!���%�Ī�)�hx���xl�{�"7ho?m���]^����3~mj��͉��yi9�ɞ�e��%<�S���ݢ�g��*�@o1�Q�pX�F�=�- ,������2;6�GPh�j|I x��CD0��1 J��
|