capistrano-fiftyfive 0.10.0 → 0.11.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: e23bb6c0cd0ee5b7bdf7cbce96bc25c9c2e86a3a
4
- data.tar.gz: 32a703d754d35f55903c9f9718f4ebade51a4598
3
+ metadata.gz: a062ce89eef2c928f8db7af57f9c5023c8978e72
4
+ data.tar.gz: 151f2d436bbe25871a3d6ae6a931d11b5d571648
5
5
  SHA512:
6
- metadata.gz: 39b2ddc41c28bc51c30b84eab97ca7bdd825d86a2cf58b9b1d9b2f26c62f6e87a75dd28b478cfc0a6405c1e745abd801f88f84cb7c730e3676832dadf1333e6a
7
- data.tar.gz: e17816da9a56350727d87c86fb504927c30c20ffe4da75ccb7d8bee8abd526a221c9e3b2fc0312a8b01520aa8499811a16141da22afe00a9bba3e9b16b6c2288
6
+ metadata.gz: f0c71a57c1b2296cf4a7d95781c717c471da935419aba27311126f717ad53a9ff2e987b4382d558b0d4c90b46bcd854f46a21dd0efa115bc811292172fb6509c
7
+ data.tar.gz: 0c709af0de8a65728a44b92be2b9053f7bf428c052cdaa47959b541b7f79d9fae5dc039cbefad84eed85fc857f35ccd2c0a33b9f6924601e858faf4f23ca2bd7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # capistrano-fiftyfive Changelog
2
2
 
3
+ ## `0.11.0`
4
+
5
+ * INFO log messages are now included in abbreviated output (e.g. upload/download progress).
6
+ * Add `agree()` method to the DSL, which delegates to `HighLine.new.agree`.
7
+ * Add `fiftyfive:postgresql:dump`/`restore` tasks.
8
+
3
9
  ## `0.10.0`
4
10
 
5
11
  Add support for Ubuntu 14.04 LTS. To provision a 14.04 server, use the new `provision:14_04` task.
data/README.md CHANGED
@@ -44,7 +44,7 @@ Add these gems to the development group of your Rails application's Gemfile:
44
44
  gem 'capistrano-bundler', :require => false
45
45
  gem 'capistrano-rails', :require => false
46
46
  gem 'capistrano', '~> 3.2.1', :require => false
47
- gem 'capistrano-fiftyfive', '~> 0.9.0', :require => false
47
+ gem 'capistrano-fiftyfive', '~> 0.10.0', :require => false
48
48
  end
49
49
 
50
50
  And then execute:
@@ -44,6 +44,12 @@ module Capistrano
44
44
  }
45
45
  end
46
46
 
47
+ # Delegates to HighLine's agree() method.
48
+ def agree(yes_or_no_question, character=nil)
49
+ require "highline"
50
+ HighLine.new.agree(yes_or_no_question, character)
51
+ end
52
+
47
53
  # Like capistrano's built-in on(), but connects to the server as root.
48
54
  # To use a user other than root, set :fiftyfive_privileged_user or
49
55
  # specify :privileged_user as a server property.
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Fiftyfive
3
- VERSION = "0.10.0"
3
+ VERSION = "0.11.0"
4
4
  end
5
5
  end
@@ -99,5 +99,65 @@ namespace :fiftyfive do
99
99
  :binding => binding
100
100
  end
101
101
  end
102
+
103
+ desc "Dump the database to FILE"
104
+ task :dump do
105
+ on primary(:db) do
106
+ with_pgpassfile do
107
+ execute :pg_dump,
108
+ "-Fc -Z9 -O",
109
+ "-x", fetch(:fiftyfive_postgresql_dump_options),
110
+ "-f", remote_dump_file,
111
+ connection_flags,
112
+ fetch(:fiftyfive_postgresql_database)
113
+ end
114
+
115
+ download!(remote_dump_file, local_dump_file)
116
+
117
+ info(
118
+ "Exported #{fetch(:fiftyfive_postgresql_database)} "\
119
+ "to #{local_dump_file}."
120
+ )
121
+ end
122
+ end
123
+
124
+ desc "Restore database from FILE"
125
+ task :restore do
126
+ on primary(:db) do
127
+ exit 1 unless agree(
128
+ "\nErase existing #{fetch(:rails_env)} database "\
129
+ "and restore from local file: #{local_dump_file}? "
130
+ )
131
+
132
+ upload!(local_dump_file, remote_dump_file)
133
+
134
+ with_pgpassfile do
135
+ execute :pg_restore,
136
+ "-O -c",
137
+ connection_flags,
138
+ "-d", fetch(:fiftyfive_postgresql_database),
139
+ remote_dump_file
140
+ end
141
+ end
142
+ end
143
+
144
+ def local_dump_file
145
+ ENV.fetch("FILE", "#{fetch(:fiftyfive_postgresql_database)}.dmp")
146
+ end
147
+
148
+ def remote_dump_file
149
+ "/tmp/#{fetch(:fiftyfive_postgresql_database)}.dmp"
150
+ end
151
+
152
+ def connection_flags
153
+ [
154
+ "-U", fetch(:fiftyfive_postgresql_user),
155
+ "-h", fetch(:fiftyfive_postgresql_host)
156
+ ].join(" ")
157
+ end
158
+
159
+ def with_pgpassfile(&block)
160
+ with(:pgpassfile => fetch(:fiftyfive_postgresql_pgpass_path), &block)
161
+ end
102
162
  end
103
163
  end
@@ -63,8 +63,8 @@ module SSHKit
63
63
  private
64
64
 
65
65
  def write_log_message(log_message)
66
- return unless log_message.verbosity > SSHKit::Logger::INFO
67
- original_output << log_message + "\n"
66
+ return unless log_message.verbosity >= SSHKit::Logger::INFO
67
+ @console.print_line(light_black(" " + log_message.to_s))
68
68
  end
69
69
 
70
70
  def write_command(command)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-fiftyfive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brictson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-03 00:00:00.000000000 Z
11
+ date: 2014-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.2.2
162
+ rubygems_version: 2.4.1
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Additional Capistrano recipes from 55 Minutes