capistrano-wp 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -11,30 +11,24 @@ also deploy multisite environments with WP at the root).
11
11
 
12
12
  ## Usage
13
13
 
14
- This is a very early release, and the usage is not extremely well documented. A minimal Capfile might look like this:
15
-
16
- require 'rubygems'
17
- require 'railsless-deploy'
18
- require 'crowdfavorite/wordpress'
19
- # tags/3.4.1, branches/3.4, trunk
20
- set :wordpress_version, "branches/3.4"
21
- set :application, "wp.example.com"
22
- set :scm, :git
23
- set :repository, "git@github.com:example/wordpress-site.git"
24
- set :git_enable_submodules, 1
25
- set :user, 'wpdeploy'
26
- server 'web.example.com', :app, :web, :primary => true
27
- # Deploy to /var/www/domains/wp.example.com/htdocs
28
- # Link uploads, blogs.dir, cache from /var/www/domains/wp.example.com/shared
29
- # to /var/www/domains/wp.example.com/htdocs/wp-content
30
- # Install WordPress into /var/www/domains/wp.example.com/htdocs/wp
31
- set :base_dir, '/var/www/domains'
32
- set :deploy_to, File.join(base_dir, application)
33
- set :current_dir, 'htdocs'
34
- set(:wp_path) { File.join(release_path, 'wp') }
35
- set :deploy_via, :remote_cache
36
-
37
- Also see the `:wp_symlinks` and `:wp_configs` settings in the source.
14
+ See `doc/examples` for an example Capfile and capistrano config directory.
15
+
16
+ General Capistrano usage:
17
+
18
+ 1. Create a user for deploying your WordPress install
19
+ 2. Create an SSH key for the deploy user, and make sure you can SSH to it from your local machine
20
+ 3. [Install RubyGems][rubygems]. Crowd Favorite prefers to use [RVM][rvm] to maintain ruby versions, rubygems, and self-contained sets of gems.
21
+ 4. Install the capistrano-wp gem (which will install Capistrano and friends): `gem install capistrano-wp`
22
+ 5. Ensure that your project is in a repository starting at the web root
23
+ 6. Copy the example configuration (from doc/examples) into the root of your repository, and customize as appropriate
24
+ 7. Make sure your `:deploy_to` path exists and is owned by the deploy user
25
+ 8. Run `cap deploy:setup` to set up the initial directories
26
+ 9. Run `cap deploy` to push out a new version of your code
27
+ 10. Update your web server configuration to point to the current-release directory (in the `:deply_to` directory, named `httpdocs` by default)
28
+ 11. Relax and enjoy painless deployment
29
+
30
+ [rubygems]: http://rubygems.org/pages/download
31
+ [rvm]: https://rvm.io/
38
32
 
39
33
  ## Development
40
34
 
@@ -48,5 +42,5 @@ When updating the gem requirements:
48
42
 
49
43
  # Copyright
50
44
 
51
- Copyright (c) 2012 Crowd Favorite, Ltd. See LICENSE.txt for further details.
45
+ Copyright (c) 2012-2013 Crowd Favorite, Ltd. Released under the Apache License, version 2.0. See LICENSE.txt for further details.
52
46
 
data/Rakefile CHANGED
@@ -1,4 +1,17 @@
1
1
  # encoding: utf-8
2
+ # Copyright 2012-2013 Crowd Favorite, Ltd.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
2
15
 
3
16
  require 'rubygems'
4
17
  require 'bundler'
@@ -16,13 +29,13 @@ Jeweler::Tasks.new do |gem|
16
29
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
30
  gem.name = "capistrano-wp"
18
31
  gem.homepage = "http://github.com/crowdfavorite/gem-capistrano-wp"
19
- gem.license = "GPL"
32
+ gem.license = "Apache License version 2"
20
33
  gem.summary = %Q{Crowd Favorite WordPress Capistrano recipes}
21
- gem.description = <<-EOF
34
+ gem.description = <<-EOF.gsub(/^ {4}/, '')
22
35
  Recipes for deploying and maintaining remote WordPress installations with
23
- Capistrano. Pulls in WordPress from SVN, optionally using a local or
36
+ Capistrano. Pulls in WordPress from SVN, optionally using a local or
24
37
  remote cache, and supports a number of common operations and tasks towards
25
- the care and feeding of sites that may not be 100% maintained through
38
+ the care and feeding of sites that may not be 100% maintained through
26
39
  version control.
27
40
  EOF
28
41
  gem.authors = ["Crowd Favorite"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "capistrano-wp"
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Crowd Favorite"]
12
- s.date = "2013-07-11"
13
- s.description = " Recipes for deploying and maintaining remote WordPress installations with\n Capistrano. Pulls in WordPress from SVN, optionally using a local or \n remote cache, and supports a number of common operations and tasks towards\n the care and feeding of sites that may not be 100% maintained through \n version control.\n"
12
+ s.date = "2013-07-15"
13
+ s.description = "Recipes for deploying and maintaining remote WordPress installations with\nCapistrano. Pulls in WordPress from SVN, optionally using a local or\nremote cache, and supports a number of common operations and tasks towards\nthe care and feeding of sites that may not be 100% maintained through\nversion control.\n"
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
16
16
  "README.md"
@@ -24,6 +24,11 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "capistrano-wp.gemspec",
27
+ "doc/examples/Capfile",
28
+ "doc/examples/config/deploy.rb",
29
+ "doc/examples/config/deploy/production.rb",
30
+ "doc/examples/config/deploy/staging.rb",
31
+ "doc/examples/config/staging-local-config.php",
27
32
  "lib/capistrano-wp.rb",
28
33
  "lib/capistrano/crowdfavorite/wordpress.rb",
29
34
  "lib/crowdfavorite.rb",
@@ -41,7 +46,7 @@ Gem::Specification.new do |s|
41
46
  "spec/support/capistrano.rb"
42
47
  ]
43
48
  s.homepage = "http://github.com/crowdfavorite/gem-capistrano-wp"
44
- s.licenses = ["GPL"]
49
+ s.licenses = ["Apache License version 2"]
45
50
  s.require_paths = ["lib"]
46
51
  s.rubygems_version = "1.8.25"
47
52
  s.summary = "Crowd Favorite WordPress Capistrano recipes"
@@ -0,0 +1,19 @@
1
+ # Copyright 2012-2013 Crowd Favorite, Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'rubygems'
16
+ require 'railsless-deploy'
17
+ require 'crowdfavorite/wordpress'
18
+ load 'config/deploy' # remove this line to skip loading any of the default tasks
19
+
@@ -0,0 +1,38 @@
1
+ # Copyright 2012-2013 Crowd Favorite, Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ set :stages, %w(production staging)
16
+ set :default_stage, "production"
17
+
18
+ require "capistrano/ext/multistage"
19
+
20
+ #=============================================================================
21
+ # app details and WordPress requirements
22
+
23
+ # tags/3.5.2, branches/3.5, trunk
24
+ set :wordpress_version, "branches/3.5"
25
+ set :application, "my_application"
26
+
27
+ #=============================================================================
28
+ # app source repository configuration
29
+
30
+ set :scm, :git
31
+ set :repository, "https://github.com/example/example-wp.git"
32
+ set :git_enable_submodules, 1
33
+
34
+ #=============================================================================
35
+ # Housekeeping
36
+ # clean up old releases on each deploy
37
+ set :keep_releases, 5
38
+ after "deploy:create_symlink", "deploy:cleanup"
@@ -0,0 +1,81 @@
1
+ # Copyright 2012-2013 Crowd Favorite, Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ set :stage, "production"
16
+
17
+ set :user, 'deployuser'
18
+ set :use_sudo, false
19
+
20
+ server '172.16.42.42', :app, :web, :primary => true
21
+ server '172.16.42.43', :app, :web
22
+
23
+ # Don't push code to this server with 'cap deploy'
24
+ server '172.16.17.17', :db, :no_release => true
25
+
26
+ set :base_dir, "/var/local/www/example"
27
+ set :deploy_to, File.join(fetch(:base_dir))
28
+ set :current_dir, "httpdocs"
29
+ set(:wp_path) { File.join(release_path, "wp") }
30
+ # :version_dir - where versions live, 'versions'
31
+ # :shared_dir - where shared files (wordpress cache, et cetera) live, 'shared'
32
+
33
+ # Deploy strategy - use :remote_cache when possible, but some servers need :copy
34
+ #set :deploy_via, :remote_cache
35
+ set :deploy_via, :remote_cache
36
+
37
+ # Specify a git branch to deploy
38
+ set :branch, fetch(:branch, "master")
39
+
40
+ #=============================================================================
41
+ # Files to link or copy into web root
42
+ # Symlinks are symlinked in
43
+
44
+ # wp_symlinks defaults to:
45
+ # "cache" => "wp-content/cache"
46
+ # "uploads" => "wp-content/uploads"
47
+ # "blogs.dir" => "wp-content/blogs.dir"
48
+ #
49
+ # To override, set the target to nil:
50
+ #
51
+ #set :wp_symlinks, [{
52
+ # "cache" => nil
53
+ #}]
54
+ #
55
+ # Or add other files:
56
+ #
57
+ #set :wp_symlinks, [{
58
+ # "authcache" => "wp-content/authcache"
59
+ #}]
60
+ #
61
+ # Configs are copied in, and default to:
62
+ # "db-config.php" => "/",
63
+ # "advanced-cache.php" => "wp-content/",
64
+ # "object-cache.php" => "wp-content/",
65
+ # "*.html" => "/",
66
+ #
67
+ # To override (like wp_symlinks):
68
+ #set :wp_configs, [{
69
+ #}]
70
+ #
71
+ # Stage-specific overrides are copied from the config directory,
72
+ # like production-example.txt or staging-example.txt
73
+ # Default list:
74
+ #
75
+ # "local-config.php" => "local-config.php",
76
+ # ".htaccess" => ".htaccess"
77
+ #
78
+ # To override or add other files (as above, but note no []):
79
+ #
80
+ #set :stage_specific_overrides, {
81
+ #}
@@ -0,0 +1,81 @@
1
+ # Copyright 2012-2013 Crowd Favorite, Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ set :stage, "staging"
16
+
17
+ set :user, 'deployuser'
18
+ set :use_sudo, false
19
+
20
+ server '172.16.1.42', :app, :web, :primary => true
21
+ server '172.16.1.43', :app, :web
22
+
23
+ # Don't push code to this server with 'cap deploy'
24
+ server '172.16.1.17', :db, :no_release => true
25
+
26
+ set :base_dir, "/var/local/www/example-staging"
27
+ set :deploy_to, File.join(fetch(:base_dir))
28
+ set :current_dir, "httpdocs"
29
+ set(:wp_path) { File.join(release_path, "wp") }
30
+ # :version_dir - where versions live, 'versions'
31
+ # :shared_dir - where shared files (wordpress cache, et cetera) live, 'shared'
32
+
33
+ # Deploy strategy - use :remote_cache when possible, but some servers need :copy
34
+ #set :deploy_via, :remote_cache
35
+ set :deploy_via, :remote_cache
36
+
37
+ # Specify a git branch to deploy
38
+ set :branch, fetch(:branch, "develop")
39
+
40
+ #=============================================================================
41
+ # Files to link or copy into web root
42
+ # Symlinks are symlinked in
43
+
44
+ # wp_symlinks defaults to:
45
+ # "cache" => "wp-content/cache"
46
+ # "uploads" => "wp-content/uploads"
47
+ # "blogs.dir" => "wp-content/blogs.dir"
48
+ #
49
+ # To override, set the target to nil:
50
+ #
51
+ #set :wp_symlinks, [{
52
+ # "cache" => nil
53
+ #}]
54
+ #
55
+ # Or add other files:
56
+ #
57
+ #set :wp_symlinks, [{
58
+ # "authcache" => "wp-content/authcache"
59
+ #}]
60
+ #
61
+ # Configs are copied in, and default to:
62
+ # "db-config.php" => "/",
63
+ # "advanced-cache.php" => "wp-content/",
64
+ # "object-cache.php" => "wp-content/",
65
+ # "*.html" => "/",
66
+ #
67
+ # To override (like wp_symlinks):
68
+ #set :wp_configs, [{
69
+ #}]
70
+ #
71
+ # Stage-specific overrides are copied from the config directory,
72
+ # like production-example.txt or staging-example.txt
73
+ # Default list:
74
+ #
75
+ # "local-config.php" => "local-config.php",
76
+ # ".htaccess" => ".htaccess"
77
+ #
78
+ # To override or add other files (as above, but note no []):
79
+ #
80
+ #set :stage_specific_overrides, {
81
+ #}
@@ -0,0 +1,28 @@
1
+ <?php
2
+ /* Copyright 2012-2013 Crowd Favorite, Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ define("WP_HOME", 'http://example.dev');
18
+ define("WP_SITEURL", 'http://example.dev/wp');
19
+ define("WP_CONTENT_URL", 'http://example.dev/wp-content');
20
+ define("WP_CONTENT_DIR", dirname(__FILE__) . '/'. 'wp-content');
21
+
22
+ define('DB_NAME', 'example_staging');
23
+ define('DB_USER', 'example');
24
+ define('DB_PASSWORD', 'correct-horse-battery-staple');
25
+ define('DB_HOST', '172.16.1.17');
26
+
27
+ define('WP_DEBUG', true);
28
+ define('SCRIPT_DEBUG', true);
data/lib/capistrano-wp.rb CHANGED
@@ -1,3 +1,17 @@
1
+ # Copyright 2012-2013 Crowd Favorite, Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'rubygems'
2
16
 
3
17
  require 'crowdfavorite'
@@ -1,2 +1,16 @@
1
+ # Copyright 2012-2013 Crowd Favorite, Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'crowdfavorite/wordpress'
2
16
  $stderr.puts " * capistrano/crowdfavorite/wordpress is deprecated - please require 'crowdfavorite/wordpress' instead"
data/lib/crowdfavorite.rb CHANGED
@@ -1,3 +1,17 @@
1
+ # Copyright 2012-2013 Crowd Favorite, Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'rubygems'
2
16
 
3
17
  module CrowdFavorite
@@ -1,3 +1,17 @@
1
+ # Copyright 2012-2013 Crowd Favorite, Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'tempfile'
2
16
 
3
17
  # These methods are used by recap tasks to run commands and detect when files have changed