wordpresstrano-ext 0.0.4

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d4cd20515f7b41de7bbb87b628d2f10f4271a166
4
+ data.tar.gz: 066c49fb8a373c77091cdd3e21fa102279b2d2ed
5
+ SHA512:
6
+ metadata.gz: e4fdb354d5afedf96c515acb2f27230fb7d2a3bf94366816fa9e2422b7e6f6ac5ff596a36ec354aac5d0d90222ba6676d215df41d4d9135d3629b80608db1219
7
+ data.tar.gz: 9ac8e8407c7e0baae6454be12a149cac5ad04517a1c69cb0a2ff376e6e60ab9a75807e0586e1c2bce8bf871a874937b10651a803ce4d86629fb66ea6dffaa225
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ # OS generated files #
2
+ ######################
3
+ .DS_Store
4
+ ehthumbs.db
5
+ Icon?
6
+ Thumbs.db
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Nialto Services
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # WordPresstrano Extensions
2
+
3
+ This gem is currently in beta.
4
+
5
+ Documentation coming soon!
@@ -0,0 +1,6 @@
1
+ # Load all helpers and capistrano tasks
2
+ ["ext/helpers/**/*.rb", "ext/tasks/**/*.rake", "ext/hooks.rb"].each do |glob|
3
+ Dir.glob(File.expand_path(File.join('..', glob), __FILE__)).each do |file_path|
4
+ load file_path
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ # Perform a safety check before running tasks
2
+ before "db:pull", "deploy:safety_check"
3
+ before "htaccess:pull", "deploy:safety_check"
4
+ before "uploads:pull", "deploy:safety_check"
5
+
6
+ # Check binaries before performing tasks
7
+ before "erase_deployment_data", "deploy:safety_check"
@@ -0,0 +1,36 @@
1
+ namespace :db do
2
+ desc "Pull down the WordPress database"
3
+ task :pull do
4
+ file = "#{SecureRandom.hex(8)}.sql"
5
+
6
+ local_path = File.join(Dir.pwd, file)
7
+ remote_path = File.join(fetch(:tmp_dir), file)
8
+
9
+ unless fetch(:confirm_pull_database)
10
+ set :confirm_pull_database, ask("confirmation for local database overwrite", "Y/n")
11
+ end
12
+
13
+ next unless true == fetch(:confirm_pull_database) or ["y", "yes"].include? fetch(:confirm_pull_database).downcase
14
+
15
+ on roles(:app) do |server|
16
+ info "Pulling WordPress database from #{server.user}@#{server.hostname}"
17
+
18
+ within release_path do
19
+ execute :wp, :db, :export, remote_path
20
+ end
21
+
22
+ download! remote_path, local_path
23
+
24
+ execute :rm, "-f", remote_path
25
+ end
26
+
27
+ run_locally do
28
+ execute :wp, :db, :import, local_path
29
+ execute :rm, "-f", local_path
30
+
31
+ if fetch(:local_site_url) and fetch(:site_url)
32
+ execute :wp, "search-replace", fetch(:site_url), fetch(:local_site_url)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,41 @@
1
+ task :erase_deployment_data do
2
+ set :erase_confirmation, ask("Are you sure? This will erase ALL deployment data from ALL servers", "YES/no")
3
+
4
+ unless "YES" == fetch(:erase_confirmation, false)
5
+ run_locally do
6
+ error "Aborted erasure of deployment data."
7
+ end
8
+
9
+ next
10
+ end
11
+
12
+ on roles(:app) do |server|
13
+ if test("[ -d #{release_path} ]")
14
+ within release_path do
15
+ info "Deleting the WordPress database #{server.user}@#{server.hostname}"
16
+
17
+ execute :wp, :db, :reset, "--yes"
18
+ end
19
+ end
20
+
21
+ if test("[ -d #{fetch(:deploy_to)} ]") or test("[ -f #{fetch(:deploy_to)} ]") or test("[ -h #{fetch(:deploy_to)} ]")
22
+ info "Deleting the deployment directory from #{server.user}@#{server.hostname}"
23
+
24
+ execute :rm, "-rf", fetch(:deploy_to)
25
+ end
26
+
27
+ if test("[ -d #{fetch(:website_root)} ]") or test("[ -f #{fetch(:website_root)} ]") or test("[ -h #{fetch(:website_root)} ]")
28
+ info "Deleting the website root directory from #{server.user}@#{server.hostname}"
29
+
30
+ execute :rm, "-rf", fetch(:website_root)
31
+ end
32
+
33
+ info "Creating an empty directory at the website root on #{server.user}@#{server.hostname}"
34
+
35
+ execute :mkdir, "-p", fetch(:website_root)
36
+
37
+ info "Creating a blank index file in the website root on #{server.user}@#{server.hostname}"
38
+
39
+ execute :touch, File.join(fetch(:website_root), "index.html")
40
+ end
41
+ end
@@ -0,0 +1,39 @@
1
+ namespace :htaccess do
2
+ desc "Pull down the .htaccess file"
3
+ task :pull do
4
+ file = ".htaccess"
5
+
6
+ remote_file = File.join(release_path, file)
7
+
8
+ on roles(:app) do |server|
9
+ unless test("[ -f #{remote_file} ]")
10
+ error "No #{file} file found on #{server.user}@#{server.hostname}"
11
+
12
+ next
13
+ end
14
+
15
+ if File.file? file
16
+ local_sha256sum = Digest::SHA256.hexdigest(File.read(file))
17
+ remote_sha256sum = capture("sha256sum #{remote_file}").split(' ').first
18
+
19
+ if local_sha256sum == remote_sha256sum
20
+ info "No changes detected in #{file} file on #{server.user}@#{server.hostname}"
21
+
22
+ next
23
+ end
24
+
25
+ unless fetch(:confirm_pull_htaccess)
26
+ set :confirm_pull_htaccess, ask("confirmation for local #{file} file overwrite", "Y/n")
27
+ end
28
+
29
+ next unless true == fetch(:confirm_pull_htaccess) or ["y", "yes"].include? fetch(:confirm_pull_htaccess).downcase
30
+ end
31
+
32
+ info "Pulling #{file} file from #{server.user}@#{server.hostname}"
33
+
34
+ download! remote_file, file
35
+
36
+ break
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,20 @@
1
+ desc "Pull down everything from the remote server"
2
+ task :pull do
3
+ set :confirm_pull_all, ask("confirmation to pull everything", "YES/no")
4
+
5
+ unless "YES" == fetch(:confirm_pull_all)
6
+ run_locally do
7
+ error "Nothing will be pulled from the remote server"
8
+ end
9
+
10
+ next
11
+ end
12
+
13
+ set :confirm_pull_database, true
14
+ set :confirm_pull_htaccess, true
15
+ set :confirm_pull_uploads, true
16
+
17
+ invoke 'htaccess:pull'
18
+ invoke 'uploads:pull'
19
+ invoke 'db:pull'
20
+ end
@@ -0,0 +1,36 @@
1
+ namespace :uploads do
2
+ desc "Pull down the uploads directory"
3
+ task :pull do
4
+ directory = File.join("wp-content", "uploads")
5
+
6
+ local_path = File.join(Dir.pwd, directory)
7
+ remote_path = File.join(release_path, directory)
8
+
9
+ on roles(:app) do |server|
10
+ unless test("[ -d #{remote_path} ]")
11
+ error "There isn't a #{directory} directory on #{server.user}@#{server.hostname}"
12
+
13
+ next
14
+ end
15
+
16
+ unless fetch(:confirm_pull_uploads)
17
+ set :confirm_pull_uploads, ask("confirmation for local #{directory} directory overwrite", "Y/n")
18
+ end
19
+
20
+ next unless true == fetch(:confirm_pull_uploads) or ["y", "yes"].include? fetch(:confirm_pull_uploads).downcase
21
+
22
+ run_locally do
23
+ execute :mkdir, "-p", local_path
24
+ end
25
+
26
+ info "Pulling #{directory} directory from #{server.user}@#{server.hostname}"
27
+
28
+ # Fix for rsync
29
+ remote_path += "/"
30
+
31
+ run_locally do
32
+ execute :rsync, "-lrtvzO", "--delete-before", (server.port ? "-e 'ssh -p #{server.port}'" : nil), "#{server.user}@#{server.hostname}:#{remote_path}", local_path
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1 @@
1
+ require 'capistrano/wordpress/ext'
@@ -0,0 +1,16 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'wordpresstrano-ext'
3
+ s.version = '0.0.4'
4
+ s.date = '2015-08-09'
5
+ s.authors = ['Nialto Services']
6
+ s.email = 'support@nialtoservices.co.uk'
7
+ s.summary = 'Extensions for the WordPresstrano gem'
8
+ s.description = 'Extra tasks and features for the WordPresstrano gem'
9
+ s.homepage = 'http://rubygems.org/gems/wordpresstrano-ext'
10
+ s.files = `git ls-files`.split($/)
11
+ s.require_paths = ['lib']
12
+ s.license = 'MIT'
13
+
14
+ s.required_ruby_version = '>= 2.0.0'
15
+ s.add_dependency 'wordpresstrano', '~> 0.2', '>= 0.2.0'
16
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wordpresstrano-ext
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Nialto Services
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: wordpresstrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.2.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.0
33
+ description: Extra tasks and features for the WordPresstrano gem
34
+ email: support@nialtoservices.co.uk
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - ".gitignore"
40
+ - LICENSE
41
+ - README.md
42
+ - lib/capistrano/wordpress/ext.rb
43
+ - lib/capistrano/wordpress/ext/hooks.rb
44
+ - lib/capistrano/wordpress/ext/tasks/database.rake
45
+ - lib/capistrano/wordpress/ext/tasks/erase_deployment_data.rake
46
+ - lib/capistrano/wordpress/ext/tasks/htaccess.rake
47
+ - lib/capistrano/wordpress/ext/tasks/pull.rake
48
+ - lib/capistrano/wordpress/ext/tasks/uploads.rake
49
+ - lib/wordpresstrano-ext.rb
50
+ - wordpresstrano-ext.gemspec
51
+ homepage: http://rubygems.org/gems/wordpresstrano-ext
52
+ licenses:
53
+ - MIT
54
+ metadata: {}
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 2.0.0
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 2.4.8
72
+ signing_key:
73
+ specification_version: 4
74
+ summary: Extensions for the WordPresstrano gem
75
+ test_files: []