capistrano-exts 1.5.0 → 1.5.1

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/README.md CHANGED
@@ -17,7 +17,7 @@ gem install capistrano-exts
17
17
  or add it to your Gemfile
18
18
 
19
19
  ```ruby
20
- gem 'capistrano-exts', '>=1.5.0'
20
+ gem 'capistrano-exts', '>=1.5.1'
21
21
  ```
22
22
 
23
23
  Setup
@@ -74,6 +74,9 @@ set :contents_folder, {
74
74
  # Mysql
75
75
  #
76
76
 
77
+ # Where is located the primary database folder?
78
+ set :mysql_db_server, 'localhost'
79
+
77
80
  # What is the database name for this project/stage ?
78
81
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
79
82
 
@@ -74,6 +74,9 @@ set :contents_folder, {
74
74
  # Mysql
75
75
  #
76
76
 
77
+ # Where is located the primary database folder?
78
+ set :mysql_db_server, 'localhost'
79
+
77
80
  # What is the database name for this project/stage ?
78
81
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
79
82
 
@@ -74,6 +74,9 @@ set :contents_folder, {
74
74
  # Mysql
75
75
  #
76
76
 
77
+ # Where is located the primary database folder?
78
+ set :mysql_db_server, 'localhost'
79
+
77
80
  # What is the database name for this project/stage ?
78
81
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
79
82
 
@@ -75,6 +75,9 @@ set :rvm_ruby_string, "1.9.3"
75
75
  # Mysql
76
76
  #
77
77
 
78
+ # Where is located the primary database folder?
79
+ set :mysql_db_server, 'localhost'
80
+
78
81
  # What is the database name for this project/stage ?
79
82
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
80
83
 
@@ -75,6 +75,9 @@ set :rvm_ruby_string, "1.9.3"
75
75
  # Mysql
76
76
  #
77
77
 
78
+ # Where is located the primary database folder?
79
+ set :mysql_db_server, 'localhost'
80
+
78
81
  # What is the database name for this project/stage ?
79
82
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
80
83
 
@@ -75,6 +75,9 @@ set :rvm_ruby_string, "1.9.3"
75
75
  # Mysql
76
76
  #
77
77
 
78
+ # Where is located the primary database folder?
79
+ set :mysql_db_server, 'localhost'
80
+
78
81
  # What is the database name for this project/stage ?
79
82
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
80
83
 
@@ -75,6 +75,9 @@ set :rvm_ruby_string, "1.9.3"
75
75
  # Mysql
76
76
  #
77
77
 
78
+ # Where is located the primary database folder?
79
+ set :mysql_db_server, 'localhost'
80
+
78
81
  # What is the database name for this project/stage ?
79
82
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
80
83
 
@@ -75,6 +75,9 @@ set :rvm_ruby_string, "1.9.3"
75
75
  # Mysql
76
76
  #
77
77
 
78
+ # Where is located the primary database folder?
79
+ set :mysql_db_server, 'localhost'
80
+
78
81
  # What is the database name for this project/stage ?
79
82
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
80
83
 
@@ -75,6 +75,9 @@ set :rvm_ruby_string, "1.9.3"
75
75
  # Mysql
76
76
  #
77
77
 
78
+ # Where is located the primary database folder?
79
+ set :mysql_db_server, 'localhost'
80
+
78
81
  # What is the database name for this project/stage ?
79
82
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
80
83
 
@@ -75,7 +75,7 @@ Capistrano::Configuration.instance(:must_exist).load do
75
75
  # Create a tarball of the contents folder
76
76
  run <<-CMD
77
77
  cd #{shared_path}/shared_contents &&
78
- tar czf /tmp/#{File.basename export_filename} --exclude='*~' --exclude='*.tmp' --exclude='*.bak' *
78
+ tar chzf /tmp/#{File.basename export_filename} --exclude='*~' --exclude='*.tmp' --exclude='*.bak' *
79
79
  CMD
80
80
 
81
81
  # Tranfer the contents to the local system
@@ -32,26 +32,34 @@ Capistrano::Configuration.instance(:must_exist).load do
32
32
  run "chmod -R g+w #{fetch :latest_release}" if fetch(:group_writable, true)
33
33
  end
34
34
 
35
- desc "[internal] Symlink htdocs"
36
- task :symlink_htdocs do
35
+ desc "[internal] Symlink public folder"
36
+ task :symlink_public_folders, :roles => :web, :except => { :no_release => true } do
37
37
  deploy_to = fetch :deploy_to
38
- if remote_file_exists?("#{deploy_to}/htdocs")
39
- begin
40
- run <<-CMD
41
- #{try_sudo} mv #{deploy_to}/htdocs #{deploy_to}/old_htdocs &&
42
- #{try_sudo} ln -nsf #{fetch :public_path} #{deploy_to}/htdocs
43
- CMD
44
- rescue Capistrano::CommandError
45
- puts "WARNING: I couldn't replace the old htdocs please do so manually"
38
+
39
+ ['htdocs', 'httpdocs', 'www'].each do |folder|
40
+ if remote_file_exists?("#{deploy_to}/#{folder}")
41
+ begin
42
+ # Make sure the old folder exists
43
+ run <<-CMD
44
+ mkdir -p #{deploy_to}/old
45
+ CMD
46
+
47
+ run <<-CMD
48
+ #{try_sudo} mv #{deploy_to}/#{folder} #{deploy_to}/old/#{folder} &&
49
+ #{try_sudo} ln -nsf #{fetch :public_path} #{deploy_to}/#{folder}
50
+ CMD
51
+ rescue Capistrano::CommandError
52
+ puts "WARNING: I couldn't replace the old htdocs please do so manually"
53
+ end
46
54
  end
47
55
  end
48
56
 
49
- puts "The htdocs folder has been moved to old_htdocs"
57
+ puts "The public folders has been moved to the old folder"
50
58
  end
51
59
  end
52
60
 
53
61
  # Dependencies
54
62
  before "deploy", "deploy:check_if_remote_ready"
55
63
  after "deploy:restart", "deploy:fix_permissions"
56
- after "deploy:setup", "deploy:symlink_htdocs"
64
+ after "deploy:setup", "deploy:symlink_public_folders"
57
65
  end
@@ -8,7 +8,7 @@ unless Capistrano::Configuration.respond_to?(:instance)
8
8
  end
9
9
 
10
10
  Capistrano::Configuration.instance(:must_exist).load do
11
- namespace :deploy do
11
+ namespace :git do
12
12
  desc "Check if the branch is ready"
13
13
  task :check_if_branch_is_ready, :roles => :app, :except => { :no_release => true } do
14
14
  unless `git rev-parse #{branch}` == `git rev-parse origin/#{branch}`
@@ -32,6 +32,6 @@ Capistrano::Configuration.instance(:must_exist).load do
32
32
  end
33
33
 
34
34
  # Dependencies
35
- before "deploy", "deploy:check_if_branch_is_ready"
36
- after "deploy:check_if_branch_is_ready", "deploy:check_revision"
35
+ before "deploy", "git:check_if_branch_is_ready"
36
+ after "git:check_if_branch_is_ready", "git:check_revision"
37
37
  end
@@ -116,7 +116,7 @@ Capistrano::Configuration.instance(:must_exist).load do
116
116
  CMD
117
117
 
118
118
  set :mysql_credentials, {
119
- host: find_servers(:roles => :db, primary: true).first.to_s.gsub(/^(.*@)?([^:]*)(:.*)?$/, '\2'),
119
+ host: fetch(:mysql_db_server, 'localhost'),
120
120
  user: mysql_db_user,
121
121
  pass: fetch(:mysql_db_pass),
122
122
  }
@@ -292,10 +292,10 @@ Capistrano::Configuration.instance(:must_exist).load do
292
292
  if mysql_credentials.blank? or mysql_credentials[:user].blank? or mysql_credentials[:pass].blank?
293
293
  mysql_credentials = {
294
294
  host: ask("What is the hostname used to access the database",
295
- default: mysql_credentials.try(:[], :host) || 'localhost',
295
+ default: mysql_credentials.try(:[], :host) || fetch(:mysql_db_server, 'localhost'),
296
296
  validate: /.+/),
297
297
  user: ask("What is the username used to access the database",
298
- default: mysql_credentials.try(:[], :user),
298
+ default: mysql_credentials.try(:[], :user) || fetch(:mysql_db_user),
299
299
  validate: /.+/),
300
300
  pass: ask("What is the password used to access the database",
301
301
  default: mysql_credentials.try(:[], :pass),
@@ -370,7 +370,7 @@ Capistrano::Configuration.instance(:must_exist).load do
370
370
  if mysql_root_credentials.blank? or mysql_root_credentials[:user].blank? or mysql_root_credentials[:pass].blank?
371
371
  mysql_root_credentials = {
372
372
  host: ask("What is the hostname used to access the database",
373
- default: mysql_root_credentials.try(:[], :host) || 'localhost',
373
+ default: mysql_root_credentials.try(:[], :host) || fetch(:mysql_db_server, 'localhost'),
374
374
  validate: /.+/),
375
375
  user: ask("What is the username used to access the database",
376
376
  default: mysql_root_credentials.try(:[], :user),
@@ -72,6 +72,9 @@ set :rvm_ruby_string, "1.9.3"
72
72
  # Mysql
73
73
  #
74
74
 
75
+ # Where is located the primary database folder?
76
+ set :mysql_db_server, 'localhost'
77
+
75
78
  # What is the database name for this project/stage ?
76
79
  set :mysql_db_name, -> { "#{fetch :application}_#{fetch :stage}" }
77
80
 
@@ -3,7 +3,7 @@ module Capistrano
3
3
  module Version #:nodoc:
4
4
  MAJOR = 1
5
5
  MINOR = 5
6
- TINY = 0
6
+ TINY = 1
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.5.0
4
+ version: 1.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-06 00:00:00.000000000 Z
12
+ date: 2011-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &2152402160 !ruby/object:Gem::Requirement
16
+ requirement: &2156458100 !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: *2152402160
24
+ version_requirements: *2156458100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: i18n
27
- requirement: &2152612760 !ruby/object:Gem::Requirement
27
+ requirement: &2156456100 !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: *2152612760
35
+ version_requirements: *2156456100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &2152626900 !ruby/object:Gem::Requirement
38
+ requirement: &2156454120 !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: *2152626900
46
+ version_requirements: *2156454120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &2152622900 !ruby/object:Gem::Requirement
49
+ requirement: &2156452240 !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: *2152622900
57
+ version_requirements: *2156452240
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-bundler
60
- requirement: &2152619820 !ruby/object:Gem::Requirement
60
+ requirement: &2156451180 !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: *2152619820
68
+ version_requirements: *2156451180
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-rspec
71
- requirement: &2152670800 !ruby/object:Gem::Requirement
71
+ requirement: &2156469200 !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: *2152670800
79
+ version_requirements: *2156469200
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2152665220 !ruby/object:Gem::Requirement
82
+ requirement: &2156467860 !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: *2152665220
90
+ version_requirements: *2156467860
91
91
  description: Handy extensions for Capistrano
92
92
  email:
93
93
  - wael.nasreddine@gmail.com