capistrano-exts 1.11.2 → 1.11.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/capistrano-exts/receipts/contents.rb +2 -2
- data/lib/capistrano-exts/receipts/functions.rb +1 -1
- data/lib/capistrano-exts/receipts/mysql.rb +8 -8
- data/lib/capistrano-exts/receipts/servers/web_server.rb +1 -1
- data/lib/capistrano-exts/receipts/servers.rb +1 -1
- data/lib/capistrano-exts/servers/web_server.rb +5 -5
- data/lib/capistrano-exts/version.rb +1 -1
- data/lib/capistrano-exts.rb +1 -1
- metadata +17 -17
data/README.md
CHANGED
@@ -83,7 +83,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
83
83
|
export_filename_argv = ARGV.try(:[], argv_file_index)
|
84
84
|
|
85
85
|
# Generate the file name
|
86
|
-
if export_filename_argv
|
86
|
+
if export_filename_argv && !export_filename_argv =~ /.+:.+/ && !File.exists?(export_filename_argv)
|
87
87
|
export_filename = export_filename_argv
|
88
88
|
else
|
89
89
|
export_filename = random_tmp_file + ".tar.gz"
|
@@ -101,7 +101,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
101
101
|
# Find out at which index the file is located ?
|
102
102
|
argv_file_index = ARGV.index("contents:import") + 1
|
103
103
|
|
104
|
-
unless ARGV.size >= (argv_file_index + 1)
|
104
|
+
unless ARGV.size >= (argv_file_index + 1) && File.exists?(ARGV[argv_file_index])
|
105
105
|
logger.important "ERROR: please run 'cap import <gzipped tar>'"
|
106
106
|
exit 1
|
107
107
|
else
|
@@ -133,7 +133,7 @@ password: #{credentials[:pass]}
|
|
133
133
|
# This function asks the user for confirmation (confirm running the task)
|
134
134
|
# If the user answers no, then the task won't be executed.
|
135
135
|
def ask_for_confirmation(what, options = {})
|
136
|
-
unless exists?(:force)
|
136
|
+
unless exists?(:force) && fetch(:force) == true
|
137
137
|
# Ask for a confirmation
|
138
138
|
response = ask(what, options)
|
139
139
|
if response =~ /(no?)|(a(bort)?|\n)/i
|
@@ -160,7 +160,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
160
160
|
# Find out at which index the file is located ?
|
161
161
|
argv_file_index = ARGV.index("mysql:import_db_dump") + 1
|
162
162
|
|
163
|
-
unless ARGV.size >= (argv_file_index + 1)
|
163
|
+
unless ARGV.size >= (argv_file_index + 1) && File.exists?(ARGV[argv_file_index])
|
164
164
|
logger.important "ERROR: please run 'cap mysql:import_db_dump <sql dump>'"
|
165
165
|
exit 1
|
166
166
|
else
|
@@ -181,15 +181,15 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
181
181
|
# TODO: Try upload(filename, remote_file_name) function instead
|
182
182
|
put contents_dump, random_file
|
183
183
|
|
184
|
+
# Backup skiped tables
|
185
|
+
find_and_execute_task "mysql:backup_skiped_tables"
|
186
|
+
|
184
187
|
# Drop the database
|
185
188
|
find_and_execute_task("mysql:drop_db")
|
186
189
|
|
187
190
|
# Create the database
|
188
191
|
find_and_execute_task("mysql:create_db")
|
189
192
|
|
190
|
-
# Backup skiped tables
|
191
|
-
find_and_execute_task "mysql:backup_skiped_tables"
|
192
|
-
|
193
193
|
run <<-CMD
|
194
194
|
mysql \
|
195
195
|
--host='#{mysql_credentials[:host]}' \
|
@@ -229,7 +229,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
229
229
|
export_filename_argv = ARGV.try(:[], argv_file_index)
|
230
230
|
|
231
231
|
# Generate the file name
|
232
|
-
if export_filename_argv
|
232
|
+
if export_filename_argv && !export_filename_argv =~ /.+:.+/ && !File.exists?(export_filename_argv)
|
233
233
|
export_filename = export_filename_argv
|
234
234
|
else
|
235
235
|
export_filename = random_tmp_file + ".sql"
|
@@ -320,7 +320,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
320
320
|
|
321
321
|
desc "[internal] write database #{var.gsub(/_/, ' ')}"
|
322
322
|
task "write_#{var}" do
|
323
|
-
unless exists?("mysql_#{var}_file".to_sym)
|
323
|
+
unless exists?("mysql_#{var}_file".to_sym) && remote_file_exists?(fetch "mysql_#{var}_file".to_sym)
|
324
324
|
mysql_credentials_file = fetch "mysql_#{var}_file".to_sym
|
325
325
|
credentials_formatted_content = credentials_formatted(fetch "mysql_#{var}".to_sym)
|
326
326
|
random_file = random_tmp_file(credentials_formatted_content)
|
@@ -355,7 +355,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
355
355
|
mysql_credentials_pass_regex_match = fetch "mysql_#{var}_pass_regex_match".to_sym
|
356
356
|
|
357
357
|
# We haven't got the credentials yet, look for them
|
358
|
-
if exists?("mysql_#{var}_file".to_sym)
|
358
|
+
if exists?("mysql_#{var}_file".to_sym) && remote_file_exists?(fetch "mysql_#{var}_file".to_sym)
|
359
359
|
mysql_credentials_file = fetch "mysql_#{var}_file".to_sym
|
360
360
|
|
361
361
|
begin
|
@@ -395,7 +395,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
395
395
|
end
|
396
396
|
|
397
397
|
# Finally set it so it's available and write it to the server.
|
398
|
-
if mysql_credentials[:user].present?
|
398
|
+
if mysql_credentials[:user].present? && mysql_credentials[:pass].present?
|
399
399
|
set "mysql_#{var}".to_sym, mysql_credentials
|
400
400
|
find_and_execute_task("mysql:write_#{var}")
|
401
401
|
end
|
@@ -71,7 +71,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
71
71
|
|
72
72
|
desc "[internal] Write authentification file"
|
73
73
|
task :write_web_server_auth_file do
|
74
|
-
if exists?(:web_server_auth_file)
|
74
|
+
if exists?(:web_server_auth_file) && !remote_file_exists?(fetch :web_server_auth_file)
|
75
75
|
web_server_auth_file = fetch :web_server_auth_file
|
76
76
|
web_server_auth_file_contents = fetch :web_server_auth_file_contents
|
77
77
|
web_server_auth_file_unencrypted_contents = fetch :web_server_auth_file_unencrypted_contents
|
@@ -25,7 +25,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
25
25
|
idrsa_filename_argv = ARGV.try(:[], argv_file_index)
|
26
26
|
|
27
27
|
# Generate the file name
|
28
|
-
if idrsa_filename_argv
|
28
|
+
if idrsa_filename_argv && !idrsa_filename_argv =~ /.+:.+/ && !File.exists?(idrsa_filename_argv)
|
29
29
|
idrsa_filename = idrsa_filename_argv
|
30
30
|
else
|
31
31
|
idrsa_filename = "#{ENV['HOME']}/.ssh/id_rsa.pub"
|
@@ -40,7 +40,7 @@ module Capistrano
|
|
40
40
|
|
41
41
|
def php_build_with_force_cgi_redirect?
|
42
42
|
# required if PHP was built with --enable-force-cgi-redirect
|
43
|
-
@php_build_with_force_cgi_redirect.present?
|
43
|
+
@php_build_with_force_cgi_redirect.present? && @php_build_with_force_cgi_redirect == true
|
44
44
|
end
|
45
45
|
|
46
46
|
def sanity_check
|
@@ -59,19 +59,19 @@ module Capistrano
|
|
59
59
|
end
|
60
60
|
|
61
61
|
if reverse_proxy?
|
62
|
-
if @reverse_proxy_server_address.blank?
|
62
|
+
if @reverse_proxy_server_address.blank? && @reverse_proxy_server_port.blank? && @reverse_proxy_socket.blank?
|
63
63
|
raise ArgumentError, "None of the address, port or socket has been defined."
|
64
64
|
end
|
65
65
|
|
66
|
-
if @reverse_proxy_server_address.present?
|
66
|
+
if @reverse_proxy_server_address.present? && @reverse_proxy_server_port.blank?
|
67
67
|
raise ArgumentError, "reverse_proxy_server_address is defined but reverse_proxy_server_port is not please define it."
|
68
68
|
end
|
69
69
|
|
70
|
-
if @reverse_proxy_server_port.present?
|
70
|
+
if @reverse_proxy_server_port.present? && @reverse_proxy_server_address.blank?
|
71
71
|
raise ArgumentError, "reverse_proxy_server_port is defined but reverse_proxy_server_address is not please define it."
|
72
72
|
end
|
73
73
|
|
74
|
-
if @reverse_proxy_server_address.present?
|
74
|
+
if @reverse_proxy_server_address.present? && @reverse_proxy_server_port.present? && @reverse_proxy_socket.present?
|
75
75
|
raise ArgumentError, "you should not define reverse_proxy_server_address, reverse_proxy_server_port and reverse_proxy_socket."
|
76
76
|
end
|
77
77
|
end
|
data/lib/capistrano-exts.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Add it to PATH
|
4
4
|
ROOT_PATH = File.expand_path(File.dirname(__FILE__))
|
5
|
-
$: << ROOT_PATH if File.directory?(ROOT_PATH)
|
5
|
+
$: << ROOT_PATH if File.directory?(ROOT_PATH) && !$:.include?(ROOT_PATH)
|
6
6
|
|
7
7
|
# Require our core extensions
|
8
8
|
require 'capistrano-exts/core_ext'
|
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.11.
|
4
|
+
version: 1.11.3
|
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: &
|
16
|
+
requirement: &2161270460 !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: *
|
24
|
+
version_requirements: *2161270460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano_colors
|
27
|
-
requirement: &
|
27
|
+
requirement: &2161270000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.5.5
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2161270000
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: i18n
|
38
|
-
requirement: &
|
38
|
+
requirement: &2161269500 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.6.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2161269500
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activesupport
|
49
|
-
requirement: &
|
49
|
+
requirement: &2161268920 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 3.1.0
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2161268920
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard
|
60
|
-
requirement: &
|
60
|
+
requirement: &2161268360 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.6.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2161268360
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-bundler
|
71
|
-
requirement: &
|
71
|
+
requirement: &2161267700 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.1.3
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2161267700
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: guard-rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &2161266800 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.4.3
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2161266800
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &2161264920 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: 2.6.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2161264920
|
102
102
|
description: ! 'Capistrano exts is a set of helper tasks to help with the initial
|
103
103
|
server
|
104
104
|
|