capistrano-migeorge-formatter 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/2 +74 -0
- data/lib/capistrano-migeorge-formatter/version.rb +1 -1
- data/lib/sshkit/formatter/compact.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beeab6d24ebf2d1ee7f4335797317703d1024aeb
|
4
|
+
data.tar.gz: f88f6473e4da569651d3bb27c2b4915f4bb8c7a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d81fd58ebd90864c0e69cbd70ca02bd8987f717ade9bf0f73627f95d0561d0d3e066911f6479c85561e67803a906fe51e7498d96e3bce621d5fcb5384e0bb35c
|
7
|
+
data.tar.gz: 3b56735c98ccbdae276492d3267b77fa8c1bffb671a91a55c3a0af30eaaf28ca9ab6364b8c700f0ce64e6e357704ff09f8d8663ff6dd3e5d866a41e1641f7ff1
|
data/2
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
module SSHKit
|
2
|
+
module Formatter
|
3
|
+
class Compact < Abstract
|
4
|
+
CMD_LEN = 80
|
5
|
+
CMD_SPACE = 10
|
6
|
+
|
7
|
+
def initialize(*args)
|
8
|
+
super
|
9
|
+
@stdout = StringIO.new
|
10
|
+
@stderr = StringIO.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def write(obj)
|
14
|
+
case obj
|
15
|
+
when SSHKit::Command then write_command(obj)
|
16
|
+
when SSHKit::LogMessage then write_log_message(obj)
|
17
|
+
else
|
18
|
+
original_output << c.black(c.on_yellow("Output formatter doesn't know how to handle #{obj.class}\n"))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
alias :<< :write
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def write_command(command)
|
27
|
+
return if command.to_command[0] == '['
|
28
|
+
|
29
|
+
command_start = pretty_command(command)[0..CMD_LEN-1].ljust(CMD_LEN).gsub(/[^\s]{3}$/, '...').ljust(CMD_LEN+CMD_SPACE)
|
30
|
+
|
31
|
+
if !command.started?
|
32
|
+
original_output << c.blue(command_start)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
@stdout << formatted_stream(command.stdout)
|
37
|
+
@stderr << formatted_stream(command.stderr)
|
38
|
+
|
39
|
+
if command.finished?
|
40
|
+
original_output << c.bold { command.failure? ? c.red("\u2718".encode('UTF-8')) : c.green("\u2713".encode('UTF-8')) }
|
41
|
+
original_output << "\n"
|
42
|
+
|
43
|
+
if command.failure?
|
44
|
+
original_output << c.red(command.to_command)
|
45
|
+
end
|
46
|
+
|
47
|
+
original_output << c.green(@stdout.string)
|
48
|
+
original_output << c.red(@stderr.string)
|
49
|
+
|
50
|
+
@stdout = StringIO.new
|
51
|
+
@stderr = StringIO.new
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def write_log_message(log_message)
|
56
|
+
original_output << "\n-> #{log_message.to_s}\n"
|
57
|
+
end
|
58
|
+
|
59
|
+
def c
|
60
|
+
Color
|
61
|
+
end
|
62
|
+
|
63
|
+
def pretty_command(command)
|
64
|
+
"#{command.command} #{command.args.join(' ')}"
|
65
|
+
end
|
66
|
+
|
67
|
+
def formatted_stream(stream)
|
68
|
+
stream.lines.map do |line|
|
69
|
+
"\t#{line}"
|
70
|
+
end.join('\n')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -37,7 +37,7 @@ module SSHKit
|
|
37
37
|
@stderr << formatted_stream(command.stderr)
|
38
38
|
|
39
39
|
if command.finished?
|
40
|
-
|
40
|
+
original_output << c.bold { command.failure? ? c.red("\u2718".encode('UTF-8')) : c.green("\u2713".encode('UTF-8')) }
|
41
41
|
original_output << "\n"
|
42
42
|
|
43
43
|
if command.failure?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-migeorge-formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Palhas
|
@@ -61,6 +61,7 @@ extensions: []
|
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
63
|
- ".gitignore"
|
64
|
+
- '2'
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|