wordpresstrano 0.2.1 → 0.2.2

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: ff21b589711c6eadcedd99c492b88431dfaeb866
4
- data.tar.gz: d3287b879217636c7286a859d03b06fce9c4a4b6
3
+ metadata.gz: 3a39a6ee135372c5de3d06d78771e8165e92948f
4
+ data.tar.gz: 03465170ef4519a96e2a4e74b1a39dcc89546128
5
5
  SHA512:
6
- metadata.gz: 594a3dc0f5c6377e740a4ed4bd261b042a34b038d1f4e24a9f196d41440fd459815adf6aaeed351f0313c01e0ccafa3465312ab8ab236762f095939efed1b4cb
7
- data.tar.gz: 75d8f9973019ae4a516b3276e23e349d85c59a5bdb48afe7e85f62d4f9cae8eeb9f5db9f6e28f3083d9ead6ac089707412ae1f8e078e67a9ec4dc7656537457b
6
+ metadata.gz: f6f2916a978dd401a9dfc46fe7afe3783b8d45396851678fd41d9538f2c8fc51788fb4eedb77fa04e6beff70ca4aea22ad1d3d531279579e8ad3eda415524fad
7
+ data.tar.gz: 78528b29a4c75b9fcd73f19b76dec33636f300267e023966c013ff9a234cadf307e5dc8f62d282b616480817c224899df75496a78a7d7d378a994332b57ef824
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ # OS generated files #
2
+ ######################
3
+ .DS_Store
4
+ ehthumbs.db
5
+ Icon?
6
+ Thumbs.db
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # WordPresstrano
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/wordpresstrano.svg)](http://badge.fury.io/rb/wordpresstrano)
4
+
3
5
  This gem is currently in beta.
4
6
 
5
7
  Documentation coming soon!
@@ -63,6 +63,9 @@ before "wp:core:download", "wp:core:remove"
63
63
  # Download the WordPress core files before finishing deploy:updated
64
64
  before "deploy:updated", "wp:core:download"
65
65
 
66
+ # Check if we can deploy without pushing htaccess/uploads/database
67
+ before "deploy", "deploy:check_for_previous_deployment"
68
+
66
69
  # Link the release into the website root
67
70
  after "deploy:finished", "webroot:symlink"
68
71
 
@@ -88,8 +91,9 @@ after "db:push", "db:check_maintenance_disable"
88
91
  # Check if maintenance mode should be disabled after restoring the database
89
92
  after "db:restore", "db:check_maintenance_disable"
90
93
 
91
- # Push the local resources after finishing deploy:updated
94
+ # Rollback the database after rolling back the files
92
95
  after "deploy:reverted", "db:rollback"
93
- after "deploy:updated", "htaccess:push"
94
- after "deploy:updated", "uploads:push"
95
- after "deploy:updated", "db:push" # We want this to happen last so leave it here :)
96
+
97
+ # Clone resources from the previous release (if they exist)
98
+ after "deploy:updated", "htaccess:clone_from_previous_release"
99
+ after "deploy:updated", "uploads:clone_from_previous_release"
@@ -4,11 +4,11 @@ namespace :binaries do
4
4
  next if true == fetch(:checked_binaries)
5
5
 
6
6
  required_binaries = {
7
- local: [:php, :rm, :rsync, :wp],
7
+ local: [:mysql, :mysqldump, :mysqlshow, :php, :rm, :rsync, :wp],
8
8
  remote: {
9
- :all => [:chmod, :find, :rm, :wp],
9
+ :all => [:chmod, :find, :mysql, :mysqldump, :mysqlshow, :rm, :wp],
10
10
  :app => [:ln, :readlink, :rsync],
11
- :db => [:du, :grep, :mysqlshow]
11
+ :db => [:du, :grep]
12
12
  }
13
13
  }
14
14
 
@@ -1,4 +1,31 @@
1
1
  namespace :deploy do
2
+ task :all do
3
+ Rake::Task["deploy"].prerequisites.delete("deploy:check_for_previous_deployment")
4
+ Rake::Task["deploy:updated"].prerequisites.delete("htaccess:clone_from_previous_release")
5
+
6
+ after "deploy:updated", "htaccess:push"
7
+ after "deploy:updated", "uploads:push"
8
+ after "deploy:updated", "db:push"
9
+
10
+ invoke "deploy"
11
+ end
12
+
13
+ task :check_for_previous_deployment do
14
+ previous_deployment = true
15
+
16
+ on roles(:all) do |server|
17
+ unless test("[ -d #{current_path} ]")
18
+ error "Unable to locate a current release on #{server.user}@#{server.hostname}"
19
+
20
+ previous_deployment = false
21
+ end
22
+ end
23
+
24
+ unless previous_deployment
25
+ raise "One or more servers don't have a current release on them. You should run 'deploy:all' first."
26
+ end
27
+ end
28
+
2
29
  task :shared_configs do
3
30
  config_path = File.join(shared_path, "wp-config.php")
4
31
  robots_path = File.join(shared_path, "robots.txt")
@@ -129,4 +129,25 @@ namespace :htaccess do
129
129
  execute :chmod, 644, remote_path
130
130
  end
131
131
  end
132
+
133
+ task :clone_from_previous_release do
134
+ file = ".htaccess"
135
+
136
+ remote_path = File.join(release_path, file)
137
+
138
+ on roles(:app) do |server|
139
+ if test("[ -d #{current_path} ]")
140
+ actual_current_path = capture("readlink -f #{current_path}").strip
141
+ actual_release_path = capture("readlink -f #{release_path}").strip
142
+
143
+ previous_remote_path = File.join(actual_current_path, file)
144
+
145
+ if actual_current_path != actual_release_path and test("[ -d #{previous_remote_path} ]")
146
+ debug "Cloning #{file} file from current release on #{server.user}@#{server.hostname}"
147
+
148
+ execute :cp, "--preserve=timestamps", previous_remote_path, remote_path
149
+ end
150
+ end
151
+ end
152
+ end
132
153
  end
@@ -68,25 +68,14 @@ namespace :uploads do
68
68
  remote_path = File.join(release_path, directory)
69
69
 
70
70
  unless File.directory? local_path
71
- error "No local uploads directory exists"
71
+ run_locally do
72
+ error "No local uploads directory exists"
73
+ end
72
74
 
73
75
  next
74
76
  end
75
77
 
76
78
  on roles(:app) do |server|
77
- if test("[ -d #{current_path} ]") and (ENV["clone_uploads"].nil? or ENV["clone_uploads"].empty? or [true, "true", "yes", "y"].include? ENV["clone_uploads"].downcase)
78
- actual_current_path = capture("readlink -f #{current_path}").strip
79
- actual_release_path = capture("readlink -f #{release_path}").strip
80
-
81
- previous_remote_path = File.join(actual_current_path, directory)
82
-
83
- if actual_current_path != actual_release_path and test("[ -d #{previous_remote_path} ]")
84
- debug "Cloning uploads directory from current release on #{server.user}@#{server.hostname}"
85
-
86
- execute :cp, "-R", "--preserve=timestamps", previous_remote_path, remote_path
87
- end
88
- end
89
-
90
79
  execute :mkdir, "-p", remote_path
91
80
 
92
81
  info "Pushing #{directory} directory to #{server.user}@#{server.hostname}"
@@ -119,4 +108,25 @@ namespace :uploads do
119
108
  execute :find, remote_path, "-type f", "-exec", :chmod, 644, "{}", "\\;"
120
109
  end
121
110
  end
111
+
112
+ task :clone_from_previous_release do
113
+ directory = File.join("wp-content", "uploads")
114
+
115
+ remote_path = File.join(release_path, directory)
116
+
117
+ on roles(:app) do |server|
118
+ if test("[ -d #{current_path} ]")
119
+ actual_current_path = capture("readlink -f #{current_path}").strip
120
+ actual_release_path = capture("readlink -f #{release_path}").strip
121
+
122
+ previous_remote_path = File.join(actual_current_path, directory)
123
+
124
+ if actual_current_path != actual_release_path and test("[ -d #{previous_remote_path} ]")
125
+ debug "Cloning uploads directory from current release on #{server.user}@#{server.hostname}"
126
+
127
+ execute :cp, "-R", "--preserve=timestamps", previous_remote_path, remote_path
128
+ end
129
+ end
130
+ end
131
+ end
122
132
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'wordpresstrano'
3
- s.version = '0.2.1'
3
+ s.version = '0.2.2'
4
4
  s.date = '2015-08-09'
5
5
  s.authors = ['Nialto Services']
6
6
  s.email = 'support@nialtoservices.co.uk'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordpresstrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nialto Services
@@ -37,6 +37,7 @@ executables: []
37
37
  extensions: []
38
38
  extra_rdoc_files: []
39
39
  files:
40
+ - ".gitignore"
40
41
  - LICENSE
41
42
  - README.md
42
43
  - lib/capistrano/wordpress.rb