forkcms_deploy 1.2.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/forkcms_deploy-2.0.0.gem +0 -0
- data/forkcms_deploy.gemspec +13 -7
- data/lib/forkcms_deploy/defaults.rb +23 -13
- data/lib/forkcms_deploy/forkcms.rb +10 -101
- data/lib/forkcms_deploy/forkcms_2.rb +104 -0
- data/lib/forkcms_deploy/forkcms_3.5.rb +27 -0
- data/lib/forkcms_deploy/forkcms_3.rb +104 -0
- data/lib/forkcms_deploy/forkcms_default.rb +59 -0
- data/lib/forkcms_deploy.rb +9 -1
- data/test/test_forkcms_deploy.rb +12 -0
- metadata +14 -7
data/Rakefile
CHANGED
@@ -2,11 +2,11 @@ begin
|
|
2
2
|
require 'jeweler'
|
3
3
|
Jeweler::Tasks.new do |gemspec|
|
4
4
|
gemspec.name = "forkcms_deploy"
|
5
|
-
gemspec.summary = "Deployment for
|
6
|
-
gemspec.description = "Deployment for
|
5
|
+
gemspec.summary = "Deployment for ForkCMS with Capistrano"
|
6
|
+
gemspec.description = "Deployment for ForkCMS with Capistrano"
|
7
7
|
gemspec.email = "info@sumocoders.be"
|
8
8
|
gemspec.homepage = "https://github.com/sumocoders/forkcms_deploy"
|
9
|
-
gemspec.authors = ['Tijs Verkoyen', 'Jan De Poorter']
|
9
|
+
gemspec.authors = ['Tijs Verkoyen', 'Jan De Poorter', 'Sam Tubbax']
|
10
10
|
gemspec.add_dependency 'capistrano', '>=2.0.0'
|
11
11
|
end
|
12
12
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.1.0
|
Binary file
|
data/forkcms_deploy.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "forkcms_deploy"
|
8
|
-
s.version = "
|
8
|
+
s.version = "2.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Tijs Verkoyen", "Jan De Poorter"]
|
12
|
-
s.date = "
|
13
|
-
s.description = "Deployment for
|
11
|
+
s.authors = ["Tijs Verkoyen", "Jan De Poorter", "Sam Tubbax"]
|
12
|
+
s.date = "2012-10-16"
|
13
|
+
s.description = "Deployment for ForkCMS with Capistrano"
|
14
14
|
s.email = "info@sumocoders.be"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.md"
|
@@ -19,16 +19,22 @@ Gem::Specification.new do |s|
|
|
19
19
|
"README.md",
|
20
20
|
"Rakefile",
|
21
21
|
"VERSION",
|
22
|
+
"forkcms_deploy-2.0.0.gem",
|
22
23
|
"forkcms_deploy.gemspec",
|
23
24
|
"lib/forkcms_deploy.rb",
|
24
25
|
"lib/forkcms_deploy/defaults.rb",
|
25
26
|
"lib/forkcms_deploy/forkcms.rb",
|
26
|
-
"lib/forkcms_deploy/
|
27
|
+
"lib/forkcms_deploy/forkcms_2.rb",
|
28
|
+
"lib/forkcms_deploy/forkcms_3.5.rb",
|
29
|
+
"lib/forkcms_deploy/forkcms_3.rb",
|
30
|
+
"lib/forkcms_deploy/forkcms_default.rb",
|
31
|
+
"lib/forkcms_deploy/overwrites.rb",
|
32
|
+
"test/test_forkcms_deploy.rb"
|
27
33
|
]
|
28
34
|
s.homepage = "https://github.com/sumocoders/forkcms_deploy"
|
29
35
|
s.require_paths = ["lib"]
|
30
|
-
s.rubygems_version = "1.8.
|
31
|
-
s.summary = "Deployment for
|
36
|
+
s.rubygems_version = "1.8.24"
|
37
|
+
s.summary = "Deployment for ForkCMS with Capistrano"
|
32
38
|
|
33
39
|
if s.respond_to? :specification_version then
|
34
40
|
s.specification_version = 3
|
@@ -1,22 +1,32 @@
|
|
1
1
|
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
2
2
|
|
3
3
|
configuration.load do
|
4
|
-
|
5
|
-
|
4
|
+
def _cset(name, *args, &block)
|
5
|
+
unless exists?(name)
|
6
|
+
set(name, *args, &block)
|
7
|
+
end
|
8
|
+
end
|
6
9
|
|
7
|
-
|
8
|
-
|
10
|
+
# don't use sudo, on most shared setups we won't have sudo-access
|
11
|
+
_cset(:use_sudo) { false }
|
9
12
|
|
10
|
-
|
11
|
-
|
13
|
+
# we're on a share setup so group_writable isn't allowed
|
14
|
+
_cset(:group_writable) { false }
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
set :deploy_via, :remote_cache
|
16
|
+
# 3 releases should be enough.
|
17
|
+
_cset(:keep_releases) { 3 }
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
# remote caching will keep a local git repo on the server you're deploying to and simply run a fetch from that
|
20
|
+
# rather than an entire clone. This is probably the best option and will only fetch the differences each deploy
|
21
|
+
_cset(:deploy_via) { remote_cache }
|
19
22
|
|
20
|
-
|
21
|
-
|
23
|
+
# set the value for pseudo terminals in Capistrano
|
24
|
+
default_run_options[:pty] = true
|
25
|
+
|
26
|
+
# your computer must be running ssh-agent for the git checkout to work from the server to the git server
|
27
|
+
set :ssh_options, { :forward_agent => true }
|
28
|
+
|
29
|
+
# set version control type and copy strategy
|
30
|
+
set :scm, :git
|
31
|
+
set :copy_strategy, :checkout
|
22
32
|
end
|
@@ -1,104 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
forkcms.link_document_root
|
10
|
-
end
|
11
|
-
|
12
|
-
after 'deploy:update_code' do
|
13
|
-
forkcms.link_configs
|
14
|
-
forkcms.link_files
|
15
|
-
end
|
16
|
-
|
17
|
-
# Fork CMS specific tasks
|
18
|
-
namespace :forkcms do
|
19
|
-
desc 'Clear the frontend and backend cache-folders'
|
20
|
-
task :clear_cached do
|
21
|
-
# remove frontend cached data
|
22
|
-
run %{
|
23
|
-
rm -rf #{current_path}/default_www/frontend/cache/cached_templates/* &&
|
24
|
-
rm -rf #{current_path}/default_www/frontend/cache/locale/* &&
|
25
|
-
rm -rf #{current_path}/default_www/frontend/cache/minified_css/* &&
|
26
|
-
rm -rf #{current_path}/default_www/frontend/cache/minified_js/* &&
|
27
|
-
rm -rf #{current_path}/default_www/frontend/cache/navigation/* &&
|
28
|
-
rm -rf #{current_path}/default_www/frontend/cache/statistics/* &&
|
29
|
-
rm -rf #{current_path}/default_www/frontend/cache/templates/*
|
30
|
-
}
|
31
|
-
|
32
|
-
# remove backend cached data
|
33
|
-
run %{
|
34
|
-
rm -rf #{current_path}/default_www/backend/cache/analytics/* &&
|
35
|
-
rm -rf #{current_path}/default_www/backend/cache/cronjobs/* &&
|
36
|
-
rm -rf #{current_path}/default_www/backend/cache/locale/* &&
|
37
|
-
rm -rf #{current_path}/default_www/backend/cache/mailmotor/* &&
|
38
|
-
rm -rf #{current_path}/default_www/backend/cache/templates/*
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
desc 'Link the config files'
|
43
|
-
task :link_configs do
|
44
|
-
# create config files
|
45
|
-
path_library = <<-CONFIG
|
46
|
-
<?php
|
47
|
-
// custom constant used by the init classes
|
48
|
-
define('INIT_PATH_LIBRARY', '#{current_path}/library');
|
49
|
-
?>
|
50
|
-
CONFIG
|
51
|
-
|
52
|
-
# upload the files
|
53
|
-
put path_library, "#{shared_path}/config/frontend/config.php"
|
54
|
-
put path_library, "#{shared_path}/config/backend/config.php"
|
55
|
-
|
56
|
-
# change the path to current_path
|
57
|
-
run "if [ -f #{shared_path}/config/library/globals.php ]; then sed -i 's/#{version_dir}\\/[0-9]*/#{current_dir}/' #{shared_path}/config/library/globals.php; fi"
|
58
|
-
|
59
|
-
# create dirs
|
60
|
-
run %{
|
61
|
-
mkdir -p #{release_path}/default_www/frontend/cache/config &&
|
62
|
-
mkdir -p #{release_path}/default_www/backend/cache/config
|
63
|
-
}
|
64
|
-
|
65
|
-
# symlink the globals
|
66
|
-
run %{
|
67
|
-
ln -sf #{shared_path}/config/library/globals_backend.php #{release_path}/library/globals_backend.php &&
|
68
|
-
ln -sf #{shared_path}/config/library/globals_frontend.php #{release_path}/library/globals_frontend.php &&
|
69
|
-
ln -sf #{shared_path}/config/library/globals.php #{release_path}/library/globals.php &&
|
70
|
-
ln -sf #{shared_path}/config/frontend/config.php #{release_path}/default_www/frontend/cache/config/config.php &&
|
71
|
-
ln -sf #{shared_path}/config/backend/config.php #{release_path}/default_www/backend/cache/config/config.php
|
72
|
-
}
|
73
|
-
end
|
74
|
-
|
75
|
-
desc 'link the document root to the current/default_www-folder'
|
76
|
-
task :link_document_root do
|
77
|
-
# create symlink for document_root if it doesn't exists
|
78
|
-
documentRootExists = capture("if [ ! -e #{document_root} ]; then ln -sf #{current_path}/default_www #{document_root}; echo 'no'; fi").chomp
|
79
|
-
|
80
|
-
unless documentRootExists == 'no'
|
81
|
-
warn "Warning: Document root (#{document_root}) already exists"
|
82
|
-
warn 'to link it to the Fork deploy issue the following command:'
|
83
|
-
warn ' ln -sf #{current_path}/default_www #{document_root}'
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
desc 'Create needed symlinks'
|
88
|
-
task :link_files do
|
89
|
-
# get the list of folders in /frontend/files
|
90
|
-
folders = capture("ls -1 #{release_path}/default_www/frontend/files").split(/\r?\n/)
|
91
|
-
|
92
|
-
# loop the folders
|
93
|
-
folders.each do |folder|
|
94
|
-
# copy them to the shared path, remove them from the release and symlink them
|
95
|
-
run %{
|
96
|
-
mkdir -p #{shared_path}/files/#{folder} &&
|
97
|
-
cp -r #{release_path}/default_www/frontend/files/#{folder} #{shared_path}/files/ &&
|
98
|
-
rm -rf #{release_path}/default_www/frontend/files/#{folder} &&
|
99
|
-
ln -s #{shared_path}/files/#{folder} #{release_path}/default_www/frontend/files/#{folder}
|
100
|
-
}
|
1
|
+
module ForkCMSDeploy
|
2
|
+
class ForkCMS
|
3
|
+
def self.determine_version_to_use(version)
|
4
|
+
until version.empty?
|
5
|
+
if File.exists?(File.dirname(__FILE__) + "/../forkcms_deploy/forkcms_#{version}.rb")
|
6
|
+
return version
|
7
|
+
end
|
8
|
+
version = version.sub(/\.?[^\.]+$/, '')
|
101
9
|
end
|
102
|
-
|
10
|
+
return "default"
|
11
|
+
end
|
103
12
|
end
|
104
13
|
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
2
|
+
|
3
|
+
configuration.load do
|
4
|
+
# define some extra folder to create
|
5
|
+
set :shared_children, %w(files config/frontend config/backend config/library)
|
6
|
+
|
7
|
+
# custom events configuration
|
8
|
+
after 'deploy:setup' do
|
9
|
+
forkcms.link_document_root
|
10
|
+
end
|
11
|
+
|
12
|
+
after 'deploy:update_code' do
|
13
|
+
forkcms.link_configs
|
14
|
+
forkcms.link_files
|
15
|
+
end
|
16
|
+
|
17
|
+
# Fork CMS specific tasks
|
18
|
+
namespace :forkcms do
|
19
|
+
desc 'Clear the frontend and backend cache-folders'
|
20
|
+
task :clear_cached do
|
21
|
+
# remove frontend cached data
|
22
|
+
run %{
|
23
|
+
rm -rf #{current_path}/default_www/frontend/cache/cached_templates/* &&
|
24
|
+
rm -rf #{current_path}/default_www/frontend/cache/locale/* &&
|
25
|
+
rm -rf #{current_path}/default_www/frontend/cache/minified_css/* &&
|
26
|
+
rm -rf #{current_path}/default_www/frontend/cache/minified_js/* &&
|
27
|
+
rm -rf #{current_path}/default_www/frontend/cache/navigation/* &&
|
28
|
+
rm -rf #{current_path}/default_www/frontend/cache/statistics/* &&
|
29
|
+
rm -rf #{current_path}/default_www/frontend/cache/templates/*
|
30
|
+
}
|
31
|
+
|
32
|
+
# remove backend cached data
|
33
|
+
run %{
|
34
|
+
rm -rf #{current_path}/default_www/backend/cache/analytics/* &&
|
35
|
+
rm -rf #{current_path}/default_www/backend/cache/cronjobs/* &&
|
36
|
+
rm -rf #{current_path}/default_www/backend/cache/locale/* &&
|
37
|
+
rm -rf #{current_path}/default_www/backend/cache/mailmotor/* &&
|
38
|
+
rm -rf #{current_path}/default_www/backend/cache/templates/*
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'Link the config files'
|
43
|
+
task :link_configs do
|
44
|
+
# create config files
|
45
|
+
path_library = <<-CONFIG
|
46
|
+
<?php
|
47
|
+
// custom constant used by the init classes
|
48
|
+
define('INIT_PATH_LIBRARY', '#{current_path}/library');
|
49
|
+
?>
|
50
|
+
CONFIG
|
51
|
+
|
52
|
+
# upload the files
|
53
|
+
put path_library, "#{shared_path}/config/frontend/config.php"
|
54
|
+
put path_library, "#{shared_path}/config/backend/config.php"
|
55
|
+
|
56
|
+
# change the path to current_path
|
57
|
+
run "if [ -f #{shared_path}/config/library/globals.php ]; then sed -i 's/#{version_dir}\\/[0-9]*/#{current_dir}/' #{shared_path}/config/library/globals.php; fi"
|
58
|
+
|
59
|
+
# create dirs
|
60
|
+
run %{
|
61
|
+
mkdir -p #{release_path}/default_www/frontend/cache/config &&
|
62
|
+
mkdir -p #{release_path}/default_www/backend/cache/config
|
63
|
+
}
|
64
|
+
|
65
|
+
# symlink the globals
|
66
|
+
run %{
|
67
|
+
ln -sf #{shared_path}/config/library/globals_backend.php #{release_path}/library/globals_backend.php &&
|
68
|
+
ln -sf #{shared_path}/config/library/globals_frontend.php #{release_path}/library/globals_frontend.php &&
|
69
|
+
ln -sf #{shared_path}/config/library/globals.php #{release_path}/library/globals.php &&
|
70
|
+
ln -sf #{shared_path}/config/frontend/config.php #{release_path}/default_www/frontend/cache/config/config.php &&
|
71
|
+
ln -sf #{shared_path}/config/backend/config.php #{release_path}/default_www/backend/cache/config/config.php
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
desc 'link the document root to the current/default_www-folder'
|
76
|
+
task :link_document_root do
|
77
|
+
# create symlink for document_root if it doesn't exists
|
78
|
+
documentRootExists = capture("if [ ! -e #{document_root} ]; then ln -sf #{current_path}/default_www #{document_root}; echo 'no'; fi").chomp
|
79
|
+
|
80
|
+
unless documentRootExists == 'no'
|
81
|
+
warn "Warning: Document root (#{document_root}) already exists"
|
82
|
+
warn 'to link it to the Fork deploy issue the following command:'
|
83
|
+
warn ' ln -sf #{current_path}/default_www #{document_root}'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
desc 'Create needed symlinks'
|
88
|
+
task :link_files do
|
89
|
+
# get the list of folders in /frontend/files
|
90
|
+
folders = capture("ls -1 #{release_path}/default_www/frontend/files").split(/\r?\n/)
|
91
|
+
|
92
|
+
# loop the folders
|
93
|
+
folders.each do |folder|
|
94
|
+
# copy them to the shared path, remove them from the release and symlink them
|
95
|
+
run %{
|
96
|
+
mkdir -p #{shared_path}/files/#{folder} &&
|
97
|
+
cp -r #{release_path}/default_www/frontend/files/#{folder} #{shared_path}/files/ &&
|
98
|
+
rm -rf #{release_path}/default_www/frontend/files/#{folder} &&
|
99
|
+
ln -s #{shared_path}/files/#{folder} #{release_path}/default_www/frontend/files/#{folder}
|
100
|
+
}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "forkcms_deploy/forkcms_3"
|
2
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
3
|
+
|
4
|
+
configuration.load do
|
5
|
+
after 'deploy:update_code' do
|
6
|
+
composer.install_vendors
|
7
|
+
end
|
8
|
+
|
9
|
+
# composer specific tasks
|
10
|
+
namespace :composer do
|
11
|
+
desc 'Install the vendors'
|
12
|
+
task :install_vendors do
|
13
|
+
composer.install_composer
|
14
|
+
run %{
|
15
|
+
cd #{latest_release} &&
|
16
|
+
php -d 'suhosin.executor.include.whitelist = phar' -d 'date.timezone = UTC' #{shared_path}/composer.phar install
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Install composer'
|
21
|
+
task :install_composer do
|
22
|
+
run %{
|
23
|
+
if [ ! -e #{shared_path}/composer.phar ]; then cd #{shared_path}; curl -s https://getcomposer.org/installer | php -d 'suhosin.executor.include.whitelist = phar' -d 'date.timezone = UTC'; fi
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
2
|
+
|
3
|
+
configuration.load do
|
4
|
+
# define some extra folder to create
|
5
|
+
set :shared_children, %w(files config/frontend config/backend config/library)
|
6
|
+
|
7
|
+
# custom events configuration
|
8
|
+
after 'deploy:setup' do
|
9
|
+
forkcms.link_document_root
|
10
|
+
end
|
11
|
+
|
12
|
+
after 'deploy:update_code' do
|
13
|
+
forkcms.link_configs
|
14
|
+
forkcms.link_files
|
15
|
+
end
|
16
|
+
|
17
|
+
# Fork CMS specific tasks
|
18
|
+
namespace :forkcms do
|
19
|
+
desc 'Clear the frontend and backend cache-folders'
|
20
|
+
task :clear_cached do
|
21
|
+
# remove frontend cached data
|
22
|
+
run %{
|
23
|
+
rm -rf #{current_path}/frontend/cache/cached_templates/* &&
|
24
|
+
rm -rf #{current_path}/frontend/cache/locale/* &&
|
25
|
+
rm -rf #{current_path}/frontend/cache/minified_css/* &&
|
26
|
+
rm -rf #{current_path}/frontend/cache/minified_js/* &&
|
27
|
+
rm -rf #{current_path}/frontend/cache/navigation/* &&
|
28
|
+
rm -rf #{current_path}/frontend/cache/statistics/* &&
|
29
|
+
rm -rf #{current_path}/frontend/cache/templates/*
|
30
|
+
}
|
31
|
+
|
32
|
+
# remove backend cached data
|
33
|
+
run %{
|
34
|
+
rm -rf #{current_path}/backend/cache/analytics/* &&
|
35
|
+
rm -rf #{current_path}/backend/cache/cronjobs/* &&
|
36
|
+
rm -rf #{current_path}/backend/cache/locale/* &&
|
37
|
+
rm -rf #{current_path}/backend/cache/mailmotor/* &&
|
38
|
+
rm -rf #{current_path}/backend/cache/templates/*
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'Link the config files'
|
43
|
+
task :link_configs do
|
44
|
+
# create config files
|
45
|
+
path_library = <<-CONFIG
|
46
|
+
<?php
|
47
|
+
// custom constant used by the init classes
|
48
|
+
define('INIT_PATH_LIBRARY', '#{current_path}/library');
|
49
|
+
?>
|
50
|
+
CONFIG
|
51
|
+
|
52
|
+
# upload the files
|
53
|
+
put path_library, "#{shared_path}/config/frontend/config.php"
|
54
|
+
put path_library, "#{shared_path}/config/backend/config.php"
|
55
|
+
|
56
|
+
# change the path to current_path
|
57
|
+
run "if [ -f #{shared_path}/config/library/globals.php ]; then sed -i 's/#{version_dir}\\/[0-9]*/#{current_dir}/' #{shared_path}/config/library/globals.php; fi"
|
58
|
+
|
59
|
+
# create dirs
|
60
|
+
run %{
|
61
|
+
mkdir -p #{release_path}/frontend/cache/config &&
|
62
|
+
mkdir -p #{release_path}/backend/cache/config
|
63
|
+
}
|
64
|
+
|
65
|
+
# symlink the globals
|
66
|
+
run %{
|
67
|
+
ln -sf #{shared_path}/config/library/globals_backend.php #{release_path}/library/globals_backend.php &&
|
68
|
+
ln -sf #{shared_path}/config/library/globals_frontend.php #{release_path}/library/globals_frontend.php &&
|
69
|
+
ln -sf #{shared_path}/config/library/globals.php #{release_path}/library/globals.php &&
|
70
|
+
ln -sf #{shared_path}/config/frontend/config.php #{release_path}/frontend/cache/config/config.php &&
|
71
|
+
ln -sf #{shared_path}/config/backend/config.php #{release_path}/backend/cache/config/config.php
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
desc 'link the document root to the current/default_www-folder'
|
76
|
+
task :link_document_root do
|
77
|
+
# create symlink for document_root if it doesn't exists
|
78
|
+
documentRootExists = capture("if [ ! -e #{document_root} ]; then ln -sf #{current_path} #{document_root}; echo 'no'; fi").chomp
|
79
|
+
|
80
|
+
unless documentRootExists == 'no'
|
81
|
+
warn "Warning: Document root (#{document_root}) already exists"
|
82
|
+
warn 'to link it to the Fork deploy issue the following command:'
|
83
|
+
warn ' ln -sf #{current_path} #{document_root}'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
desc 'Create needed symlinks'
|
88
|
+
task :link_files do
|
89
|
+
# get the list of folders in /frontend/files
|
90
|
+
folders = capture("ls -1 #{release_path}/frontend/files").split(/\r?\n/)
|
91
|
+
|
92
|
+
# loop the folders
|
93
|
+
folders.each do |folder|
|
94
|
+
# copy them to the shared path, remove them from the release and symlink them
|
95
|
+
run %{
|
96
|
+
mkdir -p #{shared_path}/files/#{folder} &&
|
97
|
+
cp -r #{release_path}/frontend/files/#{folder} #{shared_path}/files/ &&
|
98
|
+
rm -rf #{release_path}/frontend/files/#{folder} &&
|
99
|
+
ln -s #{shared_path}/files/#{folder} #{release_path}/frontend/files/#{folder}
|
100
|
+
}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
2
|
+
|
3
|
+
configuration.load do
|
4
|
+
# define some extra folder to create
|
5
|
+
set :shared_children, %w(files config/frontend config/backend config/library)
|
6
|
+
|
7
|
+
# custom events configuration
|
8
|
+
after 'deploy:setup' do
|
9
|
+
forkcms.link_document_root
|
10
|
+
end
|
11
|
+
|
12
|
+
after 'deploy:update_code' do
|
13
|
+
forkcms.link_configs
|
14
|
+
forkcms.link_files
|
15
|
+
end
|
16
|
+
|
17
|
+
# Fork CMS specific tasks
|
18
|
+
namespace :forkcms do
|
19
|
+
desc 'Link the config files'
|
20
|
+
task :link_configs do
|
21
|
+
|
22
|
+
# change the path to current_path
|
23
|
+
run "if [ -f #{shared_path}/config/library/globals.php ]; then sed -i 's/#{version_dir}\\/[0-9]*/#{current_dir}/' #{shared_path}/config/library/globals.php; fi"
|
24
|
+
|
25
|
+
# symlink the globals
|
26
|
+
run %{
|
27
|
+
ln -sf #{shared_path}/config/library/globals.php #{release_path}/library/globals.php
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'link the document root to the current/default_www-folder'
|
32
|
+
task :link_document_root do
|
33
|
+
# create symlink for document_root if it doesn't exists
|
34
|
+
documentRootExists = capture("if [ ! -e #{document_root} ]; then ln -sf #{current_path}/default_www #{document_root}; echo 'no'; fi").chomp
|
35
|
+
|
36
|
+
unless documentRootExists == 'no'
|
37
|
+
warn "Warning: Document root (#{document_root}) already exists"
|
38
|
+
warn "to link it to the Fork deploy issue the following command:"
|
39
|
+
warn " ln -sf #{current_path}/default_www #{document_root}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
desc 'Create needed symlinks'
|
44
|
+
task :link_files do
|
45
|
+
# get the list of folders in /frontend/files
|
46
|
+
folders = capture("ls -1 #{release_path}/default_www/userfiles").split(/\r?\n/)
|
47
|
+
|
48
|
+
# loop the folders
|
49
|
+
folders.each do |folder|
|
50
|
+
# copy them to the shared path, remove them from the release and symlink them
|
51
|
+
run %{
|
52
|
+
cp -r #{release_path}/default_www/userfiles/#{folder} #{shared_path}/files/#{folder} &&
|
53
|
+
rm -rf #{release_path}/default_www/userfiles/#{folder} &&
|
54
|
+
ln -s #{shared_path}/files/#{folder} #{release_path}/default_www/userfiles/#{folder}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/forkcms_deploy.rb
CHANGED
@@ -1,2 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "forkcms_deploy/forkcms.rb"
|
2
|
+
begin
|
3
|
+
version = ForkCMSDeploy::ForkCMS.determine_version_to_use(File.read("VERSION.md"))
|
4
|
+
require "forkcms_deploy/forkcms_#{version}"
|
5
|
+
rescue SystemCallError
|
6
|
+
$stderr.puts "No VERSION file found, Are you sure you're in a FORK project?"
|
7
|
+
exit 1
|
8
|
+
end
|
9
|
+
|
2
10
|
require 'forkcms_deploy/overwrites'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'forkcms_deploy/forkcms.rb'
|
3
|
+
|
4
|
+
class TestForkCMS < Test::Unit::TestCase
|
5
|
+
def test_versions
|
6
|
+
assert_equal "3", ForkCMSDeploy::ForkCMS.determine_version_to_use("3.4") # 3
|
7
|
+
assert_equal "3", ForkCMSDeploy::ForkCMS.determine_version_to_use("3") # 3
|
8
|
+
assert_equal "2", ForkCMSDeploy::ForkCMS.determine_version_to_use("2") # 2
|
9
|
+
assert_equal "default", ForkCMSDeploy::ForkCMS.determine_version_to_use("1") # default
|
10
|
+
assert_equal "default", ForkCMSDeploy::ForkCMS.determine_version_to_use("1.2.3") # default
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forkcms_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
-
- 1
|
8
7
|
- 2
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tijs Verkoyen
|
14
14
|
- Jan De Poorter
|
15
|
+
- Sam Tubbax
|
15
16
|
autorequire:
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date:
|
20
|
+
date: 2012-10-16 00:00:00 Z
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: capistrano
|
@@ -34,7 +35,7 @@ dependencies:
|
|
34
35
|
version: 2.0.0
|
35
36
|
type: :runtime
|
36
37
|
version_requirements: *id001
|
37
|
-
description: Deployment for
|
38
|
+
description: Deployment for ForkCMS with Capistrano
|
38
39
|
email: info@sumocoders.be
|
39
40
|
executables: []
|
40
41
|
|
@@ -46,11 +47,17 @@ files:
|
|
46
47
|
- README.md
|
47
48
|
- Rakefile
|
48
49
|
- VERSION
|
50
|
+
- forkcms_deploy-2.0.0.gem
|
49
51
|
- forkcms_deploy.gemspec
|
50
52
|
- lib/forkcms_deploy.rb
|
51
53
|
- lib/forkcms_deploy/defaults.rb
|
52
54
|
- lib/forkcms_deploy/forkcms.rb
|
55
|
+
- lib/forkcms_deploy/forkcms_2.rb
|
56
|
+
- lib/forkcms_deploy/forkcms_3.5.rb
|
57
|
+
- lib/forkcms_deploy/forkcms_3.rb
|
58
|
+
- lib/forkcms_deploy/forkcms_default.rb
|
53
59
|
- lib/forkcms_deploy/overwrites.rb
|
60
|
+
- test/test_forkcms_deploy.rb
|
54
61
|
homepage: https://github.com/sumocoders/forkcms_deploy
|
55
62
|
licenses: []
|
56
63
|
|
@@ -80,9 +87,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
87
|
requirements: []
|
81
88
|
|
82
89
|
rubyforge_project:
|
83
|
-
rubygems_version: 1.8.
|
90
|
+
rubygems_version: 1.8.24
|
84
91
|
signing_key:
|
85
92
|
specification_version: 3
|
86
|
-
summary: Deployment for
|
93
|
+
summary: Deployment for ForkCMS with Capistrano
|
87
94
|
test_files: []
|
88
95
|
|