drupistrano 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +14 -0
- data/Rakefile +2 -0
- data/drupistrano.gemspec +23 -0
- data/lib/drupistrano/version.rb +3 -0
- data/lib/drupistrano.rb +56 -0
- metadata +89 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Drupal Deployment Recipe
|
2
|
+
* Requirements
|
3
|
+
* You need drush installed on your project
|
4
|
+
* Current Features:
|
5
|
+
* Revert all features
|
6
|
+
* Backup database prior to deploy
|
7
|
+
* Handle sites/default/files across releases
|
8
|
+
* Clear cache
|
9
|
+
* Database updates
|
10
|
+
|
11
|
+
## Configuration Variables
|
12
|
+
|
13
|
+
* site_uri: Uri of the site as in sites/all/. Eg. example.com. Default Value: default
|
14
|
+
* drush_path: Drush Command to use. Eg. "/opt/bin/drush". Default Value: drush
|
data/Rakefile
ADDED
data/drupistrano.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "drupistrano/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "drupistrano"
|
7
|
+
s.version = Drupistrano::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Jorge Dias"]
|
10
|
+
s.email = ["jorge@mrdias.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Deployment Recipe for Drupal}
|
13
|
+
s.description = %q{A Recipe to easily deploy Drupal Applications}
|
14
|
+
|
15
|
+
s.rubyforge_project = "drupistrano"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency(%q<capistrano>, [">= 1.0.0"])
|
23
|
+
end
|
data/lib/drupistrano.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
2
|
+
abort "capistrano/ext/multistage requires Capistrano 2"
|
3
|
+
end
|
4
|
+
|
5
|
+
Capistrano::Configuration.instance.load do
|
6
|
+
# Drupal Customizations
|
7
|
+
_cset(:normalize_asset_timestamps) { false }
|
8
|
+
_cset(:site_uri) { "default" }
|
9
|
+
_cset(:drush_path) { "drush" }
|
10
|
+
_cset(:drush_cmd) { "#{drush_path} --uri=#{site_uri}" }
|
11
|
+
|
12
|
+
namespace :deploy do
|
13
|
+
task :start do ; end
|
14
|
+
task :stop do ; end
|
15
|
+
task :restart do ; end
|
16
|
+
|
17
|
+
desc "Backup the DB before this update"
|
18
|
+
task :backup_db, :roles => :db do
|
19
|
+
run "cd #{previous_release} && #{drush_cmd} sql-dump > dump.sql"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Move default drupal files if they exist and symlink to shared path"
|
23
|
+
task :move_default_files, :roles => :app do
|
24
|
+
run <<-CMD
|
25
|
+
if [ -d #{release_path}/sites/default/files ]; then \
|
26
|
+
cd #{release_path}/sites/default && \
|
27
|
+
rsync -avz files/ #{shared_path}/files && \
|
28
|
+
rm -rf files; \
|
29
|
+
fi; \
|
30
|
+
ln -nsf #{shared_path}/files .
|
31
|
+
CMD
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Revert all features"
|
35
|
+
task :revert_features, :roles => :db do
|
36
|
+
run "cd #{current_path} && #{drush_cmd} -y features-revert-all"
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Clear all cache"
|
40
|
+
task :clear_cache, :roles => :app do
|
41
|
+
run "cd #{current_path} && #{drush_cmd} cache-clear all"
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Execute database updates"
|
45
|
+
task :migrate, :roles => :db do
|
46
|
+
run "cd #{current_path} && #{drush_cmd} -y updatedb"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Hooks
|
51
|
+
after "deploy:update_code", "deploy:backup_db"
|
52
|
+
|
53
|
+
before "deploy:symlink", "deploy:move_default_files"
|
54
|
+
before "deploy:symlink", "deploy:revert_features"
|
55
|
+
before "deploy:symlink", "deploy:clear_cache"
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: drupistrano
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jorge Dias
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-07 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: capistrano
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 1.0.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: A Recipe to easily deploy Drupal Applications
|
38
|
+
email:
|
39
|
+
- jorge@mrdias.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- Gemfile
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- drupistrano.gemspec
|
52
|
+
- lib/drupistrano.rb
|
53
|
+
- lib/drupistrano/version.rb
|
54
|
+
has_rdoc: true
|
55
|
+
homepage: ""
|
56
|
+
licenses: []
|
57
|
+
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
81
|
+
requirements: []
|
82
|
+
|
83
|
+
rubyforge_project: drupistrano
|
84
|
+
rubygems_version: 1.5.0
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: Deployment Recipe for Drupal
|
88
|
+
test_files: []
|
89
|
+
|