capistrano-postgresql 4.8.1 → 4.9.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
  SHA256:
3
- metadata.gz: 99782e17f1cfadc9a7bef273471fc8c0d9327badfb8cc1aaabd0e5d1d71b1e16
4
- data.tar.gz: b243ef51314de1d4924727f9a693e086893f05180d736c0a2789d125f6d16a9f
3
+ metadata.gz: 375eca70ee0863b2ac3397cb4405ed44cd64f4039e563e7022ee254b4c804221
4
+ data.tar.gz: efc67d023365b4c9d106d176c7cd3874b6911bf6b1ca0a2fb60d1f1eeff6a3b4
5
5
  SHA512:
6
- metadata.gz: 158247310972ce9e07dd08a3cf1d6f9d169149d110121bf62b56a0af8be85cd3860c9e7b114be14dd68460631eaa09bd406910a5a41bac39671908b5c04d89c2
7
- data.tar.gz: 6e9b98484fae0fd73af2cd2a97c03a1318e0ece3422d33b483633d3e6f1492c77e6bb2cbf4315db97c4793ae83f5b2c532100f2dec8c60db6da93657cfc22775
6
+ metadata.gz: c7cd4f58152e609273af9732f6e2bdffde273c4c2ce3c7f0e4d674bcd1026d9ae14f85a81a13ddbc455f031531b2ac8b01b34ba36f94532c1b050d1ad19732ca
7
+ data.tar.gz: 4a16961feefadef88c15d545e20a0ea0274e7c3d3c7dd194186a66d3180d0e58f93f10b08d378a92adaaaf05a5100e301bede93f217d8497416cddc50a720d54
data/README.md CHANGED
@@ -42,20 +42,17 @@ Then:
42
42
  If you're deploying a standard rails app, all you need to do is put
43
43
  the following in `Capfile` file:
44
44
 
45
- require 'capistrano/postgresql'
45
+ ```
46
+ require 'capistrano/postgresql'
47
+ ```
46
48
 
47
- Make sure the `deploy_to` path exists and has the right privileges on the
48
- server (i.e. `/var/www/myapp`). Warning: The ~ symbol (i.e. `~/myapp`) is not supported.<br/>
49
- Or just install
50
- [capistrano-safe-deploy-to](https://github.com/capistrano-plugins/capistrano-safe-deploy-to)
51
- plugin and don't think about it.
49
+ * Make sure the `deploy_to` path exists and has the right privileges on the
50
+ server (i.e. `/var/www/myapp`). Warning: The ~ symbol (i.e. `~/myapp`) is not supported.
51
+ * Within your app/config/deploy/{env}.rb files, you need to specify at least one :app and one :db server.
52
+ * It's also suggested to specify `:primary => true` on the end of your primary :db server line.
53
+ * Optionally, you can run psql commands WITHOUT sudo if needed. Set the following (which defaults to false): `set :pg_without_sudo, true`
52
54
 
53
-
54
- Optionally, you can run psql commands WITHOUT sudo if needed. Set the following:
55
-
56
- set :pg_without_sudo, true # defaults to false
57
-
58
- To setup the server(s), run:
55
+ Finally, to setup the server(s), run:
59
56
 
60
57
  $ bundle exec cap production setup
61
58
 
@@ -49,13 +49,13 @@ module Capistrano
49
49
 
50
50
  # location of database.yml file on clients
51
51
  def database_yml_file
52
- raise(":deploy_to in your app/config/deploy/\#{environment}.rb file cannot contain ~") if shared_path.to_s.include?('~') # issues/27
52
+ raise(":deploy_to in your app/config/deploy/#{fetch(:rails_env)}.rb file cannot contain ~") if shared_path.to_s.include?('~') # issues/27
53
53
  shared_path.join('config/database.yml')
54
54
  end
55
55
 
56
- # location of archetypical database.yml file created on primary db role when user and database are first created
56
+ # location of archetypal database.yml file created on primary db role when user and database are first created
57
57
  def archetype_database_yml_file
58
- raise(":deploy_to in your app/config/deploy/\#{environment}.rb file cannot contain ~") if shared_path.to_s.include?('~') # issues/27
58
+ raise(":deploy_to in your app/config/deploy/#{fetch(:rails_env)}.rb file cannot contain ~") if shared_path.to_s.include?('~') # issues/27
59
59
  deploy_path.join('db/database.yml')
60
60
  end
61
61
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Postgresql
3
- VERSION = '4.8.1'
3
+ VERSION = '4.9.0'
4
4
  end
5
5
  end
@@ -123,7 +123,7 @@ namespace :postgresql do
123
123
  next if db_user_exists?
124
124
  # If you use CREATE USER instead of CREATE ROLE the LOGIN right is granted automatically; otherwise you must specify it in the WITH clause of the CREATE statement.
125
125
  unless psql_on_db fetch(:pg_system_db), '-c', %Q{"CREATE USER \\"#{fetch(:pg_username)}\\" PASSWORD '#{fetch(:pg_password)}';"}
126
- error 'postgresql: creating database user failed!'
126
+ error "postgresql: creating database user \"#{fetch(:pg_username)}\" failed!"
127
127
  exit 1
128
128
  end
129
129
  end
@@ -165,14 +165,22 @@ namespace :postgresql do
165
165
 
166
166
  desc 'Postgresql setup tasks'
167
167
  task :setup do
168
- puts "* ============================= * \n All psql commands will be run #{fetch(:pg_without_sudo) ? 'without sudo' : 'with sudo'}\n You can modify this in your deploy/{env}.rb by setting the pg_without_sudo boolean \n* ============================= *"
169
- invoke 'postgresql:remove_app_database_yml_files' # Deletes old yml files from all app role servers. Allows you to avoid having to manually delete the files on your app servers to get a new pool size for example. Don't touch the archetype file to avoid deleting generated passwords
170
- invoke 'postgresql:create_db_user'
171
- invoke 'postgresql:create_database'
172
- invoke 'postgresql:add_hstore'
173
- invoke 'postgresql:add_extensions'
174
- invoke 'postgresql:generate_database_yml_archetype'
175
- invoke 'postgresql:generate_database_yml'
168
+ puts "* ============================= * \n All psql commands will be run #{fetch(:pg_without_sudo) ? 'without sudo' : 'with sudo'}\n You can modify this in your app/config/deploy/#{fetch(:rails_env)}.rb by setting the pg_without_sudo boolean \n* ============================= *"
169
+ if release_roles(:app).empty?
170
+ puts "There are no servers in your app/config/deploy/#{fetch(:rails_env)}.rb with a :app role... Skipping Postgresql setup."
171
+ else
172
+ invoke 'postgresql:remove_app_database_yml_files' # Deletes old yml files from all servers. Allows you to avoid having to manually delete the files on your app servers to get a new pool size for example. Don't touch the archetype file to avoid deleting generated passwords.
173
+ if release_roles(:db).empty? # Test to be sure we have a :db role host
174
+ puts "There is no server in your app/config/deploy/#{fetch(:rails_env)}.rb with a :db role... Skipping Postgresql setup."
175
+ else
176
+ invoke 'postgresql:create_db_user'
177
+ invoke 'postgresql:create_database'
178
+ invoke 'postgresql:add_hstore'
179
+ invoke 'postgresql:add_extensions'
180
+ invoke 'postgresql:generate_database_yml_archetype'
181
+ invoke 'postgresql:generate_database_yml'
182
+ end
183
+ end
176
184
  end
177
185
  end
178
186
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-postgresql
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.1
4
+ version: 4.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Sutic
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-16 00:00:00.000000000 Z
12
+ date: 2018-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano