capistrano-exts 1.10.2 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,7 +18,7 @@ gem install capistrano-exts
18
18
  or add it to your Gemfile
19
19
 
20
20
  ```ruby
21
- gem 'capistrano-exts', '>=1.10.2', :require => false
21
+ gem 'capistrano-exts', '>=1.11.0', :require => false
22
22
  ```
23
23
 
24
24
  # Setup
@@ -77,6 +77,14 @@ set :shared_items, [
77
77
  'public/robots.txt',
78
78
  ]
79
79
 
80
+ # Here you can define where are the configurations files located, these files
81
+ # are not considered contents so they will not be synced from one
82
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
83
+ # between versions in the shared/config folder
84
+ # set :configuration_files, [
85
+ # 'public/system/config/localconfig.php',
86
+ # ]
87
+
80
88
  #
81
89
  #
82
90
  #############
@@ -77,6 +77,14 @@ set :shared_items, [
77
77
  'public/robots.txt',
78
78
  ]
79
79
 
80
+ # Here you can define where are the configurations files located, these files
81
+ # are not considered contents so they will not be synced from one
82
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
83
+ # between versions in the shared/config folder
84
+ # set :configuration_files, [
85
+ # 'public/system/config/localconfig.php',
86
+ # ]
87
+
80
88
  #
81
89
  #
82
90
  #############
@@ -77,6 +77,14 @@ set :shared_items, [
77
77
  'public/robots.txt',
78
78
  ]
79
79
 
80
+ # Here you can define where are the configurations files located, these files
81
+ # are not considered contents so they will not be synced from one
82
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
83
+ # between versions in the shared/config folder
84
+ # set :configuration_files, [
85
+ # 'public/system/config/localconfig.php',
86
+ # ]
87
+
80
88
  #
81
89
  #
82
90
  #############
@@ -78,8 +78,13 @@ set :rvm_ruby_string, "1.9.3"
78
78
  # 'public/robots.txt',
79
79
  # ]
80
80
 
81
- # Link config files
82
- set :configuration_files, ['database.yml']
81
+ # Here you can define where are the configurations files located, these files
82
+ # are not considered contents so they will not be synced from one
83
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
84
+ # between versions in the shared/config folder
85
+ set :configuration_files, [
86
+ 'config/database.yml',
87
+ ]
83
88
 
84
89
  #
85
90
  #
@@ -78,8 +78,13 @@ set :rvm_ruby_string, "1.9.3"
78
78
  # 'public/robots.txt',
79
79
  # ]
80
80
 
81
- # Link config files
82
- set :configuration_files, ['database.yml']
81
+ # Here you can define where are the configurations files located, these files
82
+ # are not considered contents so they will not be synced from one
83
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
84
+ # between versions in the shared/config folder
85
+ set :configuration_files, [
86
+ 'config/database.yml',
87
+ ]
83
88
 
84
89
  #
85
90
  #
@@ -78,8 +78,13 @@ set :rvm_ruby_string, "1.9.3"
78
78
  # 'public/robots.txt',
79
79
  # ]
80
80
 
81
- # Link config files
82
- set :configuration_files, ['database.yml']
81
+ # Here you can define where are the configurations files located, these files
82
+ # are not considered contents so they will not be synced from one
83
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
84
+ # between versions in the shared/config folder
85
+ set :configuration_files, [
86
+ 'config/database.yml',
87
+ ]
83
88
 
84
89
  #
85
90
  #
@@ -78,8 +78,13 @@ set :rvm_ruby_string, "1.9.3"
78
78
  # 'public/robots.txt',
79
79
  # ]
80
80
 
81
- # Link config files
82
- set :configuration_files, ['database.yml']
81
+ # Here you can define where are the configurations files located, these files
82
+ # are not considered contents so they will not be synced from one
83
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
84
+ # between versions in the shared/config folder
85
+ set :configuration_files, [
86
+ 'config/database.yml',
87
+ ]
83
88
 
84
89
  #
85
90
  #
@@ -78,8 +78,13 @@ set :rvm_ruby_string, "1.9.3"
78
78
  # 'public/robots.txt',
79
79
  # ]
80
80
 
81
- # Link config files
82
- set :configuration_files, ['database.yml']
81
+ # Here you can define where are the configurations files located, these files
82
+ # are not considered contents so they will not be synced from one
83
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
84
+ # between versions in the shared/config folder
85
+ set :configuration_files, [
86
+ 'config/database.yml',
87
+ ]
83
88
 
84
89
  #
85
90
  #
@@ -78,8 +78,13 @@ set :rvm_ruby_string, "1.9.3"
78
78
  # 'public/robots.txt',
79
79
  # ]
80
80
 
81
- # Link config files
82
- set :configuration_files, ['database.yml']
81
+ # Here you can define where are the configurations files located, these files
82
+ # are not considered contents so they will not be synced from one
83
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
84
+ # between versions in the shared/config folder
85
+ set :configuration_files, [
86
+ 'config/database.yml',
87
+ ]
83
88
 
84
89
  #
85
90
  #
@@ -38,8 +38,9 @@ Capistrano::Configuration.instance(:must_exist).load do
38
38
 
39
39
  desc "[internal] Setup contao's localconfig"
40
40
  task :setup_localconfig, :roles => :app, :except => { :no_release => true } do
41
- unless remote_file_exists?("#{fetch :shared_path}/config/localconfig.php")
42
- on_rollback { run "rm -f #{shared_path}/config/localconfig.php" }
41
+ localconfig_php_config_path = "#{fetch :shared_path}/config/system_config_localconfig.php"
42
+ unless remote_file_exists?(localconfig_php_config_path)
43
+ on_rollback { run "rm -f #{localconfig_php_config_path}" }
43
44
 
44
45
  localconfig = File.read("public/system/config/localconfig.php.sample")
45
46
  mysql_credentials = fetch :mysql_credentials
@@ -58,9 +59,9 @@ Capistrano::Configuration.instance(:must_exist).load do
58
59
  localconfig.gsub!(/#DB_NAME#/, mysql_db_name)
59
60
  end
60
61
 
61
- put localconfig, "#{fetch :shared_path}/config/localconfig.php"
62
+ put localconfig, localconfig_php_config_path
62
63
  else
63
- puts "WARNING: The file '#{fetch :shared_path}/config/localconfig.php' already exists, not overwriting."
64
+ puts "WARNING: The file '#{localconfig_php_config_path}' already exists, not overwriting."
64
65
  end
65
66
  end
66
67
 
@@ -71,13 +72,11 @@ Capistrano::Configuration.instance(:must_exist).load do
71
72
 
72
73
  # Remove files
73
74
  run <<-CMD
74
- #{try_sudo} rm -rf #{latest_release}/public/system/logs &&
75
- #{try_sudo} rm -f #{latest_release}/public/system/config/localconfig.php
75
+ #{try_sudo} rm -rf #{latest_release}/public/system/logs
76
76
  CMD
77
77
 
78
78
  # Create symlinks
79
79
  run <<-CMD
80
- #{try_sudo} ln -nsf #{shared_path}/config/localconfig.php #{latest_release}/public/system/config/localconfig.php &&
81
80
  #{try_sudo} ln -nsf #{shared_path}/logs #{latest_release}/public/system/logs
82
81
  CMD
83
82
  end
@@ -41,7 +41,7 @@ Capistrano::Configuration.instance(:must_exist).load do
41
41
  CMD
42
42
  end
43
43
 
44
- desc "[internal] Fix contao's symlinks to the shared path"
44
+ desc "[internal] Fix symlinks of the contents folders to the shared path"
45
45
  task :fix_links, :roles => :app, :except => { :no_release => true } do
46
46
  contents_folder = fetch :contents_folder
47
47
  current_path = fetch :current_path
@@ -1,6 +1,7 @@
1
1
  require 'capistrano'
2
2
  require 'capistrano/errors'
3
3
  require 'capistrano-exts/receipts/functions'
4
+ require 'capistrano-exts/receipts/files'
4
5
 
5
6
  # Verify that Capistrano is version 2
6
7
  unless Capistrano::Configuration.respond_to?(:instance)
@@ -73,39 +74,6 @@ Capistrano::Configuration.instance(:must_exist).load do
73
74
 
74
75
  puts "The public folders has been moved to the old folder"
75
76
  end
76
-
77
- desc "Shared items"
78
- task :shared_items, :roles => :app, :except => { :no_release => true } do
79
- if exists?(:shared_items)
80
- shared_items = fetch :shared_items
81
- shared_path = fetch :shared_path
82
- latest_release = fetch :latest_release
83
-
84
- shared_items.each do |f|
85
- file_name = f.gsub(/\//, '_')
86
- unless remote_file_exists?("#{shared_path}/items/#{file_name}")
87
- begin
88
- run <<-CMD
89
- #{try_sudo} cp #{latest_release}/#{f} #{shared_path}/items/#{file_name}
90
- CMD
91
- rescue Capistrano::CommandError
92
- run <<-CMD
93
- #{try_sudo} touch #{shared_path}/items/#{file_name}
94
- CMD
95
- puts "WARNING: You should edit #{shared_path}/items/#{file_name}"
96
- end
97
- end
98
-
99
- begin
100
- run <<-CMD
101
- #{try_sudo} ln -nsf #{shared_path}/items/#{file_name} #{latest_release}/#{f}
102
- CMD
103
- rescue Capistrano::CommandError
104
- abort "Unable to create a link for '#{shared_path}/items/#{file_name}' at '#{latest_release}/#{f}'"
105
- end
106
- end
107
- end
108
- end
109
77
  end
110
78
 
111
79
  # Dependencies
@@ -113,5 +81,4 @@ Capistrano::Configuration.instance(:must_exist).load do
113
81
  after "deploy:restart", "deploy:fix_permissions"
114
82
  after "deploy:setup", "deploy:folders"
115
83
  after "deploy:setup", "deploy:symlink_public_folders"
116
- after "deploy:finalize_update", "deploy:shared_items"
117
84
  end
@@ -0,0 +1,30 @@
1
+ require 'capistrano'
2
+ require 'capistrano/errors'
3
+ require 'capistrano-exts/receipts/functions'
4
+
5
+ # Verify that Capistrano is version 2
6
+ unless Capistrano::Configuration.respond_to?(:instance)
7
+ abort "This extension requires Capistrano 2"
8
+ end
9
+
10
+ Capistrano::Configuration.instance(:must_exist).load do
11
+ namespace :files do
12
+ desc "[internal] Shared items"
13
+ task :shared_items, :roles => :app, :except => { :no_release => true } do
14
+ if exists?(:shared_items)
15
+ link_files "#{fetch :shared_path}/items", fetch(:shared_items)
16
+ end
17
+ end
18
+
19
+ desc "[internal] Configuration files"
20
+ task :config_files, :roles => :app, :except => { :no_release => true } do
21
+ if exists?(:configuration_files)
22
+ link_files "#{fetch :shared_path}/config", fetch(:configuration_files)
23
+ end
24
+ end
25
+ end
26
+
27
+ # Dependencies
28
+ after "deploy:finalize_update", "files:shared_items"
29
+ after "deploy:finalize_update", "files:config_files"
30
+ end
@@ -15,14 +15,35 @@ Capistrano::Configuration.instance(:must_exist).load do
15
15
  end
16
16
 
17
17
  def link_file(source_file, destination_file)
18
+ p source_file
19
+ p destination_file
18
20
  if remote_file_exists?(source_file)
19
- run "#{try_sudo} ln -nsf #{source_file} #{destination_file}"
21
+ begin
22
+ run "#{try_sudo} ln -nsf #{source_file} #{destination_file}"
23
+ rescue Capistrano::CommandError
24
+ abort "Unable to create a link for '#{source_file}' at '#{destination_file}'"
25
+ end
20
26
  end
21
27
  end
22
28
 
23
- def link_config_file(config_file, config_path = nil)
24
- config_path ||= "#{File.join release_path, 'config'}"
25
- link_file("#{File.join shared_path, 'config', config_file}", "#{File.join config_path, config_file}")
29
+ def link_files(path, files = {})
30
+ files.each do |f|
31
+ file_name = f.dup.gsub(/\//, '_')
32
+ unless remote_file_exists?("#{path}/#{file_name}")
33
+ begin
34
+ run <<-CMD
35
+ #{try_sudo} cp -a #{latest_release}/#{f} #{path}/#{file_name}
36
+ CMD
37
+ rescue Capistrano::CommandError
38
+ run <<-CMD
39
+ #{try_sudo} touch #{path}/#{file_name}
40
+ CMD
41
+ puts "WARNING: You should edit '#{path}/#{file_name}' or re-create it as a folder if that's your intention."
42
+ end
43
+ end
44
+
45
+ link_file File.join(path, file_name), File.join(fetch(:latest_release), f)
46
+ end
26
47
  end
27
48
 
28
49
  def gen_pass( len = 8 )
@@ -1,5 +1,6 @@
1
1
  require 'capistrano'
2
2
  require 'capistrano-exts/receipts/deploy'
3
+ require 'capistrano-exts/receipts/files'
3
4
 
4
5
  # Verify that Capistrano is version 2
5
6
  unless Capistrano::Configuration.respond_to?(:instance)
@@ -75,8 +75,13 @@ set :rvm_ruby_string, "1.9.3"
75
75
  # 'public/robots.txt',
76
76
  # ]
77
77
 
78
- # Link config files
79
- # set :configuration_files, ['database.yml']
78
+ # Here you can define where are the configurations files located, these files
79
+ # are not considered contents so they will not be synced from one
80
+ # server to another with the tasks mulltistage:sync:* instead they will be kept
81
+ # between versions in the shared/config folder
82
+ # set :configuration_files, [
83
+ # 'config/database.yml',
84
+ # ]
80
85
 
81
86
  #
82
87
  #
@@ -2,8 +2,8 @@ module Capistrano
2
2
  module Extensions
3
3
  module Version #:nodoc:
4
4
  MAJOR = 1
5
- MINOR = 10
6
- TINY = 2
5
+ MINOR = 11
6
+ TINY = 0
7
7
 
8
8
  ARRAY = [MAJOR, MINOR, TINY]
9
9
  STRING = ARRAY.join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-exts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2
4
+ version: 1.11.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &2153266900 !ruby/object:Gem::Requirement
16
+ requirement: &2161861100 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153266900
24
+ version_requirements: *2161861100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: i18n
27
- requirement: &2153265780 !ruby/object:Gem::Requirement
27
+ requirement: &2161860560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153265780
35
+ version_requirements: *2161860560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &2153264640 !ruby/object:Gem::Requirement
38
+ requirement: &2161860100 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153264640
46
+ version_requirements: *2161860100
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &2153249860 !ruby/object:Gem::Requirement
49
+ requirement: &2161859640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.6.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2153249860
57
+ version_requirements: *2161859640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-bundler
60
- requirement: &2153247580 !ruby/object:Gem::Requirement
60
+ requirement: &2161859140 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.1.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153247580
68
+ version_requirements: *2161859140
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-rspec
71
- requirement: &2153246300 !ruby/object:Gem::Requirement
71
+ requirement: &2161858660 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.4.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2153246300
79
+ version_requirements: *2161858660
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2153245320 !ruby/object:Gem::Requirement
82
+ requirement: &2161857180 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 2.6.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2153245320
90
+ version_requirements: *2161857180
91
91
  description: ! 'Capistrano exts is a set of helper tasks to help with the initial
92
92
  server
93
93
 
@@ -138,6 +138,7 @@ files:
138
138
  - lib/capistrano-exts/receipts/contao.rb
139
139
  - lib/capistrano-exts/receipts/contents.rb
140
140
  - lib/capistrano-exts/receipts/deploy.rb
141
+ - lib/capistrano-exts/receipts/files.rb
141
142
  - lib/capistrano-exts/receipts/functions.rb
142
143
  - lib/capistrano-exts/receipts/git.rb
143
144
  - lib/capistrano-exts/receipts/god.rb