airbrussh 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +89 -123
- data/UPGRADING-CAP-3.5.md +1 -1
- data/demo.gif +0 -0
- data/formatting.png +0 -0
- data/lib/airbrussh/capistrano/tasks.rb +2 -1
- data/lib/airbrussh/command_formatter.rb +3 -3
- data/lib/airbrussh/rake/context.rb +8 -1
- data/lib/airbrussh/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58dc91f927b5a666da9937a9b2645aeedb63dda0
|
4
|
+
data.tar.gz: c11b7735895deeecf2033856e9ce908850f21031
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91dd2ec74fbf99452f8a81e54dae332add830e11d71b76c536f08a35298e9eb7d1f54724f8705686f35ca29bbf0b90e6a2d382a70954e9420c897b43c706c363
|
7
|
+
data.tar.gz: 0b6938a668435f82acd1b37f5a5f75a63ffffcf8de9577357a02a06b0d03db42059f33c10c7a071e25f7cde5892845286f8519bd878d2801d3afedb33dbd0e48
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file. This projec
|
|
6
6
|
|
7
7
|
* Your contribution here!
|
8
8
|
|
9
|
+
## [1.0.2][] (2016-05-13)
|
10
|
+
|
11
|
+
* Fix a crash that can happen in certain multi-server deployments when
|
12
|
+
Capistrano's `invoke` is used to switch Rake tasks in the middle of SSHKit
|
13
|
+
execution ([#78](https://github.com/mattbrictson/airbrussh/issues/78),
|
14
|
+
[#80](https://github.com/mattbrictson/airbrussh/pull/80))
|
15
|
+
|
9
16
|
## [1.0.1][] (2016-03-21)
|
10
17
|
|
11
18
|
* Fix support for fake TTYs reporting a 0 width console like Ruby's PTY library [#76](https://github.com/mattbrictson/airbrussh/pull/76)
|
@@ -99,7 +106,8 @@ There are, however, many behind-the-scenes changes and improvements to overall c
|
|
99
106
|
* Initial release
|
100
107
|
|
101
108
|
[Semver]: http://semver.org
|
102
|
-
[Unreleased]: https://github.com/mattbrictson/airbrussh/compare/v1.0.
|
109
|
+
[Unreleased]: https://github.com/mattbrictson/airbrussh/compare/v1.0.2...HEAD
|
110
|
+
[1.0.2]: https://github.com/mattbrictson/airbrussh/compare/v1.0.1...v1.0.2
|
103
111
|
[1.0.1]: https://github.com/mattbrictson/airbrussh/compare/v1.0.0...v1.0.1
|
104
112
|
[1.0.0]: https://github.com/mattbrictson/airbrussh/compare/v1.0.0.beta1...v1.0.0
|
105
113
|
[1.0.0.beta1]: https://github.com/mattbrictson/airbrussh/compare/v0.8.0...v1.0.0.beta1
|
data/README.md
CHANGED
@@ -7,191 +7,157 @@
|
|
7
7
|
[![Coverage Status](https://coveralls.io/repos/mattbrictson/airbrussh/badge.svg?branch=master)](https://coveralls.io/r/mattbrictson/airbrussh?branch=master)
|
8
8
|
|
9
9
|
|
10
|
-
|
10
|
+
Airbrussh is a concise log formatter for Capistrano and SSHKit. It displays well-formatted, useful log output that is easy to read. Airbrussh also saves Capistrano's verbose output to a separate log file just in case you need additional details for troubleshooting.
|
11
11
|
|
12
|
-
|
12
|
+
**As of April 2016, Airbrussh is bundled with Capistrano 3.5, and is Capistrano's default formatter! There is nothing additional to install or enable.** Continue reading to learn more about Airbrussh's features and configuration options.
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
For more details on how exactly Airbrussh changes Capistrano's output and the reasoning behind it, check out the blog post: [Introducing Airbrussh](https://mattbrictson.com/airbrussh).
|
14
|
+
If you aren't yet using Capistrano 3.5 (or wish to use Airbrussh with SSHKit directly), refer to the [advanced/legacy usage](#advancedlegacy-usage) section for installation instructions.
|
17
15
|
|
18
|
-
|
16
|
+
![Sample output](https://raw.github.com/mattbrictson/airbrussh/master/demo.gif)
|
19
17
|
|
20
|
-
|
18
|
+
For more details on how exactly Airbrussh affects Capistrano's output and the reasoning behind it, check out the blog post: [Introducing Airbrussh](https://mattbrictson.com/airbrussh).
|
21
19
|
|
22
|
-
|
20
|
+
-----
|
23
21
|
|
24
|
-
|
22
|
+
* [Usage](#usage)
|
23
|
+
* [Configuration](#configuration)
|
24
|
+
* [FAQ](#faq)
|
25
|
+
* [Advanced/legacy usage](#advancedlegacy-usage)
|
25
26
|
|
26
|
-
##
|
27
|
+
## Usage
|
27
28
|
|
28
|
-
|
29
|
+
Airbrussh is enabled by default in Capistrano 3.5 and newer. To manually enable Airbrussh (for example, when upgrading an existing project), set the Capistrano format like this:
|
29
30
|
|
30
31
|
```ruby
|
31
|
-
|
32
|
+
# In deploy.rb
|
33
|
+
set :format, :airbrussh
|
32
34
|
```
|
33
35
|
|
34
|
-
|
36
|
+
### What's displayed
|
35
37
|
|
36
|
-
|
38
|
+
When you run a Capistrano command, Airbrussh provides the following information in its output:
|
37
39
|
|
38
|
-
|
40
|
+
![Sample output](https://raw.github.com/mattbrictson/airbrussh/master/formatting.png)
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
* Name of Capistrano task being executed
|
43
|
+
* When each task started (minutes:seconds elapsed since the deploy began)
|
44
|
+
* The SSH command-line strings that are executed; for Capistrano tasks that involve running multiple commands, the numeric prefix indicates the command in the sequence, starting from `01`
|
45
|
+
* Stdout and stderr output from each command
|
46
|
+
* The duration of each command execution, per server
|
43
47
|
|
44
|
-
|
48
|
+
### What's *not* displayed
|
45
49
|
|
46
|
-
|
47
|
-
# Remove this
|
48
|
-
set :format, :pretty
|
49
|
-
```
|
50
|
+
For brevity, Airbrussh does not show *everything* that Capistrano is doing. For example, it will omit Capistrano's `test` commands, which can be noisy and confusing. Airbrussh also hides things like environment variables, as well as `cd` and `env` invocations. To see a full audit of Capistrano's execution, including *exactly* what commands were run on each server, look at `log/capistrano.log`.
|
50
51
|
|
51
|
-
##
|
52
|
+
## Configuration
|
52
53
|
|
53
|
-
|
54
|
+
You can customize many aspects of Airbrussh's output. In Capistrano 3.5 and newer, this is done via the `:format_options` variable, like this:
|
54
55
|
|
55
|
-
|
56
|
+
```ruby
|
57
|
+
# Pass options to Airbrussh
|
58
|
+
set :format_options, color: false, truncate: 80
|
59
|
+
```
|
56
60
|
|
57
|
-
|
58
|
-
|
59
|
-
|
61
|
+
Here are the options you can use, and their effects (note that the defaults may be different depending on where Airbrussh is used; these are the defaults used by Capistrano 3.5):
|
62
|
+
|
63
|
+
|Option|Default|Usage|
|
64
|
+
|---|---|---|
|
65
|
+
|`banner`|`nil`|Provide a string (e.g. "Capistrano started!") that will be printed when Capistrano starts up.|
|
66
|
+
|`color`|`:auto`|Use `true` or `false` to enable or disable ansi color. If set to `:auto`, Airbrussh automatically uses color based on whether the output is a TTY, or if the SSHKIT_COLOR environment variable is set.|
|
67
|
+
|`command_output`|`true`|Set to `:stdout`, `:stderr`, or `true` to display the SSH output received via stdout, stderr, or both, respectively. Set to `false` to not show any SSH output, for a minimal look.|
|
68
|
+
|`log_file`|`log/capistrano.log`|Capistrano's verbose output is saved to this file to facilitate debugging. Set to `nil` to disable completely.|
|
69
|
+
|`truncate`|`:auto`|Set to a number (e.g. 80) to truncate the width of the output to that many characters, or `false` to disable truncation. If `:auto`, output is automatically truncated to the width of the terminal window, if it can be determined.|
|
60
70
|
|
61
71
|
## FAQ
|
62
72
|
|
63
73
|
**Airbrussh is not displaying the output of my commands! For example, I run `tail` in one of my capistrano tasks and airbrussh doesn't show anything. How do I fix this?**
|
64
74
|
|
65
|
-
|
75
|
+
Make sure Airbrussh is configured to show SSH output.
|
66
76
|
|
67
77
|
```ruby
|
68
|
-
|
69
|
-
config.command_output = true
|
70
|
-
end
|
78
|
+
set :format_options, command_output: true
|
71
79
|
```
|
72
80
|
|
73
|
-
**
|
81
|
+
**I haven't upgraded to Capistrano 3.5 yet. Can I still use Airbrussh?**
|
82
|
+
|
83
|
+
Yes! Capistrano 3.4.x is also supported. Refer to the [advanced/legacy usage](#advancedlegacy-usage) section for installation instructions.
|
74
84
|
|
75
|
-
|
85
|
+
**Does Airbrussh work with Capistrano 2?**
|
76
86
|
|
77
|
-
|
87
|
+
No, Capistrano 3 is required. We recommend Capistrano 3.4.0 or higher. Capistrano 3.5.0 and higher have Airbrussh enabled by default, with no installation needed.
|
78
88
|
|
79
|
-
|
89
|
+
**Does Airbrussh work with JRuby?**
|
90
|
+
|
91
|
+
JRuby is not officially supported or tested, but may work. You must disable automatic truncation to work around a known bug in the JRuby 9.0 standard library. See [#62](https://github.com/mattbrictson/airbrussh/issues/62) for more details.
|
80
92
|
|
81
93
|
```ruby
|
82
|
-
|
83
|
-
# Disable automatic truncation for JRuby compatibility
|
84
|
-
config.truncate = false
|
85
|
-
end
|
94
|
+
set :format_options, truncate: false
|
86
95
|
```
|
87
96
|
|
88
97
|
**I have a question that’s not answered here or elsewhere in the README.**
|
89
98
|
|
90
99
|
Please [open a GitHub issue](https://github.com/mattbrictson/airbrussh/issues/new) and we’ll be happy to help!
|
91
100
|
|
92
|
-
## Advanced
|
101
|
+
## Advanced/legacy usage
|
93
102
|
|
94
|
-
Airbrussh
|
103
|
+
Although Airbrussh is built into Capistrano 3.5.0 and higher, it is also available as a plug-in for older versions. Airbrussh has been tested with MRI 1.9+, Capistrano 3.4.0+, and SSHKit 1.6.1+.
|
104
|
+
|
105
|
+
### Capistrano 3.4.x
|
106
|
+
|
107
|
+
Add this line to your application's Gemfile:
|
95
108
|
|
96
109
|
```ruby
|
97
|
-
|
98
|
-
# Capistrano's default, un-airbrusshed output is saved to a file to
|
99
|
-
# facilitate debugging.
|
100
|
-
#
|
101
|
-
# To disable this entirely:
|
102
|
-
# config.log_file = nil
|
103
|
-
#
|
104
|
-
# Default:
|
105
|
-
config.log_file = "log/capistrano.log"
|
106
|
-
|
107
|
-
# Airbrussh patches Rake so it can access the name of the currently executing
|
108
|
-
# task. Set this to false if monkey patching is causing issues.
|
109
|
-
#
|
110
|
-
# Default:
|
111
|
-
config.monkey_patch_rake = true
|
112
|
-
|
113
|
-
# Ansi colors will be used in the output automatically based on whether the
|
114
|
-
# output is a TTY, or if the SSHKIT_COLOR environment variable is set.
|
115
|
-
#
|
116
|
-
# To disable color always:
|
117
|
-
# config.color = false
|
118
|
-
#
|
119
|
-
# Default:
|
120
|
-
config.color = :auto
|
121
|
-
|
122
|
-
# Output is automatically truncated to the width of the terminal window, if
|
123
|
-
# possible. If the width of the terminal can't be determined, no truncation
|
124
|
-
# is performed.
|
125
|
-
#
|
126
|
-
# To truncate to a fixed width:
|
127
|
-
# config.truncate = 80
|
128
|
-
#
|
129
|
-
# Or to disable truncation entirely:
|
130
|
-
# config.truncate = false
|
131
|
-
#
|
132
|
-
# Default:
|
133
|
-
config.truncate = :auto
|
134
|
-
|
135
|
-
# If a log_file is configured, airbrussh will output a message at startup
|
136
|
-
# displaying the log_file location.
|
137
|
-
#
|
138
|
-
# To always disable this message:
|
139
|
-
# config.banner = false
|
140
|
-
#
|
141
|
-
# To display an alternative message:
|
142
|
-
# config.banner = "Hello, world!"
|
143
|
-
#
|
144
|
-
# Default:
|
145
|
-
config.banner = :auto
|
146
|
-
|
147
|
-
# You can control whether airbrussh shows the output of SSH commands. For
|
148
|
-
# brevity, the output is hidden by default.
|
149
|
-
#
|
150
|
-
# Display stdout of SSH commands. Stderr is not displayed.
|
151
|
-
# config.command_output = :stdout
|
152
|
-
#
|
153
|
-
# Display stderr of SSH commands. Stdout is not displayed.
|
154
|
-
# config.command_output = :stderr
|
155
|
-
#
|
156
|
-
# Display all SSH command output.
|
157
|
-
# config.command_output = [:stdout, :stderr]
|
158
|
-
# or
|
159
|
-
# config.command_output = true
|
160
|
-
#
|
161
|
-
# Default (all output suppressed):
|
162
|
-
config.command_output = false
|
163
|
-
end
|
110
|
+
gem "airbrussh", require: false
|
164
111
|
```
|
165
112
|
|
166
|
-
|
113
|
+
And then execute:
|
167
114
|
|
168
|
-
|
115
|
+
$ bundle
|
116
|
+
|
117
|
+
Finally, add this line to your application's Capfile:
|
169
118
|
|
170
119
|
```ruby
|
171
|
-
require "airbrussh"
|
172
|
-
SSHKit.config.output = Airbrussh::Formatter.new($stdout)
|
120
|
+
require "airbrussh/capistrano"
|
173
121
|
```
|
174
122
|
|
175
|
-
|
123
|
+
**Important:** explicitly setting Capistrano's `:format` option in your deploy.rb will override airbrussh. Remove this line if you have it:
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
# Remove this
|
127
|
+
set :format, :pretty
|
128
|
+
```
|
129
|
+
|
130
|
+
Capistrano 3.4.x doesn't have the `:format_options` configuration system, so you will need to configure Airbrussh using this technique:
|
176
131
|
|
177
132
|
```ruby
|
178
133
|
Airbrussh.configure do |config|
|
179
|
-
config.
|
180
|
-
config.
|
181
|
-
|
182
|
-
config.truncate = :auto
|
183
|
-
config.banner = :auto
|
184
|
-
config.command_output = false
|
134
|
+
config.color = false
|
135
|
+
config.command_output = true
|
136
|
+
# etc.
|
185
137
|
end
|
186
138
|
```
|
187
139
|
|
140
|
+
Refer to the [configuration](#configuration) section above for the list of supported options.
|
141
|
+
|
142
|
+
### SSHKit
|
143
|
+
|
144
|
+
If you are using SSHKit directly (i.e. without Capistrano), you can use Airbrussh like this:
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
require "airbrussh"
|
148
|
+
SSHKit.config.output = Airbrussh::Formatter.new($stdout)
|
149
|
+
|
150
|
+
# You can also pass configuration options like this
|
151
|
+
SSHKit.config.output = Airbrussh::Formatter.new($stdout, color: false)
|
152
|
+
```
|
153
|
+
|
188
154
|
## History
|
189
155
|
|
190
|
-
Airbrussh started life as custom logging code within the [capistrano-mb][] collection of opinionated Capistrano recipes. In February 2015, the logging code was refactored into a standalone gem with its own configuration and documentation, and renamed `airbrussh`.
|
156
|
+
Airbrussh started life as custom logging code within the [capistrano-mb][] collection of opinionated Capistrano recipes. In February 2015, the logging code was refactored into a standalone gem with its own configuration and documentation, and renamed `airbrussh`. In February 2016, Airbrussh was added as the default formatter in Capistrano 3.5.0.
|
191
157
|
|
192
158
|
## Roadmap
|
193
159
|
|
194
|
-
Airbrussh now has a stable feature set, excellent test coverage, is being used for production deployments, and has reached 1.0.0!
|
160
|
+
Airbrussh now has a stable feature set, excellent test coverage, is being used for production deployments, and has reached 1.0.0! If you have ideas for improvements to Airbrussh, please open a [GitHub issue](https://github.com/mattbrictson/airbrussh/issues/new).
|
195
161
|
|
196
162
|
## Contributing
|
197
163
|
|
data/UPGRADING-CAP-3.5.md
CHANGED
@@ -40,7 +40,7 @@ Capistrano 3.5.0 changes Airbrussh defaults as follows:
|
|
40
40
|
Therefore, after upgrading to Capistrano 3.5.0, you may notice Airbrussh's output has changed and become more verbose. To restore the defaults to what you were used to in older versions, do this:
|
41
41
|
|
42
42
|
```ruby
|
43
|
-
set :format_options, banner: auto, command_output: false
|
43
|
+
set :format_options, banner: :auto, command_output: false
|
44
44
|
```
|
45
45
|
|
46
46
|
## Trouble?
|
data/demo.gif
CHANGED
Binary file
|
data/formatting.png
ADDED
Binary file
|
@@ -66,7 +66,8 @@ module Airbrussh
|
|
66
66
|
red("WARNING: airbrussh/capistrano must be loaded by Capistrano in "\
|
67
67
|
"order to work.\nRequire this gem within your application's "\
|
68
68
|
"Capfile, as described here:\n"\
|
69
|
-
"https://github.com/mattbrictson/airbrussh#installation")
|
69
|
+
"https://github.com/mattbrictson/airbrussh#installation")
|
70
|
+
)
|
70
71
|
end
|
71
72
|
|
72
73
|
def err_console
|
@@ -8,8 +8,8 @@ module Airbrussh
|
|
8
8
|
# command's position within currently executing rake task:
|
9
9
|
#
|
10
10
|
# * position - zero-based position of this command in the list of
|
11
|
-
# all commands that have been run in the current rake task
|
12
|
-
#
|
11
|
+
# all commands that have been run in the current rake task; in
|
12
|
+
# some cases this could be nil
|
13
13
|
class CommandFormatter < SimpleDelegator
|
14
14
|
include Airbrussh::Colors
|
15
15
|
|
@@ -72,7 +72,7 @@ module Airbrussh
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def number
|
75
|
-
format("%02d", @position + 1)
|
75
|
+
format("%02d", @position.to_i + 1)
|
76
76
|
end
|
77
77
|
|
78
78
|
def success_message
|
@@ -8,6 +8,12 @@ module Airbrussh
|
|
8
8
|
# which can be disabled via by setting
|
9
9
|
# Airbrussh.configuration.monkey_patch_rake = false.
|
10
10
|
#
|
11
|
+
# Note that this class is not thread-safe. Normally this is not a problem,
|
12
|
+
# but some Capistrano users are known to use `invoke` to switch the Rake
|
13
|
+
# task in the middle of an SSHKit thread, which causes Context to get very
|
14
|
+
# confused. It such scenarios Context is not reliable and may return `nil`
|
15
|
+
# for the `position` of a command.
|
16
|
+
#
|
11
17
|
class Context
|
12
18
|
def initialize(config=Airbrussh.configuration)
|
13
19
|
@history = []
|
@@ -37,7 +43,8 @@ module Airbrussh
|
|
37
43
|
first_execution
|
38
44
|
end
|
39
45
|
|
40
|
-
# The position of the specified command in the current rake
|
46
|
+
# The zero-based position of the specified command in the current rake
|
47
|
+
# task. May be `nil` in certain multi-threaded scenarios, so be careful!
|
41
48
|
def position(command)
|
42
49
|
history.index(command.to_s)
|
43
50
|
end
|
data/lib/airbrussh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrussh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brictson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sshkit
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- bin/setup
|
156
156
|
- bin/test_all.rb
|
157
157
|
- demo.gif
|
158
|
+
- formatting.png
|
158
159
|
- lib/airbrussh.rb
|
159
160
|
- lib/airbrussh/capistrano.rb
|
160
161
|
- lib/airbrussh/capistrano/tasks.rb
|
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
190
|
version: '0'
|
190
191
|
requirements: []
|
191
192
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.6.
|
193
|
+
rubygems_version: 2.6.4
|
193
194
|
signing_key:
|
194
195
|
specification_version: 4
|
195
196
|
summary: Airbrussh pretties up your SSHKit and Capistrano output
|