airbrussh 0.3.0 → 0.4.0
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 +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/README.md +1 -0
- data/airbrussh.gemspec +4 -4
- data/lib/airbrussh/command_output.rb +42 -0
- data/lib/airbrussh/console.rb +1 -0
- data/lib/airbrussh/formatter.rb +9 -13
- data/lib/airbrussh/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4190ed3e910f42341fb9f0b011c2344a7e61d319
|
4
|
+
data.tar.gz: 241bd99b747b5547aa323d8d279bda603277a822
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a3f03a76405c5502739ab9de9600608f635c8367e51ccea07bd8de677977d2bf7a7bc1f3644c0a89105ae3577f498331681d2609be3ff33023c71462abc53c9
|
7
|
+
data.tar.gz: b74f8692916139b70407530a83cc8737b3a55c73863569c75bf304bf5595859b63d12c962ed34f240b7cd445d832ab957c7ff61126c913610b0e4fa380b516bc
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
* Your contribution here!
|
4
4
|
|
5
|
+
## 0.4.0 (2015-05-03)
|
6
|
+
|
7
|
+
* Changes to ensure compatibility with the upcoming version of SSHKit ([ec3122b](https://github.com/mattbrictson/airbrussh/commit/ec3122b101de53f2304723da842d5c8b6f70f4f3)).
|
8
|
+
* Explicitly specify UTF-8 encoding for source files, for Ruby 1.9.3 compatibility ([#9](https://github.com/mattbrictson/airbrussh/issues/9)).
|
9
|
+
|
5
10
|
## 0.3.0 (2015-03-28)
|
6
11
|
|
7
12
|
* New `config.banner` option allows startup message to be disabled or changed (suggestion from [@justindowning](https://github.com/justindowning))
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Airbrussh
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/airbrussh)
|
4
|
+
[](https://travis-ci.org/mattbrictson/airbrussh)
|
4
5
|
|
5
6
|
|
6
7
|
**Airbrussh is a replacement log formatter for SSHKit that makes your Capistrano output much easier on the eyes.** Just add it to your Capfile and enjoy concise, useful log output that is easy to read.
|
data/airbrussh.gemspec
CHANGED
@@ -9,10 +9,10 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Matt Brictson"]
|
10
10
|
spec.email = ["airbrussh@mattbrictson.com"]
|
11
11
|
spec.summary = "Airbrussh pretties up your SSHKit and Capistrano output"
|
12
|
-
spec.description = "
|
13
|
-
"
|
14
|
-
"
|
15
|
-
"
|
12
|
+
spec.description = "A replacement log formatter for SSHKit that makes "\
|
13
|
+
"Capistrano output much easier on the eyes. Just add "\
|
14
|
+
"Airbrussh to your Capfile and enjoy concise, useful "\
|
15
|
+
"log output that is easy to read."
|
16
16
|
spec.homepage = "https://github.com/mattbrictson/airbrussh"
|
17
17
|
spec.license = "MIT"
|
18
18
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Airbrussh
|
2
|
+
# A facade that provides access to stdout and stderr command output of
|
3
|
+
# sshkit commands. This is needed to normalize the API differences in
|
4
|
+
# various sshkit versions.
|
5
|
+
class CommandOutput
|
6
|
+
def self.for(command)
|
7
|
+
if command.respond_to?(:clear_stdout_lines)
|
8
|
+
Modern.new(command)
|
9
|
+
else
|
10
|
+
Legacy.new(command)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :command
|
15
|
+
|
16
|
+
def initialize(command)
|
17
|
+
@command = command
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class Legacy < CommandOutput
|
22
|
+
# The stderr/stdout methods provided by the command object have the current
|
23
|
+
# "chunk" as received over the wire. Since there may be more chunks
|
24
|
+
# appended and we don't want to print duplicates, clear the current data.
|
25
|
+
def each_line(stream, &block)
|
26
|
+
output = command.public_send(stream)
|
27
|
+
return if output.empty?
|
28
|
+
output.lines.to_a.each(&block)
|
29
|
+
command.public_send("#{stream}=", "")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class Modern < CommandOutput
|
34
|
+
# Newer versions of sshkit take care of clearing the output with the
|
35
|
+
# clear_stdout_lines/clear_stderr_lines methods.
|
36
|
+
def each_line(stream, &block)
|
37
|
+
lines = command.public_send("clear_#{stream}_lines")
|
38
|
+
return if lines.join.empty?
|
39
|
+
lines.each(&block)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/airbrussh/console.rb
CHANGED
data/lib/airbrussh/formatter.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require "airbrussh/command_output"
|
1
3
|
require "airbrussh/console"
|
2
4
|
require "colorize"
|
3
5
|
require "ostruct"
|
@@ -78,8 +80,8 @@ module Airbrussh
|
|
78
80
|
|
79
81
|
def write(obj)
|
80
82
|
# SSHKit's :pretty formatter mutates the stdout and stderr data in the
|
81
|
-
# command obj. So we need to
|
82
|
-
@log_file_formatter << obj
|
83
|
+
# command obj. So we need to clone it to ensure our copy is unscathed.
|
84
|
+
@log_file_formatter << deep_copy(obj)
|
83
85
|
|
84
86
|
case obj
|
85
87
|
when SSHKit::Command then write_command(obj)
|
@@ -135,20 +137,10 @@ module Airbrussh
|
|
135
137
|
# Use a bit of meta-programming here, since stderr and stdout logic
|
136
138
|
# are identical except for different method names.
|
137
139
|
%w(stderr stdout).each do |stream|
|
138
|
-
|
139
140
|
next unless config.public_send("command_output_#{stream}?")
|
140
|
-
|
141
|
-
next if output.empty?
|
142
|
-
|
143
|
-
output.lines.each do |line|
|
141
|
+
CommandOutput.for(command).each_line(stream) do |line|
|
144
142
|
print_line " #{number} #{line.chomp}"
|
145
143
|
end
|
146
|
-
|
147
|
-
# The stderr/stdout data provided by the command object is the current
|
148
|
-
# "chunk" as received over the wire. Since there may be more chunks
|
149
|
-
# appended and we don't want to print duplicates, clear the current
|
150
|
-
# data.
|
151
|
-
command.public_send("#{stream}=", "")
|
152
144
|
end
|
153
145
|
end
|
154
146
|
|
@@ -233,5 +225,9 @@ module Airbrussh
|
|
233
225
|
def config
|
234
226
|
Airbrussh.configuration
|
235
227
|
end
|
228
|
+
|
229
|
+
def deep_copy(obj)
|
230
|
+
Marshal.load(Marshal.dump(obj))
|
231
|
+
end
|
236
232
|
end
|
237
233
|
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: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brictson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03
|
11
|
+
date: 2015-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sshkit
|
@@ -86,8 +86,8 @@ dependencies:
|
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
|
-
description:
|
90
|
-
|
89
|
+
description: A replacement log formatter for SSHKit that makes Capistrano output much
|
90
|
+
easier on the eyes. Just add Airbrussh to your Capfile and enjoy concise, useful
|
91
91
|
log output that is easy to read.
|
92
92
|
email:
|
93
93
|
- airbrussh@mattbrictson.com
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- demo.gif
|
109
109
|
- lib/airbrussh.rb
|
110
110
|
- lib/airbrussh/capistrano.rb
|
111
|
+
- lib/airbrussh/command_output.rb
|
111
112
|
- lib/airbrussh/configuration.rb
|
112
113
|
- lib/airbrussh/console.rb
|
113
114
|
- lib/airbrussh/formatter.rb
|
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
134
|
version: '0'
|
134
135
|
requirements: []
|
135
136
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.4.
|
137
|
+
rubygems_version: 2.4.5
|
137
138
|
signing_key:
|
138
139
|
specification_version: 4
|
139
140
|
summary: Airbrussh pretties up your SSHKit and Capistrano output
|