prun-ops 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8432992fb4f232bbe147a6e7005a8770db76112c
4
- data.tar.gz: 4c1766975366bc46bffcd649c92d6bab55bb98a7
3
+ metadata.gz: 1d6dd1191d20b8f27127ee729e519bd54adf95c8
4
+ data.tar.gz: 8ea525da2495f9aa550cad68814604cd786df4ad
5
5
  SHA512:
6
- metadata.gz: ffd20fec740b6e8bc1fb32e24df193d4419b0d80010281e8c86492c0c344dab4d8c39e729bfa054baefa2b0090adc2cf034d5e6859e192015bea92854b5e79b6
7
- data.tar.gz: 18fea3bf44ab4c0443f021d814bee8e3a4d52d18c56b3628ea1894a2a351d5a597d9afb0edc535970f5446ecc1e840424e9730b6096502be7a97f89647b7264f
6
+ metadata.gz: 3c618f871ee108bfa34cec8159f453f8b3806d93192791a486c18cd114660932c67bc9130c4f2b580d7f6c2f51acc3ee59f1732db414f89b597d578bb49fbed2
7
+ data.tar.gz: 69c8f6211e47916bbb2d434fe9b85c4dfb6440c4705d1b0f5cd5d5c0b8c91a2c338c6d2ea21083b805318d224ba4d9214ec68f7c61e7331ba65f1786336ab70d
data/README.md CHANGED
@@ -119,6 +119,7 @@ Some capistrano commands useful to connect to server and help with the problem s
119
119
  * `cap [stg] ssh` open a ssh connection with server
120
120
  * `cap [stg] log[LOG_FILENAME]` tail all rails logs by default, or only one if LOG_FILENAME is provided
121
121
  * `cap [stg] c` open a rails console with server
122
+ * `cap [stg] dbconsole` open a rails database console with server
122
123
  * `cap [stg] x[COMMAND]` execute any command in server provided as COMMAND (i.e.: cap production x['free -m'])
123
124
 
124
125
  ### Monitoring
@@ -190,4 +191,8 @@ require 'capistrano/rails/migrations'
190
191
  require "#{File.dirname(__FILE__)}/config/application"
191
192
  require 'capistrano/prun-ops'
192
193
  ................
193
- ```
194
+ ```
195
+
196
+ ### v0.1.2
197
+
198
+ * Add `cap stage dbconsole` to open a database console.
@@ -16,6 +16,15 @@ task :c do
16
16
  end
17
17
  end
18
18
 
19
+ desc 'Opens a remote Database console'
20
+ task :dbconsole do
21
+ on roles(:app) do |host|
22
+ run_locally do
23
+ run_in host, "cd #{current_path} && RAILS_ENV=#{fetch(:stage)} bundle exec rails dbconsole --include-password"
24
+ end
25
+ end
26
+ end
27
+
19
28
  desc 'Tails the environment log or the log passed as argument: cap log[thin.3000.log]'
20
29
  task :log, :file do |task, args|
21
30
  on roles(:app) do
@@ -1,3 +1,3 @@
1
1
  module PrunOps
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -10,7 +10,7 @@ namespace :db do
10
10
 
11
11
  desc "Backup the database tp tmp/db.sql file"
12
12
  task backup: :get_db_config do
13
- sh "export PGPASSWORD=#{@password} && pg_dump #{@database} -U #{@username} -f #{@default_filename}"
13
+ sh "export PGPASSWORD=#{@password} && pg_dump #{@database} --host #{@host} -U #{@username} -f #{@default_filename}"
14
14
  end
15
15
 
16
16
  desc "Restore the database from tmp/db.sql file if no one is passed"
@@ -21,6 +21,7 @@ end
21
21
 
22
22
  task :get_db_config do
23
23
  config = Rails.configuration.database_configuration
24
+ @host = config[Rails.env]["host"]
24
25
  @database = config[Rails.env]["database"]
25
26
  @username = config[Rails.env]["username"]
26
27
  @password = config[Rails.env]["password"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prun-ops
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Lebrijo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-30 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler