capistrano-olympus 0.0.1 → 0.0.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +65 -12
- data/capistrano-olympus.gemspec +3 -2
- data/lib/capistrano/tasks/database.rake +51 -10
- data/lib/capistrano/tasks/directories.rake +4 -4
- data/lib/capistrano/tasks/files.rake +0 -5
- data/lib/capistrano/tasks/htaccess.rake +2 -2
- data/lib/capistrano/tasks/robots.rake +2 -2
- data/lib/capistrano/vars/defaults.rb +5 -5
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb439b9ca9c5a43c7902ab97d60be5f54b651a91
|
4
|
+
data.tar.gz: e291eb32dffb9e70b46fe6d260cf3dfec5dce972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee240b208ff034b12910ccd38d3782c06f539e5584c106d55e0d055723ac60f6fbf667a9a79dac0eecc82ded361d023a3da1a48423e669543bda1d2e83182a9
|
7
|
+
data.tar.gz: cdc1aeb9370e5e57ecd0889d3c79c936c776e3f734d4b383630f71ed9d08eb32672525be8239c69830dc69a8fe8673ae17c5f8d45c433f88f30f557cb97af99d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,37 +1,40 @@
|
|
1
|
-
# Capistrano Olympus
|
1
|
+
# Capistrano Olympus [](https://rubygems.org/gems/capistrano-olympus)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
_in progress_
|
3
|
+
_**Capistrano Olympus** is a Ruby gem which provides a complete solution for deploying **WordPress** website easily.
|
4
|
+
Build with ♥ for **WordPress developers**._
|
6
5
|
|
7
6
|
---
|
8
7
|
|
9
8
|
[](https://packagist.org/packages/crewstyle/capistrano-olympus)
|
10
9
|
[](https://github.com/crewstyle/capistrano-olympus)
|
11
|
-

|
11
|
+
 -
|
12
|
+

|
12
13
|
|
13
14
|
---
|
14
15
|
|
15
|
-
|
16
|
+
**Capistrano Olympus** works especially with the [**Olympus framework**](https://github.com/crewstyle/Olympus) and [**Capistrano 3**](http://capistranorb.com/).
|
17
|
+
It depends on the following Capistrano tasks to deploy a WordPress application:
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
[Bountysource page](https://www.bountysource.com/teams/olympus)
|
20
|
-
[Documentation](https://olympus.readme.io/)
|
19
|
+
+ capistrano-composer: https://github.com/capistrano/composer
|
20
|
+
+ sshkit-sudo: https://github.com/kentaroi/sshkit-sudo
|
21
21
|
|
22
22
|
---
|
23
23
|
|
24
24
|
### Installation
|
25
25
|
|
26
|
+
Require `capistrano-olympus` in your gem file:
|
27
|
+
|
26
28
|
```
|
27
29
|
# Gemfile
|
28
30
|
gem 'capistrano', '~> 3.4'
|
29
|
-
gem 'capistrano-olympus', '~> 0.0.
|
31
|
+
gem 'capistrano-olympus', '~> 0.0.2'
|
32
|
+
gem 'colorize', '~> 0.7.7'
|
30
33
|
```
|
31
34
|
|
32
35
|
### Usage
|
33
36
|
|
34
|
-
Require capistrano-olympus in your cap file
|
37
|
+
Require `capistrano-olympus` in your cap file:
|
35
38
|
|
36
39
|
```
|
37
40
|
# Capfile
|
@@ -40,6 +43,56 @@ require 'capistrano/olympus'
|
|
40
43
|
|
41
44
|
---
|
42
45
|
|
46
|
+
### Settings
|
47
|
+
|
48
|
+
All default settings are defined in the `lib/capistrano/vars/defaults.rb` file. Please, refer to it to see exactly how the defaults are set up.
|
49
|
+
If you want to override any setting, just set it on your `app/deploy/config.rb` file.
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
# Config valid only for current version of Capistrano
|
53
|
+
lock '3.4.0'
|
54
|
+
|
55
|
+
# ~~~~
|
56
|
+
|
57
|
+
# Setup Capistrano
|
58
|
+
set :log_level, fetch(:log_level, :debug)
|
59
|
+
set :keep_releases, fetch(:keep_releases, 3)
|
60
|
+
|
61
|
+
# Setup Project ~ Update these settings
|
62
|
+
set :application, fetch(:application, 'olympus-capified')
|
63
|
+
set :localurl, fetch(:localurl, 'http://www.domain.tld')
|
64
|
+
|
65
|
+
# Setup Git
|
66
|
+
set :repo_url, 'git@github.com:crewstyle/Olympus.git'
|
67
|
+
set :scm, :git
|
68
|
+
set :git_enable_submodules, true
|
69
|
+
|
70
|
+
# Setup SSH
|
71
|
+
set :copy_exclude, ['.git', '.DS_Store', '.gitignore', '.gitmodules']
|
72
|
+
set :use_sudo, false
|
73
|
+
set :ssh_options, {
|
74
|
+
forward_agent: true
|
75
|
+
}
|
76
|
+
|
77
|
+
# ~~~~
|
78
|
+
|
79
|
+
# Setup Composer
|
80
|
+
set :composer_install_flags, '--no-dev --no-interaction --quiet --optimize-autoloader'
|
81
|
+
set :composer_roles, :all
|
82
|
+
set :composer_working_dir, -> { fetch(:release_path) }
|
83
|
+
set :composer_dump_autoload_flags, '--optimize'
|
84
|
+
set :composer_download_url, 'https://getcomposer.org/installer'
|
85
|
+
|
86
|
+
# ~~~~
|
87
|
+
|
88
|
+
# Setup Symlinks
|
89
|
+
set :linked_files, ["app/config/env.php", "app/config/salt.php", "web/.htaccess", "web/robots.txt"]
|
90
|
+
set :linked_dirs, ["web/statics/languages", "web/statics/plugins", "web/statics/uploads"]
|
91
|
+
|
92
|
+
```
|
93
|
+
|
94
|
+
---
|
95
|
+
|
43
96
|
### All we need is looooooooooooove :)
|
44
97
|
|
45
98
|
[](https://salt.bountysource.com/teams/olympus) [](https://www.bountysource.com/teams/olympus)
|
data/capistrano-olympus.gemspec
CHANGED
@@ -4,8 +4,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'capistrano-olympus'
|
7
|
-
gem.version = '0.0.
|
8
|
-
gem.date = '2016-
|
7
|
+
gem.version = '0.0.2'
|
8
|
+
gem.date = '2016-04-01'
|
9
9
|
gem.authors = ['Achraf Chouk']
|
10
10
|
gem.email = ['achrafchouk@gmail.com']
|
11
11
|
gem.description = "Capistrano 3.x deployment processes for WordPress and Olympus framework"
|
@@ -23,5 +23,6 @@ Gem::Specification.new do |gem|
|
|
23
23
|
|
24
24
|
gem.add_dependency 'capistrano', '~> 3.4'
|
25
25
|
gem.add_dependency 'capistrano-composer', '~> 0.0.6'
|
26
|
+
gem.add_dependency 'colorize', '~> 0.7.7'
|
26
27
|
gem.add_dependency 'sshkit-sudo', '~> 0.1.0'
|
27
28
|
end
|
@@ -17,11 +17,11 @@ namespace :database do
|
|
17
17
|
|
18
18
|
|
19
19
|
if File.exists?("#{release_path}/tmp/database.sql")
|
20
|
-
puts "Copy database.sql file"
|
20
|
+
puts "Copy database.sql file".colorize(:light_blue)
|
21
21
|
upload! StringIO.new(File.read("#{release_path}/tmp/database.sql")), "#{shared_path}/tmp/database.sql"
|
22
22
|
else
|
23
|
-
puts "Create database.sql file"
|
24
|
-
io = StringIO.new("CREATE DATABASE IF NOT EXISTS `#{fetch(:database_name)}
|
23
|
+
puts "Create database.sql file".colorize(:green)
|
24
|
+
io = StringIO.new("CREATE DATABASE IF NOT EXISTS `#{fetch(:database_name)}`;")
|
25
25
|
upload! io, File.join(shared_path, "database.sql")
|
26
26
|
execute :chmod, "644 #{shared_path}/database.sql"
|
27
27
|
|
@@ -32,14 +32,18 @@ namespace :database do
|
|
32
32
|
|
33
33
|
|
34
34
|
if File.exists?("#{release_path}/app/config/env.php")
|
35
|
-
puts "Copy env.php file"
|
35
|
+
puts "Copy env.php file".colorize(:light_blue)
|
36
36
|
upload! StringIO.new(File.read("#{release_path}/app/config/env.php")), "#{shared_path}/app/config/env.php"
|
37
37
|
else
|
38
|
-
puts "Create env.php file"
|
38
|
+
puts "Create env.php file".colorize(:green)
|
39
39
|
|
40
40
|
if fetch(:stage) == :production then
|
41
|
+
set :use_cache, true
|
42
|
+
set :use_wpcron, false
|
41
43
|
debug = StringIO.new(" 'debug' => false,")
|
42
44
|
else
|
45
|
+
set :use_cache, false
|
46
|
+
set :use_wpcron, true
|
43
47
|
debug = StringIO.new(" 'debug' => [
|
44
48
|
'savequeries' => true,
|
45
49
|
'script_debug' => true,
|
@@ -54,24 +58,37 @@ namespace :database do
|
|
54
58
|
* File auto-generated while first deploy.
|
55
59
|
*/
|
56
60
|
return [
|
57
|
-
//Database
|
61
|
+
// Database
|
58
62
|
'database' => [
|
59
63
|
'host' => '#{fetch(:database_host)}',
|
60
64
|
'name' => '#{fetch(:database_name)}',
|
61
65
|
'user' => '#{fetch(:database_user)}',
|
62
66
|
'pass' => '#{fetch(:database_pass)}',
|
67
|
+
'charset' => 'utf8',
|
68
|
+
'collate' => '',
|
69
|
+
'prefix' => 'wp_',
|
63
70
|
],
|
64
71
|
|
65
|
-
//WordPress
|
72
|
+
// WordPress configurations
|
66
73
|
'wordpress' => [
|
67
74
|
'home' => '#{fetch(:localurl)}',
|
68
75
|
'siteurl' => '#{fetch(:localurl)}/cms',
|
76
|
+
'revisions' => 3
|
69
77
|
],
|
70
78
|
|
71
|
-
//Secure?
|
79
|
+
// Secure?
|
72
80
|
'https' => false,
|
73
81
|
|
74
|
-
//
|
82
|
+
// Default WordPress cron?
|
83
|
+
'cron' => #{fetch(:use_wpcron)},
|
84
|
+
|
85
|
+
// Security
|
86
|
+
'file_edit' => false,
|
87
|
+
|
88
|
+
// Cache
|
89
|
+
'cache' => #{fetch(:use_cache)},
|
90
|
+
|
91
|
+
// Debug
|
75
92
|
#{fetch(:debug)}
|
76
93
|
];
|
77
94
|
|
@@ -82,14 +99,38 @@ return [
|
|
82
99
|
end
|
83
100
|
|
84
101
|
|
85
|
-
|
102
|
+
if File.exists?("#{release_path}/app/config/salt.php")
|
103
|
+
puts "Copy salt.php file".colorize(:light_blue)
|
104
|
+
upload! StringIO.new(File.read("#{release_path}/app/config/salt.php")), "#{shared_path}/app/config/salt.php"
|
105
|
+
else
|
106
|
+
puts "Create salt.php file".colorize(:green)
|
107
|
+
set :secret_keys, capture("curl -s -k https://api.wordpress.org/secret-key/1.1/salt")
|
108
|
+
|
109
|
+
io = StringIO.new("<?php
|
110
|
+
|
111
|
+
/**
|
112
|
+
* File auto-generated while first deploy.
|
113
|
+
* @link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service
|
114
|
+
*/
|
115
|
+
#{fetch(:secret_keys)}
|
116
|
+
|
117
|
+
")
|
118
|
+
upload! io, File.join(shared_path, "salt.php")
|
119
|
+
execute :chmod, "644 #{shared_path}/salt.php"
|
120
|
+
execute :mv, "#{shared_path}/salt.php", "#{shared_path}/app/config/"
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
puts "Execute wp-cli commands to create database".colorize(:green)
|
86
125
|
execute :mkdir, '-p', "#{shared_path}/tmp/wpcli"
|
87
126
|
execute "wp core download --path=#{shared_path}/tmp/wpcli --force"
|
88
127
|
|
89
128
|
unless File.exists?("#{shared_path}/tmp/wpcli/wp-config.php")
|
129
|
+
puts "Execute wp-cli command to generate wp-config.php file".colorize(:green)
|
90
130
|
execute "wp core config --path=#{shared_path}/tmp/wpcli --dbname=#{fetch(:database_name)} --dbuser=#{fetch(:database_user)} --dbpass=#{fetch(:database_pass)}"
|
91
131
|
end
|
92
132
|
|
133
|
+
puts "Execute wp-cli command to install WordPress in the database".colorize(:green)
|
93
134
|
execute "wp core install --path=#{shared_path}/tmp/wpcli --url=#{fetch(:localurl)} --title=#{fetch(:application)} --admin_user=#{fetch(:wordpress_name)} --admin_password=#{fetch(:wordpress_pass)} --admin_email=#{fetch(:wordpress_mail)}"
|
94
135
|
|
95
136
|
execute :rm, '-rf', "#{shared_path}/tmp"
|
@@ -6,22 +6,22 @@ namespace :directories do
|
|
6
6
|
on release_roles(:all) do
|
7
7
|
|
8
8
|
if test "[ ! -d \"#{shared_path}/tmp\" ]"
|
9
|
+
puts "Create tmp folder".colorize(:green)
|
9
10
|
execute :mkdir, '-p', "#{shared_path}/tmp"
|
10
11
|
end
|
11
12
|
|
12
|
-
if test "[ ! -d \"#{shared_path}/app/config/env\" ]"
|
13
|
-
execute :mkdir, '-p', "#{shared_path}/app/config/env"
|
14
|
-
end
|
15
|
-
|
16
13
|
if test "[ ! -d \"#{shared_path}/web/statics/languages\" ]"
|
14
|
+
puts "Create web/statics/languages folder".colorize(:green)
|
17
15
|
execute :mkdir, '-p', "#{shared_path}/web/statics/languages"
|
18
16
|
end
|
19
17
|
|
20
18
|
if test "[ ! -d \"#{shared_path}/web/statics/plugins\" ]"
|
19
|
+
puts "Create web/statics/plugins folder".colorize(:green)
|
21
20
|
execute :mkdir, '-p', "#{shared_path}/web/statics/plugins"
|
22
21
|
end
|
23
22
|
|
24
23
|
if test "[ ! -d \"#{shared_path}/web/statics/uploads\" ]"
|
24
|
+
puts "Create web/statics/uploads folder".colorize(:green)
|
25
25
|
execute :mkdir, '-p', "#{shared_path}/web/statics/uploads"
|
26
26
|
end
|
27
27
|
|
@@ -5,11 +5,6 @@ namespace :files do
|
|
5
5
|
task :do_actions do
|
6
6
|
on release_roles(:all) do
|
7
7
|
|
8
|
-
if File.exists?("#{release_path}/app/config/common.php")
|
9
|
-
puts "Copy common.php file"
|
10
|
-
upload! StringIO.new(File.read("#{release_path}/app/config/common.php")), "#{shared_path}/app/config/common.php"
|
11
|
-
end
|
12
|
-
|
13
8
|
# Create DB files, and install data
|
14
9
|
invoke "database:do_actions"
|
15
10
|
|
@@ -6,10 +6,10 @@ namespace :htaccess do
|
|
6
6
|
on release_roles(:all) do
|
7
7
|
|
8
8
|
if File.exists?("#{release_path}/web/.htaccess")
|
9
|
-
puts "Copy .htaccess file"
|
9
|
+
puts "Copy .htaccess file".colorize(:light_blue)
|
10
10
|
upload! StringIO.new(File.read("#{release_path}/web/.htaccess")), "#{shared_path}/web/.htaccess"
|
11
11
|
else
|
12
|
-
puts "Create .htaccess file"
|
12
|
+
puts "Create .htaccess file".colorize(:green)
|
13
13
|
io = StringIO.new("
|
14
14
|
# BEGIN WordPress
|
15
15
|
|
@@ -6,10 +6,10 @@ namespace :robots do
|
|
6
6
|
on release_roles(:all) do
|
7
7
|
|
8
8
|
if File.exists?("#{release_path}/web/robots.txt")
|
9
|
-
puts "Copy robots.txt file"
|
9
|
+
puts "Copy robots.txt file".colorize(:light_blue)
|
10
10
|
upload! StringIO.new(File.read("#{release_path}/web/robots.txt")), "#{shared_path}/web/robots.txt"
|
11
11
|
else
|
12
|
-
puts "Create robots.txt file"
|
12
|
+
puts "Create robots.txt file".colorize(:green)
|
13
13
|
if fetch(:stage) == :production then
|
14
14
|
io = StringIO.new("Sitemap: #{fetch(:localurl)}/sitemap.xml
|
15
15
|
|
@@ -4,12 +4,12 @@ lock '3.4.0'
|
|
4
4
|
# ~~~~
|
5
5
|
|
6
6
|
# Setup Capistrano
|
7
|
-
set :log_level, :debug
|
8
|
-
set :keep_releases, 3
|
7
|
+
set :log_level, fetch(:log_level, :debug)
|
8
|
+
set :keep_releases, fetch(:keep_releases, 3)
|
9
9
|
|
10
10
|
# Setup Project ~ Update these settings
|
11
|
-
set :application, 'olympus-capified'
|
12
|
-
set :localurl, 'http://www.domain.tld'
|
11
|
+
set :application, fetch(:application, 'olympus-capified')
|
12
|
+
set :localurl, fetch(:localurl, 'http://www.domain.tld')
|
13
13
|
|
14
14
|
# Setup Git
|
15
15
|
set :repo_url, 'git@github.com:crewstyle/Olympus.git'
|
@@ -35,5 +35,5 @@ set :composer_download_url, 'https://getcomposer.org/installer'
|
|
35
35
|
# ~~~~
|
36
36
|
|
37
37
|
# Setup Symlinks
|
38
|
-
set :linked_files, ["app/config/env.php", "web/.htaccess", "web/robots.txt"]
|
38
|
+
set :linked_files, ["app/config/env.php", "app/config/salt.php", "web/.htaccess", "web/robots.txt"]
|
39
39
|
set :linked_dirs, ["web/statics/languages", "web/statics/plugins", "web/statics/uploads"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-olympus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Achraf Chouk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.0.6
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: colorize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.7.7
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.7.7
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: sshkit-sudo
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|