capones_recipes 1.13.4 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ Capistrano::Configuration.instance.load do
2
+ namespace :db do
3
+ desc "Create database and grant permissions"
4
+ task :create, :roles => :db_server do
5
+ run "mysqladmin -u root -p create #{db_database} || true" do |channel, stream, data|
6
+ if data =~ /^Enter password:/
7
+ logger.info "#{channel[:host]} asked for password"
8
+ channel.send_data "\n"
9
+ else
10
+ logger.info data
11
+ end
12
+ end
13
+ end
14
+
15
+ desc "Grant access"
16
+ task :grant, :roles => :db_server do
17
+ # TODO: support more than one server
18
+ # TODO: lookup fqdn for web servers
19
+ web_server = find_servers(:roles => :web).first
20
+ run "mysql -u root -p #{db_database} -e \"GRANT ALL PRIVILEGES ON #{db_database}.* TO '#{db_username}'@'#{web_server}' IDENTIFIED BY '#{db_password}'\"" do |channel, stream, data|
21
+ if data =~ /^Enter password:/
22
+ logger.info "#{channel[:host]} asked for password"
23
+ channel.send_data "\n"
24
+ else
25
+ logger.info data
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -3,6 +3,9 @@ Capistrano::Configuration.instance.load do
3
3
  after "deploy:finalize_update", "db:symlink"
4
4
 
5
5
  before "db:setup", "deploy:update_code"
6
+ before "db:setup", "db:create"
7
+ before "db:setup", "db:grant"
8
+ before "db:setup", "db:configure"
6
9
 
7
10
  namespace :db do
8
11
  desc "Create shared directories"
@@ -22,13 +25,6 @@ Capistrano::Configuration.instance.load do
22
25
  called database.yml.erb is found either is :template_dir
23
26
  or /config/deploy folders. The default template matches
24
27
  the template for config/database.yml file shipped with Rails.
25
-
26
- When this recipe is loaded, db:configure is automatically configured
27
- to be invoked after deploy:setup. You can skip this task setting
28
- the variable :skip_db_setup to true. This is especially useful
29
- if you are using this recipe in combination with
30
- capistrano-ext/multistaging to avoid multiple db:configure calls
31
- when running deploy:configure for all stages one by one.
32
28
  DESC
33
29
  task :configure, :roles => :app do
34
30
 
@@ -1,3 +1,3 @@
1
1
  module CaponesRecipes
2
- VERSION = "1.13.4"
2
+ VERSION = "1.14.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capones_recipes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 43
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 13
9
- - 4
10
- version: 1.13.4
8
+ - 14
9
+ - 0
10
+ version: 1.14.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roman Simecek (CyT)
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-12-20 00:00:00 Z
19
+ date: 2011-12-27 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: capistrano
@@ -138,6 +138,7 @@ files:
138
138
  - lib/capones_recipes/tasks/carrier_wave.rb
139
139
  - lib/capones_recipes/tasks/database.rb
140
140
  - lib/capones_recipes/tasks/database/mysql.rb
141
+ - lib/capones_recipes/tasks/database/setup.rb
141
142
  - lib/capones_recipes/tasks/database/sqlite.rb
142
143
  - lib/capones_recipes/tasks/database/sync.rb
143
144
  - lib/capones_recipes/tasks/deploy_targets.rb
@@ -193,4 +194,3 @@ specification_version: 3
193
194
  summary: Some capistrano recipes for use.
194
195
  test_files: []
195
196
 
196
- has_rdoc: