wslave 0.0.15 → 0.0.16
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/base/.Rakefile.swp +0 -0
- data/base/Rakefile +22 -6
- data/base/config/deploy/.production.rb.swp +0 -0
- data/base/config/deploy/.staging.rb.swp +0 -0
- data/base/config/deploy/production.rb +51 -3
- data/base/config/deploy/staging.rb +51 -3
- data/templates/config/.definitions.yml.swp +0 -0
- data/wslave.gemspec +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 825316c02512b6aa96e09e1252aedcb51a2aa2fe9358fcfc0feda9d1d79131b6
|
4
|
+
data.tar.gz: d2563f691c677973ddcc3badf51468c44c491ff2e524a6e71788c3fdfeaab1d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77b8e44a5028af7bbfbc1c13683dc9ae9076fbdfa3a613f87718b9d09a00f4f47195f35b149e411642900bcce33788dd55431f518307721a33ab30be56226875
|
7
|
+
data.tar.gz: 9c5c8fe737ab7f2ebd94cfd2164bdb8ccab4bf066d114a8dbc2236249f56d58635646d1348ce3bf15dbf3086d6c363dd7d0f2b405c78d8c1e57d5a7501b42955
|
data/base/.Rakefile.swp
ADDED
Binary file
|
data/base/Rakefile
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
@opts = YAML.load_file('config/definitions.yml')
|
2
5
|
|
3
6
|
def rm_dbfile(profile)
|
4
7
|
puts "Deleting db/#{profile}/wordpress.sql"
|
@@ -34,6 +37,7 @@ namespace :db do
|
|
34
37
|
task :activate do
|
35
38
|
rm_dbfile('active')
|
36
39
|
FileUtils.cp('db/staging/wordpress.sql', 'db/active/wordpress.sql')
|
40
|
+
_replace_active_urls
|
37
41
|
end
|
38
42
|
end
|
39
43
|
|
@@ -42,24 +46,36 @@ namespace :db do
|
|
42
46
|
task :activate do
|
43
47
|
rm_dbfile('active')
|
44
48
|
FileUtils.cp('db/production/wordpress.sql', 'db/active/wordpress.sql')
|
49
|
+
_replace_active_urls
|
45
50
|
end
|
46
51
|
end
|
52
|
+
|
53
|
+
# Converts staging and production URL entries in DB backup with localhost:8000
|
54
|
+
def _replace_active_urls()
|
55
|
+
puts 'Replacing Production and Staging URLs for local development/re-deployment...'
|
56
|
+
db_data = File.read('db/active/wordpress.sql')
|
57
|
+
|
58
|
+
if @opts['deployer']['fqdn']['staging'] != ''
|
59
|
+
db_data = db_data.gsub(/#{@opts['deployer']['fqdn']['staging']}/, 'localhost:8000')
|
60
|
+
end
|
61
|
+
if @opts['deployer']['fqdn']['production'] != ''
|
62
|
+
db_data = db_data.gsub(/#{@opts['deployer']['fqdn']['production']}/, 'localhost:8000')
|
63
|
+
end
|
64
|
+
|
65
|
+
File.open('db/active/wordpress.sql', "w") {|file| file.puts db_data }
|
66
|
+
end
|
47
67
|
end
|
48
68
|
|
49
69
|
namespace :staging do
|
50
70
|
desc 'Open an SSH session to the staging host in the staging directory'
|
51
71
|
task :ssh do
|
52
|
-
|
53
|
-
opts = YAML.load_file('config/definitions.yml')
|
54
|
-
exec("ssh #{opts['deployer']['user']}@#{opts['deployer']['host']['staging']} -t \"cd #{opts['deployer']['root']}/#{opts['deployer']['fqdn']['staging']}; exec \$SHELL -l\"")
|
72
|
+
exec("ssh #{@opts['deployer']['user']}@#{@opts['deployer']['host']['staging']} -t \"cd #{@opts['deployer']['root']}/#{@opts['deployer']['fqdn']['staging']}; exec \$SHELL -l\"")
|
55
73
|
end
|
56
74
|
end
|
57
75
|
|
58
76
|
namespace :production do
|
59
77
|
desc 'Open an SSH session to the staging host in the production directory'
|
60
78
|
task :ssh do
|
61
|
-
|
62
|
-
opts = YAML.load_file('config/definitions.yml')
|
63
|
-
exec("ssh #{opts['deployer']['user']}@#{opts['deployer']['host']['production']} -t \"cd #{opts['deployer']['root']}/#{opts['deployer']['fqdn']['production']}; exec \$SHELL -l\"")
|
79
|
+
exec("ssh #{@opts['deployer']['user']}@#{@opts['deployer']['host']['production']} -t \"cd #{@opts['deployer']['root']}/#{@opts['deployer']['fqdn']['production']}; exec \$SHELL -l\"")
|
64
80
|
end
|
65
81
|
end
|
Binary file
|
Binary file
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'date'
|
2
3
|
|
3
4
|
opts = YAML.load_file('config/definitions.yml')
|
4
5
|
db_info = YAML.load_file('config/database.yml')
|
@@ -8,6 +9,9 @@ host_addr = opts['deployer']['host']['production']
|
|
8
9
|
multisite_root = opts['deployer']['root']
|
9
10
|
site_fqdn = opts['deployer']['fqdn']['production']
|
10
11
|
|
12
|
+
disable_rsync = (opts.include?('options') && opts['options'].include?('rsync_enabled') &&
|
13
|
+
opts['options']['rsync_enabled'] == false)
|
14
|
+
|
11
15
|
role :web, "#{deploy_user}@#{host_addr}"
|
12
16
|
|
13
17
|
set :tmp_dir, "#{multisite_root}/tmp"
|
@@ -72,6 +76,36 @@ namespace :deploy do
|
|
72
76
|
end
|
73
77
|
end
|
74
78
|
|
79
|
+
desc 'Finds and replaces localhost:8000 and your Staging address with the Production address'
|
80
|
+
task :chikan do
|
81
|
+
on roles(:web) do
|
82
|
+
puts 'Replacing localhost:8000 and Staging URLs with Production URLs...'
|
83
|
+
|
84
|
+
# Create a backup, download it, and remove remote copy
|
85
|
+
execute "mkdir -p #{deploy_path}/db/tmp"
|
86
|
+
execute "mysqldump --opt --user=#{db_info['production']['username']} --password=#{db_info['production']['password']} --host=#{db_info['production']['host']} #{db_info['production']['database']} > #{deploy_path}/db/tmp/wordpress.sql"
|
87
|
+
FileUtils.mkdir_p('./db/tmp') unless Dir.exist?('./db/tmp')
|
88
|
+
download! "#{deploy_path}/db/tmp/wordpress.sql", "db/tmp/wordpress.sql"
|
89
|
+
execute "rm #{deploy_path}/db/tmp/*.sql"
|
90
|
+
|
91
|
+
# Regex replace in file
|
92
|
+
db_data = File.read('db/tmp/wordpress.sql')
|
93
|
+
|
94
|
+
db_data = db_data.gsub(/localhost:8000/, "#{opts['deployer']['fqdn']['production']}")
|
95
|
+
if opts['deployer']['fqdn']['staging'] != ''
|
96
|
+
db_data = db_data.gsub(/#{opts['deployer']['fqdn']['staging']}/, "#{opts['deployer']['fqdn']['production']}")
|
97
|
+
end
|
98
|
+
|
99
|
+
File.open('db/tmp/wordpress.sql', "w") {|file| file.puts db_data }
|
100
|
+
|
101
|
+
# Upload file and seed
|
102
|
+
upload! 'db/tmp/wordpress.sql', "#{deploy_path}/db/tmp/wordpress.sql"
|
103
|
+
execute "mysql -h#{db_info['production']['host']} -u#{db_info['production']['username']} -p#{db_info['production']['password']} #{db_info['production']['database']} < #{deploy_path}/db/tmp/wordpress.sql"
|
104
|
+
execute "rm #{deploy_path}/db/tmp/*.sql"
|
105
|
+
`rm db/tmp/wordpress.sql`
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
75
109
|
desc 'Perform special seed tasks required on intial seed'
|
76
110
|
task :initial do
|
77
111
|
on roles(:web) do
|
@@ -79,8 +113,7 @@ namespace :deploy do
|
|
79
113
|
invoke!('deploy:check:linked_dirs')
|
80
114
|
invoke!('deploy:check:make_linked_dirs')
|
81
115
|
invoke('deploy:wp_config')
|
82
|
-
if
|
83
|
-
opts['options']['rsync_enabled'] == false)
|
116
|
+
if disable_rsync
|
84
117
|
invoke('deploy:upload_wp')
|
85
118
|
invoke('deploy:upload_plugins')
|
86
119
|
invoke('deploy:upload_uploads')
|
@@ -91,6 +124,7 @@ namespace :deploy do
|
|
91
124
|
end
|
92
125
|
invoke('deploy')
|
93
126
|
invoke('db:seed')
|
127
|
+
invoke('deploy:chikan')
|
94
128
|
end
|
95
129
|
end
|
96
130
|
|
@@ -149,10 +183,24 @@ namespace :data do
|
|
149
183
|
download! "#{deploy_path}/shared/public/wp-content/upgrade", "./public/wp-content/", recursive: true
|
150
184
|
end
|
151
185
|
end
|
186
|
+
|
187
|
+
desc "Backup data with rsync"
|
188
|
+
task :sync_backup do
|
189
|
+
on roles(:web) do
|
190
|
+
puts "Syncing Backup..."
|
191
|
+
`rsync -avzPhu --delete #{deploy_user}@#{host_addr}:#{deploy_path}/shared/public/wp-content/uploads/ ./public/wp-content/uploads/`
|
192
|
+
`rsync -avzPhu --delete #{deploy_user}@#{host_addr}:#{deploy_path}/shared/public/wp-content/plugins/ ./public/wp-content/plugins/`
|
193
|
+
`rsync -avzPhu --delete #{deploy_user}@#{host_addr}:#{deploy_path}/shared/public/wp-content/upgrade/ ./public/wp-content/upgrade/`
|
194
|
+
end
|
195
|
+
end
|
152
196
|
end
|
153
197
|
|
154
198
|
desc 'Backup DB and remote uploads/content'
|
155
199
|
task :backup do
|
156
200
|
invoke('db:backup')
|
157
|
-
|
201
|
+
if disable_rsync
|
202
|
+
invoke('data:backup')
|
203
|
+
else
|
204
|
+
invoke('data:sync_backup')
|
205
|
+
end
|
158
206
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'date'
|
2
3
|
|
3
4
|
opts = YAML.load_file('config/definitions.yml')
|
4
5
|
db_info = YAML.load_file('config/database.yml')
|
@@ -8,6 +9,9 @@ host_addr = opts['deployer']['host']['staging']
|
|
8
9
|
multisite_root = opts['deployer']['root']
|
9
10
|
site_fqdn = opts['deployer']['fqdn']['staging']
|
10
11
|
|
12
|
+
disable_rsync = (opts.include?('options') && opts['options'].include?('rsync_enabled') &&
|
13
|
+
opts['options']['rsync_enabled'] == false)
|
14
|
+
|
11
15
|
role :web, "#{deploy_user}@#{host_addr}"
|
12
16
|
|
13
17
|
set :tmp_dir, "#{multisite_root}/tmp"
|
@@ -72,6 +76,36 @@ namespace :deploy do
|
|
72
76
|
end
|
73
77
|
end
|
74
78
|
|
79
|
+
desc 'Finds and replaces localhost:8000 and your Production address with the Staging address'
|
80
|
+
task :chikan do
|
81
|
+
on roles(:web) do
|
82
|
+
puts 'Replacing localhost:8000 and Production URLs with Staging URLs...'
|
83
|
+
|
84
|
+
# Create a backup, download it, and remove remote copy
|
85
|
+
execute "mkdir -p #{deploy_path}/db/tmp"
|
86
|
+
execute "mysqldump --opt --user=#{db_info['staging']['username']} --password=#{db_info['staging']['password']} --host=#{db_info['staging']['host']} #{db_info['staging']['database']} > #{deploy_path}/db/tmp/wordpress.sql"
|
87
|
+
FileUtils.mkdir_p('./db/tmp') unless Dir.exist?('./db/tmp')
|
88
|
+
download! "#{deploy_path}/db/tmp/wordpress.sql", "db/tmp/wordpress.sql"
|
89
|
+
execute "rm #{deploy_path}/db/tmp/*.sql"
|
90
|
+
|
91
|
+
# Regex replace in file
|
92
|
+
db_data = File.read('db/tmp/wordpress.sql')
|
93
|
+
|
94
|
+
db_data = db_data.gsub(/localhost:8000/, "#{opts['deployer']['fqdn']['staging']}")
|
95
|
+
if opts['deployer']['fqdn']['production'] != ''
|
96
|
+
db_data = db_data.gsub(/#{opts['deployer']['fqdn']['production']}/, "#{opts['deployer']['fqdn']['staging']}")
|
97
|
+
end
|
98
|
+
|
99
|
+
File.open('db/tmp/wordpress.sql', "w") {|file| file.puts db_data }
|
100
|
+
|
101
|
+
# Upload file and seed
|
102
|
+
upload! 'db/tmp/wordpress.sql', "#{deploy_path}/db/tmp/wordpress.sql"
|
103
|
+
execute "mysql -h#{db_info['staging']['host']} -u#{db_info['staging']['username']} -p#{db_info['staging']['password']} #{db_info['staging']['database']} < #{deploy_path}/db/tmp/wordpress.sql"
|
104
|
+
execute "rm #{deploy_path}/db/tmp/*.sql"
|
105
|
+
`rm db/tmp/wordpress.sql`
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
75
109
|
desc 'Perform special seed tasks required on intial seed'
|
76
110
|
task :initial do
|
77
111
|
on roles(:web) do
|
@@ -79,8 +113,7 @@ namespace :deploy do
|
|
79
113
|
invoke!('deploy:check:linked_dirs')
|
80
114
|
invoke!('deploy:check:make_linked_dirs')
|
81
115
|
invoke('deploy:wp_config')
|
82
|
-
if
|
83
|
-
opts['options']['rsync_enabled'] == false)
|
116
|
+
if disable_rsync
|
84
117
|
invoke('deploy:upload_wp')
|
85
118
|
invoke('deploy:upload_plugins')
|
86
119
|
invoke('deploy:upload_uploads')
|
@@ -91,6 +124,7 @@ namespace :deploy do
|
|
91
124
|
end
|
92
125
|
invoke('deploy')
|
93
126
|
invoke('db:seed')
|
127
|
+
invoke('deploy:chikan')
|
94
128
|
end
|
95
129
|
end
|
96
130
|
|
@@ -149,10 +183,24 @@ namespace :data do
|
|
149
183
|
download! "#{deploy_path}/shared/public/wp-content/upgrade", "./public/wp-content/", recursive: true
|
150
184
|
end
|
151
185
|
end
|
186
|
+
|
187
|
+
desc "Backup data with rsync"
|
188
|
+
task :sync_backup do
|
189
|
+
on roles(:web) do
|
190
|
+
puts "Syncing Backup..."
|
191
|
+
`rsync -avzPhu --delete #{deploy_user}@#{host_addr}:#{deploy_path}/shared/public/wp-content/uploads/ ./public/wp-content/uploads/`
|
192
|
+
`rsync -avzPhu --delete #{deploy_user}@#{host_addr}:#{deploy_path}/shared/public/wp-content/plugins/ ./public/wp-content/plugins/`
|
193
|
+
`rsync -avzPhu --delete #{deploy_user}@#{host_addr}:#{deploy_path}/shared/public/wp-content/upgrade/ ./public/wp-content/upgrade/`
|
194
|
+
end
|
195
|
+
end
|
152
196
|
end
|
153
197
|
|
154
198
|
desc 'Backup DB and remote uploads/content'
|
155
199
|
task :backup do
|
156
200
|
invoke('db:backup')
|
157
|
-
|
201
|
+
if disable_rsync
|
202
|
+
invoke('data:backup')
|
203
|
+
else
|
204
|
+
invoke('data:sync_backup')
|
205
|
+
end
|
158
206
|
end
|
Binary file
|
data/wslave.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'wslave'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.16'
|
4
4
|
s.licenses = ['GPL-3.0', 'AGPL-3.0']
|
5
5
|
s.summary = '"Word Slave" generates and controls a WordPress installation'
|
6
6
|
s.description = 'Word Slave includes the wslave command and a control library to generate a ' \
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wslave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rei Kagetsuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -89,6 +89,7 @@ executables:
|
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
|
+
- base/.Rakefile.swp
|
92
93
|
- base/Capfile
|
93
94
|
- base/Dockerfile
|
94
95
|
- base/Gemfile
|
@@ -98,6 +99,8 @@ files:
|
|
98
99
|
- base/config/deploy-tools/wp-config.php.erb
|
99
100
|
- base/config/deploy-tools/wp-config.php.local
|
100
101
|
- base/config/deploy.rb
|
102
|
+
- base/config/deploy/.production.rb.swp
|
103
|
+
- base/config/deploy/.staging.rb.swp
|
101
104
|
- base/config/deploy/production.rb
|
102
105
|
- base/config/deploy/staging.rb
|
103
106
|
- base/docker-compose.yml
|
@@ -109,6 +112,7 @@ files:
|
|
109
112
|
- lib/wslave_sage.rb
|
110
113
|
- lib/wslave_tools.rb
|
111
114
|
- lib/wslave_update.rb
|
115
|
+
- templates/config/.definitions.yml.swp
|
112
116
|
- templates/config/database.yml
|
113
117
|
- templates/config/definitions.yml
|
114
118
|
- wslave.gemspec
|
@@ -133,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
137
|
version: '0'
|
134
138
|
requirements: []
|
135
139
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.7.3
|
137
141
|
signing_key:
|
138
142
|
specification_version: 4
|
139
143
|
summary: '"Word Slave" generates and controls a WordPress installation'
|