wordpress-capistrano 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ODg2ZDhkZjQ1MmNkYmJlYjgxODFhYmI1ZjhmYTI3M2Y1YWU0NzIzYQ==
5
- data.tar.gz: !binary |-
6
- ZGJmOGE0ZTIxMjE0YjI0MjQ2ODY2ZTZmYWE5ZTA4ODI2ZGYwNGMxNQ==
2
+ SHA1:
3
+ metadata.gz: cf60f94f33769b45df3f359dc86969d27a08924d
4
+ data.tar.gz: 396f1035d0522b12be1d53a8cb5ca62bdab44007
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NzdhMmRjMzA0M2I1N2FiNTEyMjYxMDIwMmViNDgyMDMyMTExZjIxM2RlMmNm
10
- YjAyZjNiZDRlNTdjN2E2YTYxZjdkZWQ1MzEzMDY0MmMxOWMwNGQ2ZTcxMDdk
11
- OWM3MmQ2MGI3NTVkZjUxNTRkZTdjODJjNzA4MDRiOTcyZDdhOTI=
12
- data.tar.gz: !binary |-
13
- MjE2YmU5NWU3OGMxOWFjYTIzYzUzNWY4OGRkYzNkMDBiOTgxYzVhNDNhMDg0
14
- ZTg3ZGQ4NGY4NDcyY2IwMDAyMDJhNDUwNzAwM2JlZWQ2NThkOTc3YWI2NTIx
15
- MzZmNjE4ODczYzFiNmVlMjI0NDNmNmZkZDMyYTc1NTdkZTcwMjI=
6
+ metadata.gz: 84388e42c329e1c645aa244779252fafa7afbf814130ba2bc6f4e3ec15943528bf9cc77adf36f786cc574cf54331fd0dfe0869108f0d99f8f0cc9929517dafe7
7
+ data.tar.gz: 56e0cc2934b94f262586ea771913317f355bde063240a57c5baf1c5f6ba9bac6c9c4ad275f31d4aaf6f19425ae32d8f86084d5ada07f9ff918452ee91c5c3f58
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
- # A sample Gemfile
2
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
3
2
 
4
- # gem "rails"
5
- gem 'capistrano-composer'
3
+ # Specify your gem's dependencies in capistrano-bundler.gemspec
4
+ gemspec
data/README.md CHANGED
@@ -29,17 +29,26 @@ require 'wordpress/capistrano'
29
29
 
30
30
  `wordpress/capistrano` comes with 4 tasks:
31
31
 
32
- * wordpress:push_db
33
- * wordpress:pull_db
34
- * wordpress:deploy_db
35
- * wordpress:sync_content
32
+ * wordpress:db:push
33
+ * wordpress:db:pull
34
+ * wordpress:db:deploy
35
+ * wordpress:content:sync
36
36
 
37
- The `wordpress:deploy_db` and `wordpress:sync_content` tasks will run before deploy:updated as part of
38
- Capistrano's default deploy, or can be run in isolation with:
37
+ You can run any of these by issuing the following commands..
39
38
 
40
39
  ```bash
41
- $ cap production wordpress:deploy_db
42
- $ cap production wordpress:sync_content
40
+ $ bundle exec cap production wordpress:db:push
41
+ $ bundle exec cap production wordpress:db:pull
42
+ $ bundle exec cap production wordpress:db:deploy
43
+ $ bundle exec cap production wordpress:content:sync
44
+ ```
45
+
46
+ None of these tasks are built into the default Capistrano deploy as they are potentially damaging.
47
+
48
+ To add any of them (I've used wordpress:db:deploy and wordpress:content:sync on sites which I know all content updates are version controlled)
49
+
50
+ ```ruby
51
+
43
52
  ```
44
53
 
45
54
  ### Other Recommended Settings
@@ -47,19 +56,71 @@ $ cap production wordpress:sync_content
47
56
  This gem does not have libraries to perform common tasks like symlinking wp-content/uploads or symlinking database
48
57
  configuration files. Some recommended settings to go along with your deploy.rb are below.
49
58
 
59
+ #### Use Composer for WordPress and Plugins
60
+
61
+ ```json
62
+ {
63
+ "repositories": [
64
+ {
65
+ "type": "composer",
66
+ "url": "http://wpackagist.org"
67
+ },
68
+ {
69
+ "type": "package",
70
+ "package": {
71
+ "name": "wordpress",
72
+ "type": "webroot",
73
+ "version": "3.8.1",
74
+ "dist": {
75
+ "type": "zip",
76
+ "url": "http://en-au.wordpress.org/wordpress-3.8.1-en_AU.zip"
77
+ },
78
+ "require": {
79
+ "fancyguy/webroot-installer": "1.0.0"
80
+ }
81
+ }
82
+ },
83
+ ],
84
+ "require": {
85
+ "php": ">=5.3.0",
86
+ "wordpress": "3.8.1",
87
+ "fancyguy/webroot-installer": "1.0.0",
88
+ "wpackagist/advanced-custom-fields": "*",
89
+ "wpackagist/codepress-admin-columns": "*",
90
+ "wpackagist/custom-post-type-ui": "*",
91
+ "wpackagist/wordpress-importer": "*",
92
+ "wpackagist/duplicate-post": "*",
93
+ "wpackagist/simple-page-ordering": "*",
94
+ "wpackagist/adminimize": "*"
95
+ },
96
+ "require-dev": {
97
+ "wpackagist/debug-bar": "*",
98
+ "wpackagist/pretty-debug": "*"
99
+ },
100
+ "extra": {
101
+ "webroot-dir": "wp",
102
+ "webroot-package": "wordpress"
103
+ }
104
+ }
105
+ ```
106
+
107
+ #### Use Linked Dirs and Linked Files
108
+
50
109
  ```ruby
51
- set :url, 'http://www.wordpress.org'
52
- set :local_url, 'lid0043.localhost'
53
- set :wp_path, '.'
110
+ set :linked_dirs, %w{wp-content/uploads}
111
+ set :linked_files, %w{wp-config.local.php}
54
112
  ```
55
113
 
114
+
56
115
  ### Configuration
57
116
 
58
117
  Configurable options, shown here with defaults:
59
118
 
60
119
  ```ruby
61
- set :url, 'http://www.wordpress.org'
62
- set :local_url, 'lid0043.localhost'
120
+ set :url, 'www.wordpress.org'
121
+ set :local_url, 'localhost'
122
+ set :wp_path, '.'
123
+ set :wp_uploads, 'wp-content/uploads'
63
124
  ```
64
125
 
65
126
  ## Contributing
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -1,62 +1,98 @@
1
- namespace :composer do
2
- desc <<-DESC
3
- Installs composer.phar to the shared directory
4
- In order to use the .phar file, the composer command needs to be mapped:
5
- SSHKit.config.command_map[:composer] = "\#{shared_path.join("composer.phar")}"
6
- This is best used before deploy:starting:
7
- namespace :deploy do
8
- before :starting, 'composer:install_executable'
1
+ namespace :wordpress do
2
+
3
+ namespace :db do
4
+ desc "Pull the remote database"
5
+ task :pull do
6
+
7
+ on roles(:db) do
8
+ within release_path do
9
+ with path: "#{fetch(:path)}:$PATH" do
10
+ execute :wp, "--path=#{fetch(:wp_path)} db export #{fetch(:tmp_dir)}/database.sql"
11
+ end
12
+ end
13
+
14
+ download! "#{fetch(:tmp_dir)}/database.sql", "database.sql"
15
+
16
+ run_locally do
17
+ execute :wp, "--path=#{fetch(:wp_path)} db import database.sql"
18
+ execute :rm, "database.sql"
19
+ end
20
+
21
+ execute :rm, "#{fetch(:tmp_dir)}/database.sql"
9
22
  end
10
- DESC
11
- task :install_executable do
12
- on roles fetch(:composer_roles) do
13
- within shared_path do
14
- unless test "[", "-e", "composer.phar", "]"
15
- execute :curl, "-s", fetch(:composer_download_url), "|", :php
23
+
24
+ end
25
+
26
+ desc "Push the local database"
27
+ task :push do
28
+ on roles(:web) do
29
+
30
+ run_locally do
31
+ execute :wp, "--path=#{fetch(:wp_path)} db export database.sql"
32
+ end
33
+
34
+ upload! "database.sql", "#{fetch(:tmp_dir)}/database.sql"
35
+
36
+ run_locally do
37
+ execute :rm, "database.sql"
38
+ end
39
+
40
+ within release_path do
41
+ with path: "#{fetch(:path)}:$PATH" do
42
+ execute :wp, "--path=#{fetch(:wp_path)} db import #{fetch(:tmp_dir)}/database.sql"
43
+ execute :wp, "--path=#{fetch(:wp_path)} search-replace #{fetch(:local_url)} #{fetch(:url)}"
44
+ execute :rm, "#{fetch(:tmp_dir)}/database.sql"
45
+ end
16
46
  end
47
+
17
48
  end
18
49
  end
19
- end
20
50
 
21
- task :run, :command do |t, args|
22
- args.with_defaults(:command => :list)
23
- on roles fetch(:composer_roles) do
24
- within release_path do
25
- execute :composer, args[:command], *args.extras
51
+ desc "Push the database in version control"
52
+ task :deploy do
53
+
54
+ on roles(:db) do
55
+
56
+ upload! "#{fetch(:application)}.sql", "#{fetch(:tmp_dir)}/database.sql"
57
+
58
+ within release_path do
59
+ with path: "#{fetch(:path)}:$PATH" do
60
+ execute :wp, "--path=#{fetch(:wp_path)} db import #{fetch(:tmp_dir)}/database.sql"
61
+ execute :wp, "--path=#{fetch(:wp_path)} search-replace #{fetch(:local_url)} #{fetch(:url)}"
62
+ execute :rm, "#{fetch(:tmp_dir)}/database.sql"
63
+ end
64
+ end
65
+
26
66
  end
67
+
27
68
  end
28
69
  end
29
70
 
30
- desc <<-DESC
31
- Install the project dependencies via Composer. By default, require-dev \
32
- dependencies will not be installed.
71
+ namespace :content do
33
72
 
34
- You can override any of the defaults by setting the variables shown below.
73
+ desc "Synchronise local and remote wp content folders"
74
+ task :sync do
35
75
 
36
- set :composer_flags, '--no-dev --no-scripts --quiet --optimize-autoloader'
37
- set :composer_roles, :all
38
- DESC
39
- task :install do
40
- invoke "composer:run", :install, fetch(:composer_install_flags)
41
- end
76
+ run_locally do
77
+ roles(:all).each do |role|
78
+ user = role.user + "@" if !role.user.nil?
79
+ execute :rsync, "-avzO #{user}#{role.hostname}:#{release_path}/#{fetch(:wp_uploads)}/ #{fetch(:wp_uploads)}"
80
+ execute :rsync, "-avzO #{fetch(:wp_uploads)}/ #{user}#{role.hostname}:#{release_path}/#{fetch(:wp_uploads)}"
81
+ end
82
+ end
42
83
 
43
- task :dump_autoload do
44
- invoke "composer:run", :dumpautoload, fetch(:composer_dump_autoload_flags)
45
- end
84
+ end
46
85
 
47
- desc "Run the self-update command for composer.phar"
48
- task :self_update do
49
- invoke "composer:run", :selfupdate
50
86
  end
51
87
 
52
- before 'deploy:updated', 'composer:install'
88
+
53
89
  end
54
90
 
55
91
  namespace :load do
56
92
  task :defaults do
57
- set :composer_install_flags, '--no-dev --no-scripts --quiet --optimize-autoloader'
58
- set :composer_roles, :all
59
- set :composer_dump_autoload_flags, '--optimize'
60
- set :composer_download_url, "https://getcomposer.org/installer"
93
+ set :url, 'www.wordpress.org'
94
+ set :local_url, 'localhost'
95
+ set :wp_path, '.'
96
+ set :wp_uploads, 'wp-content/uploads'
61
97
  end
62
- end
98
+ end
@@ -4,12 +4,12 @@ $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'
7
+ spec.version = '0.1.1'
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}
11
11
  spec.summary = %q{WordPress support for Capistrano 3.x}
12
- spec.homepage = 'https://github.com/morrislaptop/wordpress-composer'
12
+ spec.homepage = 'https://github.com/morrislaptop/wordpress-capistrano'
13
13
  spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordpress-capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
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-02-16 00:00:00.000000000 Z
11
+ date: 2014-02-17 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
19
  version: 3.0.0.pre
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
26
  version: 3.0.0.pre
27
27
  - !ruby/object:Gem::Dependency
@@ -42,14 +42,14 @@ dependencies:
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
@@ -64,11 +64,12 @@ files:
64
64
  - Gemfile.lock
65
65
  - LICENSE
66
66
  - README.md
67
+ - Rakefile
67
68
  - lib/capistrano/tasks/wordpress.rake
68
69
  - lib/capistrano/wordpress.rb
69
70
  - lib/wordpress-capistrano.rb
70
71
  - wordpress-capistrano.gemspec
71
- homepage: https://github.com/morrislaptop/wordpress-composer
72
+ homepage: https://github.com/morrislaptop/wordpress-capistrano
72
73
  licenses:
73
74
  - MIT
74
75
  metadata: {}
@@ -78,12 +79,12 @@ require_paths:
78
79
  - lib
79
80
  required_ruby_version: !ruby/object:Gem::Requirement
80
81
  requirements:
81
- - - ! '>='
82
+ - - '>='
82
83
  - !ruby/object:Gem::Version
83
84
  version: '0'
84
85
  required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  requirements:
86
- - - ! '>='
87
+ - - '>='
87
88
  - !ruby/object:Gem::Version
88
89
  version: '0'
89
90
  requirements: []