capistrano_recipes 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ee75d10bd77f57e63cc7f8bbbe764b49d4d7382
4
- data.tar.gz: 2435343b3609bc846e1b426402fccc2a52cfae07
3
+ metadata.gz: 6e78c7154d5a61df05a26fa96ebae0b6f29d6ecb
4
+ data.tar.gz: 27b8455987d54d5676a5f27f5aff825dd8beea8a
5
5
  SHA512:
6
- metadata.gz: deb8913d76f06a3cc6c7f7da4b0a4dbe0abf2d66936ad2e517d17a220e39881b7324cb107b2aadc8bdb1a499b14362c6bac712bdffbbd60c1d04daa4b12c526f
7
- data.tar.gz: bd2ec2fe3af982ac8d962426567c0f12f1e4c8a33b8e9e703d34b168b16091bc7d528547d0dae09afb8563f643f60331a12730e3a220338a5dd3310bbfa1f551
6
+ metadata.gz: ef431fd46ed70b81bed968e342a65964bc1eeed6d3558ad09df1880ea478091f4213057e285fe33c7bead08cd52ec91fe65aed5e652305cdfdd4c78ef6a60ed9
7
+ data.tar.gz: 1e44229c200d5f54872a89b2fc313caaf632b935dbf12a44b474d8d14b0b68222c8a856fba1b9781bc0fa164aec48955b99e95abda29b758d26bd9d246635489
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'capistrano_recipes'
7
- s.version = '1.2.0'
7
+ s.version = '1.3.0'
8
8
  s.authors = ['Fernando Aleman']
9
9
  s.email = ['fernandoaleman@mac.com']
10
10
  s.description = 'Capistrano recipes to make your deployments fast and easy'
@@ -5,7 +5,6 @@ module CapistranoRecipes
5
5
  set(:repository) { abort "Please specify repository, set :repository, 'foo'" }
6
6
 
7
7
  _cset :branch, 'master'
8
- _cset :use_sudo, false
9
8
  _cset :check_repo, true
10
9
 
11
10
  set :migrate_target, :current
@@ -2,15 +2,19 @@ module CapistranoRecipes
2
2
  module Mysql
3
3
  def self.load_into(configuration)
4
4
  configuration.load do
5
+
6
+ # MySQL command
7
+ _cset :mysql_command, lambda { 'mysqld' }
8
+
5
9
  # MySQL admin user with access to create databases and grant permissions
6
10
  _cset :mysql_admin_user, lambda { ask "Enter #{rails_env} database username with access to create database" }
7
11
 
8
12
  # Application database adapter
9
13
  _cset :mysql_adapter, lambda { 'mysql2' }
10
-
14
+
11
15
  # Application database name
12
16
  _cset :mysql_database, lambda { "#{application}_#{rails_env}" }
13
-
17
+
14
18
  # Application database user
15
19
  _cset :mysql_user, lambda { ask "Enter #{rails_env} database username" }
16
20
 
@@ -51,17 +55,17 @@ module CapistranoRecipes
51
55
  desc 'Create mysql database'
52
56
  task :create, :roles => :db, :only => { :primary => true } do
53
57
  prepare_from_yaml
54
-
58
+
55
59
  db_exists = false
56
-
60
+
57
61
  mysql_admin = mysql_admin_user
58
62
  pass = password_prompt "Enter database password for '#{mysql_admin}'"
59
-
60
- run "echo \"SHOW DATABASES\" | mysql -u #{mysql_admin} -p" do |channel, stream, data|
63
+
64
+ run "echo \"SHOW DATABASES\" | mysql -h #{mysql_host} -u #{mysql_admin} -p" do |channel, stream, data|
61
65
  if data =~ /^Enter password:/
62
66
  channel.send_data "#{pass}\n"
63
67
  end
64
-
68
+
65
69
  if data =~ /^Database/
66
70
  db_exists = db_exists || data.include?(db_name)
67
71
  end
@@ -73,8 +77,8 @@ module CapistranoRecipes
73
77
  sql = "CREATE DATABASE #{db_name};"\
74
78
  "GRANT ALL PRIVILEGES ON #{db_name}.* TO #{db_user}@localhost IDENTIFIED BY '#{db_pass}';"\
75
79
  "FLUSH PRIVILEGES;"
76
-
77
- run "echo \"#{sql}\" | mysql -u #{mysql_admin} -p" do |channel, stream, data|
80
+
81
+ run "echo \"#{sql}\" | mysql -h #{mysql_host} -u #{mysql_admin} -p" do |channel, stream, data|
78
82
  if data =~ /^Enter password:/
79
83
  channel.send_data "#{pass}\n"
80
84
  end
@@ -124,7 +128,7 @@ module CapistranoRecipes
124
128
  %w[start stop restart status].each do |command|
125
129
  desc "#{command.capitalize} mysql"
126
130
  task command, :roles => :db, :only => { :primary => true } do
127
- run "#{sudo} service mysqld #{command}"
131
+ run "#{sudo} service #{mysql_command} #{command}"
128
132
  end
129
133
  end
130
134
  end
@@ -135,11 +139,11 @@ module CapistranoRecipes
135
139
  set(:db_host) { db_config[rails_env]["host"] }
136
140
  set(:db_name) { db_config[rails_env]["database"] }
137
141
  end
138
-
142
+
139
143
  def db_config
140
144
  @db_config ||= fetch_db_config
141
145
  end
142
-
146
+
143
147
  def fetch_db_config
144
148
  require 'yaml'
145
149
  file = capture "cat #{mysql_remote_config_file}"
@@ -15,11 +15,13 @@ module CapistranoRecipes
15
15
  _cset :pids_path, lambda { File.join shared_path, 'pids' }
16
16
  _cset :sockets_path, lambda { File.join shared_path, 'sockets' }
17
17
 
18
- set :user, 'deployer'
18
+ set :user, lambda { 'deployer' }
19
19
 
20
20
  default_run_options[:pty] = true
21
21
  ssh_options[:forward_agent] = true
22
22
 
23
+ set :use_sudo, false
24
+
23
25
  @used_recipes = []
24
26
 
25
27
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano_recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Aleman