ec2ctl 0.7.5 → 0.7.6

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: 1780272a477fc467f09af1e6dc05b1de0551537e
4
- data.tar.gz: 084fd0afb37bd43d7184dddaeb9f20f0292a01bd
3
+ metadata.gz: ef20c7f1644eb97cc35e3d55f1aae7e368d03423
4
+ data.tar.gz: b19989f470da8ac2d2fdd43606cecf54bd303668
5
5
  SHA512:
6
- metadata.gz: 4163adc52ecd782a71eaf0c0454dcaf312854ced6ad6f6df8db1489e2ef86004e007c4164b392d4e316a31cfef5d813f2251783fb3011fd4a3dc3146f71fe9da
7
- data.tar.gz: 187654ae1870c5af8302ba5357c8ac41ce29ccc373b200281a2b786767c7208a93c725659f38bd8bc1a36fa866d58f8b40d12ef15c15f03b4c590392f6192a3c
6
+ metadata.gz: a9d63876e884810227e292d88d80d8258550f9bf1412b64585592b088dc9659a389b198972adac166682829b3d5f5d51725e4b4db066722e856bf649d1287d76
7
+ data.tar.gz: ed7c9fd3b1ba62892b69b7021fda5eac29a713ed546993eb4e55375192a89d90d402fee64cd856fa0aa5e3ce63b7ddb9cadf9b1414f1aa243c3a62e0a664aff5
data/lib/ec2ctl/cli.rb CHANGED
@@ -44,10 +44,11 @@ module EC2Ctl
44
44
  else
45
45
  case options.format
46
46
  when /table/i
47
- say Terminal::Table.new(
48
- headings: attributes,
49
- rows: instance_infos.map {|i| attributes.map {|a| i[a]}}
50
- )
47
+ say tableize(attributes, instance_infos)
48
+ when /markdown/i
49
+ say tableize(attributes, instance_infos, :markdown)
50
+ when /backlog/i
51
+ say tableize(attributes, instance_infos, :backlog)
51
52
  when /json/i
52
53
  say JSON.pretty_generate(instance_infos)
53
54
  when /yaml/i
@@ -64,6 +65,27 @@ module EC2Ctl
64
65
 
65
66
  private
66
67
 
68
+ def tableize(attributes, instance_infos, mode = nil)
69
+ table = Terminal::Table.new(
70
+ headings: attributes,
71
+ rows: instance_infos.map {|i| attributes.map {|a| i[a]}}
72
+ )
73
+
74
+ case mode
75
+ when :markdown
76
+ lines = table.to_s.lines[1..-2]
77
+ lines[1].gsub!("+", "|")
78
+ lines.join
79
+ when :backlog
80
+ lines = table.to_s.lines[1..-2]
81
+ lines[0].sub!("\n", "h\n")
82
+ lines[1] = nil
83
+ lines.compact.join
84
+ else
85
+ table
86
+ end
87
+ end
88
+
67
89
  def client
68
90
  @client
69
91
  end
@@ -1,3 +1,3 @@
1
1
  module EC2Ctl
2
- VERSION = "0.7.5"
2
+ VERSION = "0.7.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2ctl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - y13i
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander