capistrano-rails-synchronizer 0.2.0.pre.1 → 0.3.0

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
2
  SHA256:
3
- metadata.gz: c022c9b532fcde4574ee6ad30c4ba575ce87acc32309a7caa453e3cc5361771b
4
- data.tar.gz: c359bd93d5aa29a461ed8bcfe75cf2d9e4005b6bc4461c0e0c7453a2445a9552
3
+ metadata.gz: 4570e2b851095476693e54746ef80349f99dc5ad9b121c8119310443a98c384e
4
+ data.tar.gz: 57daa7c50256e00a28a1a9f281c20de131fcf49b7a494ffd294147c492f68582
5
5
  SHA512:
6
- metadata.gz: 7f16b543ec77e467b0d97f3d5a8d28317e273a1f16c97d199d62017cb6c951831c4023cbd95c4f2e15ca0a743631459076d4eea0172d139ce3330ff19c55cc69
7
- data.tar.gz: 1eef88396a82febaccd646a26654eec300e18085af8a68df7474e5ab09b94093a2bf244ef007be1a872fd88c79d1b386fadf0ed2179859755d2f69136a50d364
6
+ metadata.gz: 229bac9456e9634d4f11ecd2d01c3188544f9f9f9302a91bff6c3a1a54be00f337385b86ad91aa2f597b82df566ae586414e896f1c88a64e131679acce97b220
7
+ data.tar.gz: 9d001f6024d19e47e8a34e833141bccbbb71e15a65502348dd51cf25d58177ffec5331b6fbbe10e95b56316e17ea2473c516b1127321b6c0fe302aa7d495e437
@@ -7,7 +7,6 @@ module Assets
7
7
  end
8
8
  end
9
9
 
10
-
11
10
  def copy_assets_to_local
12
11
  download! "#{fetch(:assets_archive_file)}", "#{fetch(:assets_archive_file).split('/')[-1]}"
13
12
  download! "#{fetch(:storage_archive_file)}", "#{fetch(:storage_archive_file).split('/')[-1]}"
@@ -22,7 +21,6 @@ module Assets
22
21
  end
23
22
  end
24
23
 
25
-
26
24
  private
27
25
 
28
26
  def pack_assets_cmd
@@ -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,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'
@@ -50,6 +57,16 @@ namespace :sync do
50
57
 
51
58
  desc 'create db-dump and copy to local'
52
59
  task :to_local do
60
+ on roles :db do
61
+ invoke 'sync:db:dump'
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
53
70
  on roles :db do
54
71
  invoke 'sync:db:dump'
55
72
  copy_db_to_local
@@ -65,6 +82,11 @@ namespace :sync do
65
82
  end
66
83
  end
67
84
 
85
+ task :clean_dumps do
86
+ on roles :db do
87
+ clean_db_dump
88
+ end
89
+ end
68
90
  end
69
91
 
70
92
  namespace :assets do
@@ -83,9 +105,17 @@ namespace :sync do
83
105
  on roles :web do
84
106
  invoke 'sync:assets:pack'
85
107
  copy_assets_to_local
108
+ invoke 'sync:assets:clean_dumps'
86
109
  end
87
110
  end
88
111
 
112
+ namespace :to_local do
113
+ desc 'copy assets to local (but keep artifacts remotely)'
114
+ task :keep do
115
+ invoke 'sync:assets:pack'
116
+ copy_assets_to_local
117
+ end
118
+ end
89
119
 
90
120
  #desc 'pack, copy and unpack assets on other stage'
91
121
  #task :unpack do
@@ -101,6 +131,11 @@ namespace :sync do
101
131
  pack_assets
102
132
  end
103
133
  end
134
+
135
+ task :clean_dumps do
136
+ on roles :web do
137
+ clean_assets_dump
138
+ end
139
+ end
104
140
  end
105
-
106
141
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-rails-synchronizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rene paulokat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-12 00:00:00.000000000 Z
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano-rails
@@ -53,12 +53,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - ">"
56
+ - - ">="
57
57
  - !ruby/object:Gem::Version
58
- version: 1.3.1
58
+ version: '0'
59
59
  requirements: []
60
- rubyforge_project:
61
- rubygems_version: 2.7.7
60
+ rubygems_version: 3.0.6
62
61
  signing_key:
63
62
  specification_version: 4
64
63
  summary: Rails specific Capistrano tasks to synchonize stages