prun-ops 0.1.6 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8dc44e3125b41128d993124789270b3a5e7a9ac9
4
- data.tar.gz: 854a1e558cf348d08a139e1af953d48396afa858
3
+ metadata.gz: 38c6921ba1ba5d425382e9eeb9ebe40e4a0d0b4c
4
+ data.tar.gz: c2cbf61e2449db9d6564ee32efb74c04badffe12
5
5
  SHA512:
6
- metadata.gz: 3548fb7aa7e082c0769ceb863ed2539aa544ac8d6656e1d8544f53ddb897a0c10be089bee6c88036ed3a8cf4c526ed41b08c2a15be7de57887b288cb18be311b
7
- data.tar.gz: 3539089b26c8bb8b64ea3c8031ff5647b8e0b42628682e8f44771ae85af1caa4b5c10a1f1dc74909124dc2f32f28efad2ae9d802c351f8b2d1430ca82d07c82f
6
+ metadata.gz: 29109ea34003c51029680a3be579fc8a2c06d8cbb81cf13bea3646edc686c466b4da74f8f454efae1c5583b4279217b7e026e5364b81acb2fa6fe5f33ecfe067
7
+ data.tar.gz: fe20a71f48f535f6fb34426753d286ac63bc47ac103b2d5946906c55b2be626ba92a10e083192d4b7dcc2f509f765eb25d281461c871fb5ba86cdda7b44b174e
data/README.md CHANGED
@@ -97,6 +97,8 @@ And
97
97
  ![backup schema](https://docs.google.com/drawings/d/1Sp8ysn46ldIWRxaLUHfzpu7vK0zMjh4_iMpEP1U6SuU/pub?w=642&h=277 "Backup commands schema")
98
98
 
99
99
  * `cap [stg] pull:data`: downloads DDBB and file folders from the stage you need.
100
+ * `cap [stg] pull:db`: Hot backup, download and restore of the stage database
101
+ * `cap [stg] pull:files`: Hot restore of backup_files
100
102
  * `cap [stg] backup[TAG]`: Commit a backup of DDBB and files to the git repo configured. "application-YYYYMMDD" tagged if no tag is provided.
101
103
  * `cap [stg] backup:restore[TAG]`: Restore the last backup into the stage indicated, or tagged state if TAG is provided.
102
104
  * `rake backup |TAG|`: Uploads backup to git store from local, tagging with date, or with TAG if provided. Useful to backup production stage.
@@ -8,7 +8,6 @@ namespace :backup do
8
8
  end
9
9
  end
10
10
  end
11
-
12
11
  end
13
12
  end
14
13
 
@@ -21,5 +20,47 @@ task :backup, :tag do |task, args|
21
20
  end
22
21
  end
23
22
  end
24
-
25
23
  end
24
+
25
+ namespace :pull do
26
+ desc 'Pull data (db/files) from remote (i.e: production) application.'
27
+ task :data do
28
+ invoke "pull:files"
29
+ invoke "pull:db"
30
+ end
31
+
32
+ desc 'Pull db: Hot backup, download and restore of the stage database'
33
+ task :db do
34
+ on roles(:app) do
35
+ within release_path do
36
+ with rails_env: fetch(:stage) do
37
+ execute :rake, 'db:backup'
38
+ execute "mv #{release_path}/tmp/db.sql /tmp/db.sql"
39
+ download! '/tmp/db.sql', 'tmp/db.sql'
40
+ end
41
+ run_locally do
42
+ execute 'rails db:environment:set RAILS_ENV=development'
43
+ rake 'db:restore'
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ desc 'Pull files uploaded'
50
+ task :files do
51
+ on roles(:app) do |host|
52
+ run_locally do
53
+ debug ": Pulling Files from #{fetch(:stage)} ..."
54
+ if fetch(:backup_dirs).any?
55
+ fetch(:backup_dirs).each do |dir|
56
+ execute "rm -r #{dir}"
57
+ execute "scp -r -P #{host.port} #{host.user}@#{host.hostname}:#{current_path}/#{dir} #{dir}"
58
+ end
59
+ else
60
+ error ": Set key :backup_dirs to know which ones to pull"
61
+ end
62
+
63
+ end
64
+ end
65
+ end
66
+ end
@@ -1,3 +1,3 @@
1
1
  module PrunOps
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prun-ops
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Lebrijo
@@ -99,7 +99,6 @@ files:
99
99
  - lib/capistrano/diagnosis.rake
100
100
  - lib/capistrano/git.rake
101
101
  - lib/capistrano/prun-ops.rb
102
- - lib/capistrano/pull.rake
103
102
  - lib/prun-ops.rb
104
103
  - lib/prun-ops/railitie.rb
105
104
  - lib/prun-ops/version.rb
@@ -1,42 +0,0 @@
1
- namespace :pull do
2
- desc 'Pull data (db/files) from remote (i.e: production) application.'
3
- task :data do
4
- invoke "pull:files"
5
- invoke "pull:db"
6
- end
7
-
8
- desc 'Pull db'
9
- task :db do
10
- on roles(:app) do |host|
11
- debug ": Pulling database from #{fetch(:stage)} ..."
12
- within "#{current_path}/tmp" do
13
- with rails_env: fetch(:stage) do
14
- rake "db:backup"
15
- end
16
- end
17
- run_locally do
18
- execute "scp -P #{host.port} #{host.user}@#{host.hostname}:#{current_path}/tmp/db.sql tmp/"
19
- rake "db:restore tmp/db.sql"
20
- end
21
- end
22
-
23
- end
24
-
25
- desc 'Pull files uploaded'
26
- task :files do
27
- on roles(:app) do |host|
28
- run_locally do
29
- debug ": Pulling Files from #{fetch(:stage)} ..."
30
- if fetch(:backup_dirs).any?
31
- fetch(:backup_dirs).each do |dir|
32
- execute "rm -r #{dir}"
33
- execute "scp -r -P #{host.port} #{host.user}@#{host.hostname}:#{current_path}/#{dir} #{dir}"
34
- end
35
- else
36
- error ": Set key :backup_dirs to know which ones to pull"
37
- end
38
-
39
- end
40
- end
41
- end
42
- end