cap-ec2 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Cap-EC2 changelog
2
2
 
3
+ ## 0.0.16
4
+
5
+ * Don't colorize status table output if STDOUT is not a TTY. [@jcoglan](https://github.com/jcoglan)
6
+
3
7
  ## 0.0.15
4
8
 
5
9
  * Add `ec2_filter_by_status_ok?` to filter out instances that aren't returning `OK`
@@ -9,14 +9,14 @@ module CapEC2
9
9
 
10
10
  def header_row
11
11
  [
12
- "Num".bold,
13
- "Name".bold,
14
- "ID".bold,
15
- "Type".bold,
16
- "DNS".bold,
17
- "Zone".bold,
18
- "Roles".bold,
19
- "Stages".bold
12
+ bold("Num"),
13
+ bold("Name"),
14
+ bold("ID"),
15
+ bold("Type"),
16
+ bold("DNS"),
17
+ bold("Zone"),
18
+ bold("Roles"),
19
+ bold("Stages")
20
20
  ]
21
21
  end
22
22
 
@@ -38,15 +38,28 @@ module CapEC2
38
38
  def instance_to_row(instance, index)
39
39
  [
40
40
  sprintf("%02d:", index),
41
- (instance.tags["Name"] || '').green,
42
- instance.id.red,
43
- instance.instance_type.cyan,
44
- CapEC2::Utils.contact_point(instance).blue.bold,
45
- instance.availability_zone.magenta,
46
- instance.tags[roles_tag].yellow,
47
- instance.tags[stages_tag].yellow
41
+ green(instance.tags["Name"] || ''),
42
+ red(instance.id),
43
+ cyan(instance.instance_type),
44
+ bold(blue(CapEC2::Utils.contact_point(instance))),
45
+ magenta(instance.availability_zone),
46
+ yellow(instance.tags[roles_tag]),
47
+ yellow(instance.tags[stages_tag])
48
48
  ]
49
49
  end
50
+
51
+ private
52
+
53
+ (Colored::COLORS.keys + Colored::EXTRAS.keys).each do |format|
54
+ define_method(format) do |string|
55
+ if $stdout.tty?
56
+ string.__send__(format)
57
+ else
58
+ string
59
+ end
60
+ end
61
+ end
62
+
50
63
  end
51
64
  end
52
65
 
@@ -1,3 +1,3 @@
1
1
  module CapEC2
2
- VERSION = '0.0.15'
2
+ VERSION = '0.0.16'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-ec2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-07 00:00:00.000000000 Z
13
+ date: 2014-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -145,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  segments:
147
147
  - 0
148
- hash: -187489000278530207
148
+ hash: 2024231783545522986
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  segments:
156
156
  - 0
157
- hash: -187489000278530207
157
+ hash: 2024231783545522986
158
158
  requirements: []
159
159
  rubyforge_project:
160
160
  rubygems_version: 1.8.23