capistrano-cluster 0.0.14 → 0.0.15

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: 03b097ac06df4a9ae20dca5f6696e14e5cb95ce9
4
- data.tar.gz: 6d53c42bd9b93e9b334b52af37e586b987bf2806
3
+ metadata.gz: 5148e1233325254875139ad683e8a3b7aab6ba04
4
+ data.tar.gz: 82df6a50f92dd477ab21d97e44e9bb42cfa33942
5
5
  SHA512:
6
- metadata.gz: c5a0f3fdb8b55bb0726e4d8bd9f37e6564c3048cd074d2ab637002fe25b7b7445f8ade750bf750b9318b2cfed731c9b2d1493088f56e586ba641fe3af72e9739
7
- data.tar.gz: e524891820745a5c924bbd3a440f77dcfeecb19bc44f84f3e022287843b6df98200e8ab9b776f57fdeba623699a69f521d2df8cec661ae2d5e220e437290ea6e
6
+ metadata.gz: d3d8d2fd5e96377ad2e725eacd9371f491c8736211318921d97c2d416597322636d9c0177667bddbca337bb981087fd21ebad59a98cc67fca126c4797cfd912d
7
+ data.tar.gz: 2bad09f1c9653e39cf6d166d9279726e605f5c293c2e809582fee76cc800dcadd1f806272a922ac7dae2791010c2db4e8690826cedaddafa8188159d79cac50a
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Cluster
3
- VERSION = "0.0.14"
3
+ VERSION = "0.0.15"
4
4
  end
5
5
  end
@@ -29,35 +29,37 @@ namespace :deploy do
29
29
 
30
30
  task :db do
31
31
 
32
- db_user = fetch(:database)[:username]
33
- db_pass = fetch(:database)[:password]
34
- db_name = fetch(:database).fetch(:name, fetch(:application))
35
- enconding = fetch(:database)[:enconding] || "utf-8"
32
+ unless fetch(:database,{}).empty?
33
+ db_user = fetch(:database)[:username]
34
+ db_pass = fetch(:database)[:password]
35
+ db_name = fetch(:database).fetch(:name, fetch(:application))
36
+ enconding = fetch(:database)[:enconding] || "utf-8"
36
37
 
37
- on roles(:db) do
38
+ on roles(:db) do
38
39
 
39
- if capture(:psql, "-U", "postgres", "template1", "-t", "-c", "SELECT 1 FROM pg_catalog.pg_user WHERE usename = '#{db_user}'".shellescape).empty?
40
- execute :psql, "-U", "postgres", "-c", "CREATE ROLE #{db_user} LOGIN PASSWORD '#{db_pass}';".shellescape
41
- end
40
+ if capture(:psql, "-U", "postgres", "template1", "-t", "-c", "SELECT 1 FROM pg_catalog.pg_user WHERE usename = '#{db_user}'".shellescape).empty?
41
+ execute :psql, "-U", "postgres", "-c", "CREATE ROLE #{db_user} LOGIN PASSWORD '#{db_pass}';".shellescape
42
+ end
42
43
 
43
- if capture(:psql, "-U", "postgres", "template1", "-t", "-c", "SELECT 1 FROM pg_catalog.pg_database WHERE datname = '#{db_name}'".shellescape).empty?
44
- execute :psql, "-U", "postgres", "-c", "CREATE DATABASE #{db_name} ENCODING '#{enconding}' OWNER #{db_user};".shellescape
45
- execute :psql, "-U", "postgres", "#{db_name}", "-c", "CREATE EXTENSION postgis;".shellescape
46
- end
44
+ if capture(:psql, "-U", "postgres", "template1", "-t", "-c", "SELECT 1 FROM pg_catalog.pg_database WHERE datname = '#{db_name}'".shellescape).empty?
45
+ execute :psql, "-U", "postgres", "-c", "CREATE DATABASE #{db_name} ENCODING '#{enconding}' OWNER #{db_user};".shellescape
46
+ execute :psql, "-U", "postgres", "#{db_name}", "-c", "CREATE EXTENSION postgis;".shellescape
47
+ end
47
48
 
48
- end
49
+ end
49
50
 
50
- on roles(:app) do
51
- defaults = {
52
- environment: fetch(:framework_env),
53
- hostname: primary(:db),
54
- name: db_name,
55
- adapter: 'postgresql',
56
- encoding: 'utf-8',
57
- options:{}
58
- }
59
- settings = defaults.merge(fetch(:database))
60
- upload! file("database.yml", settings), "#{shared_path}/config/database.yml"
51
+ on roles(:app) do
52
+ defaults = {
53
+ environment: fetch(:framework_env),
54
+ hostname: primary(:db),
55
+ name: db_name,
56
+ adapter: 'postgresql',
57
+ encoding: 'utf-8',
58
+ options:{}
59
+ }
60
+ settings = defaults.merge(fetch(:database))
61
+ upload! file("database.yml", settings), "#{shared_path}/config/database.yml"
62
+ end
61
63
  end
62
64
 
63
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-cluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Verestiuc