cap-drupal8 0.1.5
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.
- data/cap-drupal8.gemspec +26 -0
- data/lib/cap-drupal8.rb +121 -0
- metadata +46 -0
data/cap-drupal8.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{cap-drupal8}
|
3
|
+
s.version = "0.1.5"
|
4
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
5
|
+
s.authors = ["Adam Long"]
|
6
|
+
s.date = %q{2016-01-08}
|
7
|
+
s.description = %q{A set of tasks for deploying Drupal8 projects with Capistrano}
|
8
|
+
s.email = %q{adam.michael.long@gmail.com}
|
9
|
+
s.files = [
|
10
|
+
"cap-drupal8.gemspec",
|
11
|
+
"lib/cap-drupal8.rb"
|
12
|
+
]
|
13
|
+
s.homepage = %q{https://github.com/AdamMichaelLong/cap-drupal8/}
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
s.rubygems_version = %q{1.3.6}
|
16
|
+
s.summary = %q{A set of tasks for deploying Drupal8 projects with Capistrano}
|
17
|
+
if s.respond_to? :specification_version then
|
18
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
19
|
+
s.specification_version = 3
|
20
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
21
|
+
else
|
22
|
+
end
|
23
|
+
else
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
data/lib/cap-drupal8.rb
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
|
3
|
+
require 'capistrano/recipes/deploy/scm'
|
4
|
+
require 'capistrano/recipes/deploy/strategy'
|
5
|
+
|
6
|
+
# =========================================================================
|
7
|
+
# These variables may be set in the client capfile if their default values
|
8
|
+
# are not sufficient.
|
9
|
+
# =========================================================================
|
10
|
+
|
11
|
+
set :scm, :git
|
12
|
+
set :deploy_via, :remote_cache
|
13
|
+
_cset :branch, "master"
|
14
|
+
set :git_enable_submodules, true
|
15
|
+
|
16
|
+
set :drush_cmd, "drush"
|
17
|
+
|
18
|
+
set :runner_group, "www-data"
|
19
|
+
set :group_writable, false
|
20
|
+
|
21
|
+
set(:deploy_to) { "/var/www/#{application}" }
|
22
|
+
set :shared_children, ['files', 'private']
|
23
|
+
|
24
|
+
after "deploy:update_code", "drupal:symlink_shared", "drupal_console:site_offline", "drush:updatedb", "drupal_console:site_online", "drush:cache_rebuild"
|
25
|
+
|
26
|
+
namespace :deploy do
|
27
|
+
desc <<-DESC
|
28
|
+
Prepares one or more servers for deployment. Before you can use any \
|
29
|
+
of the Capistrano deployment tasks with your project, you will need to \
|
30
|
+
make sure all of your servers have been prepared with `cap deploy:setup'. When \
|
31
|
+
you add a new server to your cluster, you can easily run the setup task \
|
32
|
+
on just that server by specifying the HOSTS environment variable:
|
33
|
+
|
34
|
+
$ cap HOSTS=new.server.com deploy:setup
|
35
|
+
|
36
|
+
It is safe to run this task on servers that have already been set up; it \
|
37
|
+
will not destroy any deployed revisions or data.
|
38
|
+
DESC
|
39
|
+
task :setup, :except => { :no_release => true } do
|
40
|
+
dirs = [deploy_to, releases_path, shared_path].join(' ')
|
41
|
+
run "#{try_sudo} mkdir -p #{releases_path} #{shared_path}"
|
42
|
+
run "#{try_sudo} chown -R #{user}:#{runner_group} #{deploy_to}"
|
43
|
+
sub_dirs = shared_children.map { |d| File.join(shared_path, d) }
|
44
|
+
run "#{try_sudo} mkdir -p #{sub_dirs.join(' ')}"
|
45
|
+
run "#{try_sudo} chmod 2775 #{sub_dirs.join(' ')}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
namespace :drupal do
|
50
|
+
|
51
|
+
desc "Symlink settings and files to shared directory. This allows the settings.php and \
|
52
|
+
and sites/default/files directory to be correctly linked to the shared directory on a new deployment."
|
53
|
+
task :symlink_shared do
|
54
|
+
["files", "private", "settings.php"].each do |asset|
|
55
|
+
run "rm -rf #{app_path}/sites/default/#{asset} && ln -nfs #{shared_path}/#{asset} #{app_path}/sites/default/#{asset}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
namespace :git do
|
62
|
+
|
63
|
+
desc "Place release tag into Git and push it to origin server."
|
64
|
+
task :push_deploy_tag do
|
65
|
+
user = `git config --get user.name`
|
66
|
+
email = `git config --get user.email`
|
67
|
+
tag = "release_#{release_name}"
|
68
|
+
if exists?(:stage)
|
69
|
+
tag = "#{stage}_#{tag}"
|
70
|
+
end
|
71
|
+
puts `git tag #{tag} #{revision} -m "Deployed by #{user} <#{email}>"`
|
72
|
+
puts `git push origin tag #{tag}`
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
namespace :drush do
|
78
|
+
|
79
|
+
desc "Set the site offline"
|
80
|
+
task :site_offline, :on_error => :continue do
|
81
|
+
run "drupal --root=#{app_path} site:maintenance on"
|
82
|
+
end
|
83
|
+
|
84
|
+
desc "Set the site online"
|
85
|
+
task :site_online, :on_error => :continue do
|
86
|
+
run "drupal --root=#{app_path} site:maintenance off"
|
87
|
+
end
|
88
|
+
|
89
|
+
desc "Run Drupal database migrations if required"
|
90
|
+
task :updatedb, :on_error => :continue do
|
91
|
+
run "#{drush_cmd} -r #{app_path} updatedb -y"
|
92
|
+
end
|
93
|
+
|
94
|
+
desc "Rebuild the drupal cache"
|
95
|
+
task :cache_rebuild, :on_error => :continue do
|
96
|
+
run "#{drush_cmd} -r #{app_path} cr"
|
97
|
+
end
|
98
|
+
|
99
|
+
desc "Revert all features"
|
100
|
+
task :features_revert_all, :on_error => :continue do
|
101
|
+
run "#{drush_cmd} -r #{app_path} fr-all -y"
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
namespace :drupal_console do
|
107
|
+
|
108
|
+
desc "Set the site offline"
|
109
|
+
task :site_offline, :on_error => :continue do
|
110
|
+
run "drupal --root=#{app_path} site:maintenance on"
|
111
|
+
end
|
112
|
+
|
113
|
+
desc "Set the site online"
|
114
|
+
task :site_online, :on_error => :continue do
|
115
|
+
run "drupal --root=#{app_path} site:maintenance off"
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cap-drupal8
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Adam Long
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A set of tasks for deploying Drupal8 projects with Capistrano
|
15
|
+
email: adam.michael.long@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- cap-drupal8.gemspec
|
21
|
+
- lib/cap-drupal8.rb
|
22
|
+
homepage: https://github.com/AdamMichaelLong/cap-drupal8/
|
23
|
+
licenses: []
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 1.8.23
|
43
|
+
signing_key:
|
44
|
+
specification_version: 3
|
45
|
+
summary: A set of tasks for deploying Drupal8 projects with Capistrano
|
46
|
+
test_files: []
|