wordpress-capistrano 0.1.2 → 0.2.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
  SHA1:
3
- metadata.gz: ed901b1c8b9f7d7638e5ec79b5607961c4d84ea4
4
- data.tar.gz: 4331769c51174c97771a9cd5f18620ab342dc113
3
+ metadata.gz: 2a67892bbad398945f9af1575ee27a7482b52064
4
+ data.tar.gz: fc4cab81e20459f09c792d4a149fb2c5a557e45f
5
5
  SHA512:
6
- metadata.gz: e522f090528aa726428aa8cffa8282df8b790067e04a8df5d14bf340467872d85d7efe2b074fb96a5c8f25e9014acbf1e7311859aa955a21280c0975f9ef936a
7
- data.tar.gz: 9d9fad23ffefdf1c47ffe06f1c2924021f9b33ebbba9f800665889d02defa2a7ea9ca338af472a5161199bf9b379c98ebc8ef29e0ad42e677aa24a7ecfea3034
6
+ metadata.gz: 1e3636fc4ded0b9afbe0cdb40259199983a8627e7ec80a634d2454a72d9b360af7cd1a12fb1c68a9a09da402cc9b4d76b9e58e6d3b49bab1dde88b5563ce5cf2
7
+ data.tar.gz: 5978465a94f477b3bbd41aa10c77884f74ccb67e364902808f561e4372e2ccf185fca8b3a22e0b5fea56d3b9eb81246ab88f4abe39463a17799711cbcadb5316
data/README.md CHANGED
@@ -33,6 +33,7 @@ require 'capistrano/wordpress'
33
33
  * wordpress:db:pull - Exports your remote database and imports it on your local
34
34
  * wordpress:db:deploy - Uploads the <database name>.sql in your version control and imports in on remote
35
35
  * wordpress:uploads:sync - Synchronises your local and remote wp-content/uploads folder so that you have all assets
36
+ * wordpress:paths - Updates WordPress paths to match latest release folders
36
37
 
37
38
  You can run any of these by issuing the following commands..
38
39
 
@@ -41,6 +42,7 @@ $ bundle exec cap production wordpress:db:push
41
42
  $ bundle exec cap production wordpress:db:pull
42
43
  $ bundle exec cap production wordpress:db:deploy
43
44
  $ bundle exec cap production wordpress:uploads:sync
45
+ $ bundle exec cap production wordpress:paths
44
46
  ```
45
47
 
46
48
  None of these tasks are built into the default Capistrano deploy as they are potentially damaging.
@@ -16,6 +16,8 @@ namespace :wordpress do
16
16
  run_locally do
17
17
  execute :wp, "--path=#{fetch(:wp_path)} db import database.sql"
18
18
  execute :rm, "database.sql"
19
+ execute :wp, "--path=#{fetch(:wp_path)}", :option, :delete, :template_root
20
+ execute :wp, "--path=#{fetch(:wp_path)}", :option, :delete, :stylesheet_root
19
21
  end
20
22
 
21
23
  execute :rm, "#{fetch(:tmp_dir)}/database.sql"
@@ -42,6 +44,7 @@ namespace :wordpress do
42
44
  execute :wp, "--path=#{fetch(:wp_path)} db import #{fetch(:tmp_dir)}/database.sql"
43
45
  execute :wp, "--path=#{fetch(:wp_path)} search-replace #{fetch(:local_url)} #{fetch(:url)}"
44
46
  execute :rm, "#{fetch(:tmp_dir)}/database.sql"
47
+ invoke 'wordpress:paths'
45
48
  end
46
49
  end
47
50
 
@@ -60,6 +63,7 @@ namespace :wordpress do
60
63
  execute :wp, "--path=#{fetch(:wp_path)} db import #{fetch(:tmp_dir)}/database.sql"
61
64
  execute :wp, "--path=#{fetch(:wp_path)} search-replace #{fetch(:local_url)} #{fetch(:url)}"
62
65
  execute :rm, "#{fetch(:tmp_dir)}/database.sql"
66
+ invoke 'wordpress:paths'
63
67
  end
64
68
  end
65
69
 
@@ -92,6 +96,37 @@ namespace :wordpress do
92
96
  end
93
97
  end
94
98
 
99
+ desc "Update WordPress template root paths to point to the new release"
100
+ task :paths do
101
+
102
+ on roles(:db) do
103
+ within release_path do
104
+ with path: "#{fetch(:path)}:$PATH" do
105
+ if test :wp, :core, 'is-installed'
106
+
107
+ releases = capture("ls #{File.join(fetch(:deploy_to), 'releases')}")
108
+ last_release = File.join(releases_path, releases.split("\n").sort.last, fetch(:wp_themes))
109
+
110
+ [:stylesheet_root, :template_root].each do |option|
111
+ # Only change the value if it's an absolute path
112
+ # i.e. The relative path "/themes" must remain unchanged
113
+ # Also, the option might not be set, in which case we leave it like that
114
+ value = capture :wp, :option, :get, option, raise_on_non_zero_exit: false
115
+ if value != '' && value != '/themes'
116
+ execute :wp, "--path=#{fetch(:wp_path)}", :option, :set, option, last_release
117
+ end
118
+ end
119
+
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
125
+
126
+ end
127
+
128
+ def set_option_path
129
+
95
130
  end
96
131
 
97
132
  namespace :load do
@@ -100,5 +135,6 @@ namespace :load do
100
135
  set :local_url, 'localhost'
101
136
  set :wp_path, '.'
102
137
  set :wp_uploads, 'wp-content/uploads'
138
+ set :wp_themes, 'wp-content/themes'
103
139
  end
104
140
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'wordpress-capistrano'
7
- spec.version = '0.1.2'
7
+ spec.version = '0.2.0'
8
8
  spec.authors = ['Craig Morris']
9
9
  spec.email = ['craig.michael.morris@gmail.com']
10
10
  spec.description = %q{WordPress support for Capistrano 3.x}
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  #spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_dependency 'capistrano', '>= 3.0.0.pre'
20
+ spec.add_dependency 'capistrano', '~> 3.0'
21
21
 
22
22
  spec.add_development_dependency 'bundler', '~> 1.3'
23
23
  spec.add_development_dependency 'rake'
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordpress-capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Morris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-17 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0.pre
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.0.pre
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: WordPress support for Capistrano 3.x
@@ -59,7 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - Gemfile
64
64
  - Gemfile.lock
65
65
  - LICENSE
@@ -79,17 +79,17 @@ require_paths:
79
79
  - lib
80
80
  required_ruby_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.1.11
92
+ rubygems_version: 2.2.2
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: WordPress support for Capistrano 3.x