terminal 0.3.5 → 0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e57524547e4f0d8330baa3aae02ece0de8beafc6
4
- data.tar.gz: 7a79f21033af42ebd1313ff8ba346b5851a00bdb
3
+ metadata.gz: 5b9d146db6ddf99debcf30b8c90b7374ad22ba69
4
+ data.tar.gz: 1a99c056dd3342b9af2f3bd773b9eb175593980a
5
5
  SHA512:
6
- metadata.gz: 338eb89fd30c18a221f99c33065e80aae053fe1b5bd4f195237372ab4dceb9ef464ad832ee9247264f0775fff0fcb8b28cb1f43b60b6d3d65faf82794dc3810a
7
- data.tar.gz: 6849172c81f4ae3af7f4d9ae1e7820fd43fb1747ed4fba257b079cff6a76847558f187f93677353d7999b11731a45af6511ee33f45b7bb522aa271a5c5d85b52
6
+ metadata.gz: 000d39ecd8c3874e5981dbd0316fca235313155dcd2bc6afc39043bc45f383f34d5fa2cc9b8bddf0aa28ef843da913cc0984610b5c728d457a05fafb88b9dacd
7
+ data.tar.gz: d46da70bd4e22cdbcca0f9f352f78d10680e48579270424dc6a1b08ca04bfdad2368fc71b55757885bda3acb4a219258c37afad1b5f55e54625991a27e08a287
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- terminal (0.3.5)
4
+ terminal (0.4)
5
5
  escape_utils (~> 1.0)
6
- gemoji (~> 2.0)
6
+ gemoji (~> 2.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -11,23 +11,23 @@ GEM
11
11
  benchmark-ips (2.0.0)
12
12
  diff-lcs (1.2.5)
13
13
  escape_utils (1.0.1)
14
- gemoji (2.0.0)
14
+ gemoji (2.1.0)
15
15
  hirb (0.7.2)
16
16
  method_profiler (2.0.1)
17
17
  hirb (>= 0.6.0)
18
18
  rake (10.3.2)
19
- rspec (3.0.0)
20
- rspec-core (~> 3.0.0)
21
- rspec-expectations (~> 3.0.0)
22
- rspec-mocks (~> 3.0.0)
23
- rspec-core (3.0.3)
24
- rspec-support (~> 3.0.0)
25
- rspec-expectations (3.0.3)
19
+ rspec (3.1.0)
20
+ rspec-core (~> 3.1.0)
21
+ rspec-expectations (~> 3.1.0)
22
+ rspec-mocks (~> 3.1.0)
23
+ rspec-core (3.1.7)
24
+ rspec-support (~> 3.1.0)
25
+ rspec-expectations (3.1.2)
26
26
  diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.0.0)
28
- rspec-mocks (3.0.3)
29
- rspec-support (~> 3.0.0)
30
- rspec-support (3.0.3)
27
+ rspec-support (~> 3.1.0)
28
+ rspec-mocks (3.1.3)
29
+ rspec-support (~> 3.1.0)
30
+ rspec-support (3.1.2)
31
31
 
32
32
  PLATFORMS
33
33
  ruby
data/Readme.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/terminal.png)](https://rubygems.org/gems/terminal)
4
4
 
5
- Terminal is a Ruby library for converting arbitrary shell output (with ANSI) into beautifully rendered HTML. See http://www.termsys.demon.co.uk/vtansi.htm for more information about ANSI Terminal Control Escape Sequences.
5
+ Terminal is a Ruby library for converting arbitrary shell output (with ANSI) into beautifully rendered HTML. See http://en.wikipedia.org/wiki/ANSI_escape_code for more information about ANSI Terminal Control Escape Sequences.
6
6
 
7
7
  ## Installation
8
8
 
@@ -31,8 +31,8 @@ module Terminal
31
31
  # up directly.
32
32
  output = @output.to_s.dup
33
33
 
34
- output = check_size(output)
35
- output = check_line_lengths(output)
34
+ # Don't allow parsing of outputs longer than 4 meg
35
+ output = check_and_chomp_length(output)
36
36
 
37
37
  # Force encoding on the output first
38
38
  force_encoding!(output)
@@ -57,7 +57,7 @@ module Terminal
57
57
 
58
58
  private
59
59
 
60
- def check_size(output)
60
+ def check_and_chomp_length(output)
61
61
  # Limit the entire size of the output to 4 meg
62
62
  max_total_size = 4 * MEGABYTES
63
63
  if output.bytesize > max_total_size
@@ -69,20 +69,6 @@ module Terminal
69
69
  end
70
70
  end
71
71
 
72
- def check_line_lengths(output)
73
- # Limit each line to (x) chars
74
- # TODO: Move this to the screen
75
- max_line_length = 50_000
76
- output.split("\n".freeze).map do |line|
77
- if line.length > max_line_length
78
- line = line[0..max_line_length]
79
- line << " Warning: Terminal has chopped the rest of this line off as it's over the allowed #{max_line_length} characters per line limit."
80
- else
81
- line
82
- end
83
- end.join("\n".freeze)
84
- end
85
-
86
72
  def force_encoding!(string)
87
73
  string.force_encoding('UTF-8')
88
74
 
@@ -189,8 +175,6 @@ module Terminal
189
175
  else
190
176
  unicode
191
177
  end
192
- rescue
193
- unicode
194
178
  end
195
179
  end
196
180
  end
@@ -1,3 +1,3 @@
1
1
  module Terminal
2
- VERSION = "0.3.5"
2
+ VERSION = "0.4"
3
3
  end
@@ -21,9 +21,10 @@ describe Terminal::Renderer do
21
21
 
22
22
  describe "#render" do
23
23
  it "chops off logs longer than 4 megabytes" do
24
- long_string = "x" * 4.5 * 1024 * 1024
24
+ long_string = "x" * 5 * 1024 * 1024
25
+ last_part_of_long_string = render(long_string).split("").last(1000).join("")
25
26
 
26
- expect(render(long_string)).to end_with("Warning: Terminal has chopped the rest of this line off as it&#39;s over the allowed 50000 characters per line limit.")
27
+ expect(last_part_of_long_string).to end_with("Warning: Terminal has chopped off the rest of the build as it&#39;s over the allowed 4 megabyte limit for logs.")
27
28
  end
28
29
 
29
30
  it "closes colors that get opened" do
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "escape_utils", "~> 1.0"
22
- spec.add_dependency "gemoji", "~> 2.0"
22
+ spec.add_dependency "gemoji", "~> 2.1"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.6"
25
25
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Pitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-05 00:00:00.000000000 Z
11
+ date: 2014-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: escape_utils
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '2.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '2.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  version: '0'
176
176
  requirements: []
177
177
  rubyforge_project:
178
- rubygems_version: 2.3.0
178
+ rubygems_version: 2.2.2
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Converts ANSI to HTML