capistrano-rails-synchronizer 0.1.5 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d14b68c42ced3aeb4094939628564843bb0ff727
4
- data.tar.gz: d5d090595601a250b832db1e5f35b21f43fa4a49
2
+ SHA256:
3
+ metadata.gz: 61ef44971a15e9b9be2da68667d04b286e81dfc6d611980fa554a48fe083694b
4
+ data.tar.gz: a780e1be9b4e0510d1bc91149218980a3c992ff0b31dee8df5a4e585371aea5f
5
5
  SHA512:
6
- metadata.gz: 0e6c54ffb1bcd4d9954851a58247609e83b3bd598b70fb6f58376cc335efa76c9ed40a6582c1e80f592663b361a91aabfbbd1c4c0ef19eca48671788b13124f5
7
- data.tar.gz: ea6ac4edb0b9edde548c6fb09668945457d5523df5fb98cf8954f111b1e4c14a18c75e9b4f7377f717d694b48c255d94d91d77d9671703b5d300f404b3c4fec2
6
+ metadata.gz: 651ef49e3a5adefe70ab0fb10c0f6b0044bb23c2dcfa998fd837fad808a2a3cc4ac73a0993c44f9e0fc883a610edab3ee7b809d323e083c3cf7b56963d655baa
7
+ data.tar.gz: 585cb399383f763a184bee0a8c323e50bf8575c43b51357b46142b552543bc98d3015a51a32d877ed2d01c11fb55022f0dbcacc5fe293b5a16046d4fb53255d3
@@ -2,4 +2,8 @@ require 'synchronizer/db'
2
2
  require 'synchronizer/assets'
3
3
  require 'synchronizer/helper'
4
4
 
5
- load File.expand_path("../tasks/sync.rake", __FILE__)
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
@@ -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
@@ -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
@@ -5,10 +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
- invoke 'sync:db:transfer'
10
+ invoke 'sync:db:transfer'
12
11
  invoke 'sync:assets:transfer'
13
12
  end
14
13
 
@@ -20,12 +19,20 @@ namespace :sync do
20
19
  invoke 'sync:assets:to_local'
21
20
  end
22
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
+
23
30
  desc 'dumps the database and copies the dump to destination stage'
24
31
  task :db do
25
- invoke 'sync:db:transfer'
32
+ invoke 'sync:db:transfer'
26
33
  end
27
34
 
28
-
35
+
29
36
  desc 'tars assets and copies the archive to destination stage'
30
37
  task :assets do
31
38
  invoke 'sync:assets:transfer'
@@ -53,6 +60,17 @@ namespace :sync do
53
60
  on roles :db do
54
61
  invoke 'sync:db:dump'
55
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
56
74
  end
57
75
  end
58
76
 
@@ -65,6 +83,11 @@ namespace :sync do
65
83
  end
66
84
  end
67
85
 
86
+ task :clean_dumps do
87
+ on roles :db do
88
+ clean_db_dump
89
+ end
90
+ end
68
91
  end
69
92
 
70
93
  namespace :assets do
@@ -83,9 +106,19 @@ namespace :sync do
83
106
  on roles :web do
84
107
  invoke 'sync:assets:pack'
85
108
  copy_assets_to_local
109
+ invoke 'sync:assets:clean_dumps'
86
110
  end
87
111
  end
88
112
 
113
+ namespace :to_local do
114
+ desc 'copy assets to local (but keep artifacts remotely)'
115
+ task :keep do
116
+ on roles :web do
117
+ invoke 'sync:assets:pack'
118
+ copy_assets_to_local
119
+ end
120
+ end
121
+ end
89
122
 
90
123
  #desc 'pack, copy and unpack assets on other stage'
91
124
  #task :unpack do
@@ -101,6 +134,11 @@ namespace :sync do
101
134
  pack_assets
102
135
  end
103
136
  end
137
+
138
+ task :clean_dumps do
139
+ on roles :web do
140
+ clean_assets_dump
141
+ end
142
+ end
104
143
  end
105
-
106
144
  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.5
4
+ version: 0.3.2
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
- rubyforge_project:
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
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file