railbow 0.4.0 → 0.6.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/CHANGELOG.md +66 -0
- data/README.md +79 -1
- data/lib/railbow/config.rb +3 -1
- data/lib/railbow/demo/status_demo.rb +5 -3
- data/lib/railbow/init.rb +16 -0
- data/lib/railbow/multi_db.rb +87 -0
- data/lib/railbow/params.rb +54 -0
- data/lib/railbow/status/ghosts.rb +144 -0
- data/lib/railbow/status/git_data.rb +327 -0
- data/lib/railbow/status/help.rb +121 -0
- data/lib/railbow/status/printer.rb +336 -0
- data/lib/railbow/status/section.rb +562 -0
- data/lib/railbow/table/column.rb +14 -2
- data/lib/railbow/table/renderer.rb +158 -19
- data/lib/railbow/tasks/migrate_status.rake +30 -756
- data/lib/railbow/text_utils.rb +30 -0
- data/lib/railbow/version.rb +1 -1
- metadata +7 -1
data/lib/railbow/text_utils.rb
CHANGED
|
@@ -26,5 +26,35 @@ module Railbow
|
|
|
26
26
|
end
|
|
27
27
|
"#{truncated}..."
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
# ANSI-aware counterpart to truncate_str: escape codes pass through
|
|
31
|
+
# unmeasured, and a color left open at the cut is closed before the
|
|
32
|
+
# ellipsis so it cannot leak into whatever follows the cell.
|
|
33
|
+
def truncate_ansi(str, max_width)
|
|
34
|
+
s = str.to_s
|
|
35
|
+
return s if display_width(strip_ansi(s)) <= max_width
|
|
36
|
+
|
|
37
|
+
result = +""
|
|
38
|
+
width = 0
|
|
39
|
+
open_color = false
|
|
40
|
+
i = 0
|
|
41
|
+
while i < s.length
|
|
42
|
+
if s[i] == "\e" && (close = s.index("m", i))
|
|
43
|
+
code = s[i..close]
|
|
44
|
+
result << code
|
|
45
|
+
open_color = (code != "\e[0m")
|
|
46
|
+
i = close + 1
|
|
47
|
+
else
|
|
48
|
+
ch = s[i]
|
|
49
|
+
ch_width = display_width(ch)
|
|
50
|
+
break if width + ch_width > max_width - 3
|
|
51
|
+
result << ch
|
|
52
|
+
width += ch_width
|
|
53
|
+
i += 1
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
result << "\e[0m" if open_color
|
|
57
|
+
"#{result}..."
|
|
58
|
+
end
|
|
29
59
|
end
|
|
30
60
|
end
|
data/lib/railbow/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: railbow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eugene M
|
|
@@ -92,6 +92,7 @@ files:
|
|
|
92
92
|
- lib/railbow/logo.rb
|
|
93
93
|
- lib/railbow/migration_formatter.rb
|
|
94
94
|
- lib/railbow/migration_parser.rb
|
|
95
|
+
- lib/railbow/multi_db.rb
|
|
95
96
|
- lib/railbow/name_collision_resolver.rb
|
|
96
97
|
- lib/railbow/name_formatter.rb
|
|
97
98
|
- lib/railbow/notes_formatter.rb
|
|
@@ -99,6 +100,11 @@ files:
|
|
|
99
100
|
- lib/railbow/railtie.rb
|
|
100
101
|
- lib/railbow/routes_formatter.rb
|
|
101
102
|
- lib/railbow/stats_formatter.rb
|
|
103
|
+
- lib/railbow/status/ghosts.rb
|
|
104
|
+
- lib/railbow/status/git_data.rb
|
|
105
|
+
- lib/railbow/status/help.rb
|
|
106
|
+
- lib/railbow/status/printer.rb
|
|
107
|
+
- lib/railbow/status/section.rb
|
|
102
108
|
- lib/railbow/table.rb
|
|
103
109
|
- lib/railbow/table/column.rb
|
|
104
110
|
- lib/railbow/table/renderer.rb
|