command_line_reporter 3.3.2 → 3.3.3

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: 70b105043b926d8fe9982dd151dbd89b807acb9f
4
- data.tar.gz: b17932bb401b9d61306b5051d4117737e9352e40
3
+ metadata.gz: 7af9e346471d5d64eb47ae615f8727bec71f8d1d
4
+ data.tar.gz: 1c3b3a8d4d997968627565d3eac3e8085fc98d1b
5
5
  SHA512:
6
- metadata.gz: 9db40ad21b9d21c086148e956e837539c7391c2702c8ab013c8cdda1dc88b80b81c6b1590fd900f069d44471f55906691aff4eeaa3819af6981b846d249089a5
7
- data.tar.gz: 32fdbf5b68a00ed8dbcc9cd49e9fb8431f7acdca1121f7da8cf830a53579983f96efb83c1a7782bac79a19d1f8d01877da920f787be2e4c6f8b12878e0be665d
6
+ metadata.gz: 92a0e813eb7187cc98ba1085c2496186ba1d2079c07bcae14bb72beb9705549356ec10a6b4e0ada12f7bfb583b4707db70b17df87fdb57bac706d54625c346d1
7
+ data.tar.gz: 05dc7b7167b5b3dcdf21cd70814d1847078bd858d99345215e99ad53a69e7dc7f062e36b594b81c89660498789c0840503f1e37607a358ca2160ad992c8d9bca
@@ -2,7 +2,7 @@ module CommandLineReporter
2
2
  class Row
3
3
  include OptionsValidator
4
4
 
5
- VALID_OPTIONS = [:header, :color, :bold, :encoding]
5
+ VALID_OPTIONS = [:header, :color, :border_color, :bold, :encoding]
6
6
  attr_accessor :columns, :border, *VALID_OPTIONS
7
7
 
8
8
  def initialize(options = {})
@@ -12,6 +12,7 @@ module CommandLineReporter
12
12
  self.border = false
13
13
  self.header = options[:header] || false
14
14
  self.color = options[:color]
15
+ self.border_color = options[:border_color]
15
16
  self.bold = options[:bold] || false
16
17
  self.encoding = options[:encoding] || :unicode
17
18
  end
@@ -31,6 +32,7 @@ module CommandLineReporter
31
32
  def output
32
33
  screen_count.times do |sr|
33
34
  border_char = use_utf8? ? "\u2503" : '|'
35
+ border_char = border_char.send(self.border_color) if self.border_color
34
36
 
35
37
  line = (self.border) ? "#{border_char} " : ''
36
38
 
@@ -44,7 +46,7 @@ module CommandLineReporter
44
46
  # c1.screen_rows.size == 5
45
47
  # c2.screen_rows.size == 2
46
48
  #
47
- # So when we don't have a screen row for c2 we need to fill the screen with the
49
+ # So when we don't have a screen row for c2 we need to fill the screen with the
48
50
  # proper number of blanks so the layout looks like (parenthesis on the right just
49
51
  # indicate screen row index)
50
52
  #
@@ -56,12 +58,15 @@ module CommandLineReporter
56
58
  # | xxxxxxxxxxx | | (4)
57
59
  # +-------------+------------+
58
60
  if col.screen_rows[sr].nil?
59
- line << ' ' * col.width
61
+ line << ' ' * col.width << ' '
60
62
  else
61
- line << self.columns[mc].screen_rows[sr]
63
+ line << self.columns[mc].screen_rows[sr] << ' '
62
64
  end
63
65
 
64
- line << ' ' + ((self.border) ? "#{border_char} " : '')
66
+ if self.border
67
+ line << border_char
68
+ line << ' ' if mc < self.columns.size - 1
69
+ end
65
70
  end
66
71
 
67
72
  puts line
@@ -2,13 +2,14 @@ module CommandLineReporter
2
2
  class Table
3
3
  include OptionsValidator
4
4
 
5
- VALID_OPTIONS = [:border, :width, :encoding]
5
+ VALID_OPTIONS = [:border, :border_color, :width, :encoding]
6
6
  attr_accessor :rows, *VALID_OPTIONS
7
7
 
8
8
  def initialize(options = {})
9
9
  self.validate_options(options, *VALID_OPTIONS)
10
10
 
11
11
  self.border = options[:border] || false
12
+ self.border_color = options[:border_color] || false
12
13
  self.width = options[:width] || false
13
14
  self.encoding = options[:encoding] || CommandLineReporter::DEFAULTS[:encoding]
14
15
 
@@ -20,6 +21,7 @@ module CommandLineReporter
20
21
  def add(row)
21
22
  # Inheritance from the table
22
23
  row.border = self.border
24
+ row.border_color = self.border_color
23
25
 
24
26
  # Inherit properties from the appropriate row
25
27
  inherit_column_attrs(row) if self.rows[0]
@@ -60,7 +62,8 @@ module CommandLineReporter
60
62
  def separator(type = 'middle')
61
63
  left, center, right, bar = use_utf8? ? utf8_separator(type) : ascii_separator
62
64
 
63
- left + self.rows[0].columns.map {|c| bar * (c.width + 2)}.join(center) + right
65
+ separator_str = left + self.rows[0].columns.map {|c| bar * (c.width + 2)}.join(center) + right
66
+ separator_str.send(self.border_color) if self.border_color
64
67
  end
65
68
 
66
69
  def use_utf8?
@@ -1,3 +1,3 @@
1
1
  module CommandLineReporter
2
- VERSION = '3.3.2'
2
+ VERSION = '3.3.3'
3
3
  end
data/spec/column_spec.rb CHANGED
@@ -37,7 +37,7 @@ describe CommandLineReporter::Column do
37
37
  end
38
38
 
39
39
  it 'accepts bold' do
40
- expect(CommandLineReporter::Column.new('asdf', :bold => true).bold).to be_true
40
+ expect(CommandLineReporter::Column.new('asdf', :bold => true).bold).to be true
41
41
  end
42
42
 
43
43
  it 'defaults the padding' do
data/spec/row_spec.rb CHANGED
@@ -5,7 +5,7 @@ describe CommandLineReporter::Row do
5
5
 
6
6
  describe '#initialize' do
7
7
  it 'accepts header' do
8
- expect(CommandLineReporter::Row.new(:header => true).header).to be_true
8
+ expect(CommandLineReporter::Row.new(:header => true).header).to be true
9
9
  end
10
10
 
11
11
  it 'accepts color' do
@@ -13,7 +13,7 @@ describe CommandLineReporter::Row do
13
13
  end
14
14
 
15
15
  it 'accepts bold' do
16
- expect(CommandLineReporter::Row.new(:bold => true).bold).to be_true
16
+ expect(CommandLineReporter::Row.new(:bold => true).bold).to be true
17
17
  end
18
18
 
19
19
  it 'output encoding should be ascii' do
@@ -55,9 +55,9 @@ describe CommandLineReporter::Row do
55
55
  it 'supercedes bold on columns' do
56
56
  row = CommandLineReporter::Row.new(:bold => true)
57
57
  row.add(cols[0])
58
- expect(row.columns[0].bold).to be_true
58
+ expect(row.columns[0].bold).to be true
59
59
  row.add(cols[1])
60
- expect(row.columns[1].bold).to be_true
60
+ expect(row.columns[1].bold).to be true
61
61
  end
62
62
  end
63
63
 
data/spec/table_spec.rb CHANGED
@@ -9,13 +9,21 @@ describe CommandLineReporter::Table do
9
9
  end
10
10
 
11
11
  it 'defaults the border' do
12
- expect(CommandLineReporter::Table.new.border).to be_false
12
+ expect(CommandLineReporter::Table.new.border).to be false
13
13
  end
14
14
 
15
15
  it 'accepts the border' do
16
16
  expect(CommandLineReporter::Table.new(:border => true).border).to eq(true)
17
17
  end
18
18
 
19
+ it 'defaults the border_color' do
20
+ expect(CommandLineReporter::Table.new.border_color).to be false
21
+ end
22
+
23
+ it 'accepts the border_color' do
24
+ expect(CommandLineReporter::Table.new(:border_color => true).border_color).to eq(true)
25
+ end
26
+
19
27
  it 'output encoding should be ascii' do
20
28
  expect(CommandLineReporter::Table.new(:encoding => :ascii).encoding).to eq(:ascii)
21
29
  end
@@ -76,10 +84,10 @@ describe CommandLineReporter::Table do
76
84
  end
77
85
 
78
86
  it 'bold' do
79
- expect(@table.rows[1].columns[0].bold).to be_false
80
- expect(@table.rows[1].columns[1].bold).to be_false
81
- expect(@table.rows[1].columns[2].bold).to be_false
82
- expect(@table.rows[1].columns[3].bold).to be_true
87
+ expect(@table.rows[1].columns[0].bold).to be false
88
+ expect(@table.rows[1].columns[1].bold).to be false
89
+ expect(@table.rows[1].columns[2].bold).to be false
90
+ expect(@table.rows[1].columns[3].bold).to be true
83
91
  end
84
92
  end
85
93
 
@@ -102,16 +110,17 @@ describe CommandLineReporter::Table do
102
110
  end
103
111
 
104
112
  it 'bold' do
105
- expect(@table.rows[1].columns[0].bold).to be_false
106
- expect(@table.rows[1].columns[0].bold).to be_false
107
- expect(@table.rows[1].columns[1].bold).to be_false
108
- expect(@table.rows[1].columns[2].bold).to be_false
109
- expect(@table.rows[1].columns[3].bold).to be_true
113
+ expect(@table.rows[1].columns[0].bold).to be false
114
+ expect(@table.rows[1].columns[0].bold).to be false
115
+ expect(@table.rows[1].columns[1].bold).to be false
116
+ expect(@table.rows[1].columns[2].bold).to be false
117
+ expect(@table.rows[1].columns[3].bold).to be true
110
118
  end
111
119
  end
112
120
  end
113
121
  end
114
122
 
123
+
115
124
  describe '#auto_adjust_widths' do
116
125
  it 'sets the widths of each column in each row to the maximum required width for that column' do
117
126
  table = CommandLineReporter::Table.new.tap do |t|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command_line_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-09 00:00:00.000000000 Z
12
+ date: 2015-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project:
87
- rubygems_version: 2.2.2
87
+ rubygems_version: 2.4.5
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: A tool for providing interactive command line applications