what_weve_got_here_is_an_error_to_communicate 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e6483b3b842d393d1825de04acf2db6a8c3678a5
4
- data.tar.gz: 7ac6f980db5b9de1c3f077b5599daa9208c021e8
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzJkODUwYWU1ZGNiZGU2YjdmY2IyMzhlYmZkN2E4NzczMjZlMmYwOA==
5
+ data.tar.gz: !binary |-
6
+ ODY5NzA5MDJiNWEzOWM2OGUwZmI1NDcwOTk0YjIxYTc2MzIyYjVkYw==
5
7
  SHA512:
6
- metadata.gz: 0a40e76d184af629cfafc57cf1cf66798d5d5f36de569c4800e5b07fc3cf582bb345bc48100bed81b40a0f221b738991372439d14cbd05ec2b52b4a319164977
7
- data.tar.gz: 57375d5b229c8b949f932e8ff569c1ff8a12f03a62396063358ec24a2d9a6a957e680d013c4e1f9f8bf3eaa96fc049d5423daec072a082db84a8d8c931ca97c6
8
+ metadata.gz: !binary |-
9
+ ZTQ1YWQzYzA4Y2JlYTkzNmY5ODlmMjEyMjdiYTlmMjc2MmRmMWVhZmJjYWRi
10
+ MTU3ZGNkODY2NThhMmQ4Yzc2MmE4ODliODRmY2NiNTZhYjUwNDA5N2QxMGVl
11
+ NmM3YjUzNWZkMjk4ZWQ2MTA0NTA2OWJhMDYyNjg5MjU5NDc5YTA=
12
+ data.tar.gz: !binary |-
13
+ YzQzZjBkZjhjNzgyNjEzM2JiN2RiZWQ4ZjU1ZGJiZjAzNTFlNTU1ZDUwNWZl
14
+ ZDRkYzc4YmEzYTcxMzViZWM2NGVkYjI3YTUxMWIyNjA5Y2JhNWYyYjg1NGVh
15
+ ZmEyYTlkZmIxODA5NzY1NTBhMGM2YWY0NGZhN2RhM2I0YTc3YTQ=
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.3
3
4
  - 2.0
4
5
  - 2.1
5
6
  - 2.2
@@ -86,7 +86,7 @@ module ErrorToCommunicate
86
86
 
87
87
  # then display the code
88
88
  if path.exist?
89
- code = File.read(path).lines[start_index..end_index].join("")
89
+ code = File.read(path).lines.to_a[start_index..end_index].join("")
90
90
  code = remove_indentation code
91
91
  code = theme.syntax_highlight code
92
92
  code = prefix_linenos_to code, start_index.next, mark: mark_linenum
@@ -127,8 +127,8 @@ module ErrorToCommunicate
127
127
 
128
128
  def prefix_linenos_to(code, start_linenum, options)
129
129
  line_to_mark = options.fetch :mark
130
- lines = code.lines
131
- max_linenum = lines.count + start_linenum - 1 # 1 to translate to indexes
130
+ lines = code.lines.to_a
131
+ max_linenum = lines.length + start_linenum - 1 # 1 to translate to indexes
132
132
  linenum_width = max_linenum.to_s.length + 4 # 1 for the colon, 3 for the arrow/space
133
133
  lines.zip(start_linenum..max_linenum)
134
134
  .map { |line, num|
@@ -143,7 +143,7 @@ module ErrorToCommunicate
143
143
  end
144
144
 
145
145
  def add_message_to(code, offset, message)
146
- lines = code.lines
146
+ lines = code.lines.to_a
147
147
  lines[offset].chomp! << " " << message << "\n"
148
148
  lines.join("")
149
149
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'pathname'
2
3
  require 'error_to_communicate/heuristic'
3
4
 
@@ -27,7 +28,7 @@ module ErrorToCommunicate
27
28
  else
28
29
  # The newline here implies the semantic analysis needs to get better,
29
30
  # it only does this b/c it should be a block-element, but isn't being sectioned like that, correctly
30
- [:context, "Couldn\'t find anything interesting ¯\_(ツ)_/¯\n"]
31
+ [:context, "Couldn\'t find anything interesting ¯\\_(ツ)_/¯\n"]
31
32
  end
32
33
 
33
34
  [:heuristic, heuristic]
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'error_to_communicate/heuristic'
2
3
 
3
4
  module ErrorToCommunicate
@@ -29,7 +30,7 @@ module ErrorToCommunicate
29
30
 
30
31
  def semantic_info
31
32
  if backtrace.length == 0
32
- [:context, "Couldn\'t find anything interesting ¯\_(ツ)_/¯\n"]
33
+ [:context, "Couldn\'t find anything interesting ¯\\_(ツ)_/¯\n"]
33
34
  elsif backtrace.length == 1
34
35
  [:heuristic, [:code, {
35
36
  location: backtrace[0],
@@ -86,7 +86,7 @@ module ErrorToCommunicate
86
86
  end
87
87
 
88
88
  def highlight_text(code, index, text)
89
- lines = code.lines
89
+ lines = code.lines.to_a
90
90
  return code unless text && lines[index]
91
91
  lines[index].gsub! text, invert(text)
92
92
  lines.join("")
@@ -1,3 +1,3 @@
1
1
  module ErrorToCommunicate
2
- VERSION = '0.0.5'.freeze
2
+ VERSION = '0.0.6'.freeze
3
3
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'heuristic/spec_helper'
2
3
 
3
4
  RSpec.describe 'heuristics for the WrongNumberOfArguments', heuristic: true do
@@ -83,7 +84,7 @@ RSpec.describe 'heuristics for the WrongNumberOfArguments', heuristic: true do
83
84
 
84
85
  it 'shrugs "sorry" when there are no lines in the backtrace' do
85
86
  heuristic = heuristic_for message: message_2_for_3, backtrace: []
86
- expect(heuristic.semantic_info).to eq [:context, "Couldn\'t find anything interesting ¯\_(ツ)_/¯\n"]
87
+ expect(heuristic.semantic_info).to eq [:context, "Couldn\'t find anything interesting ¯\\_(ツ)_/¯\n"]
87
88
  end
88
89
 
89
90
  describe 'When there are at least two lines in the backtrace' do
@@ -44,7 +44,7 @@ RSpec.describe ErrorToCommunicate::RSpecFormatter, rspec_formatter: true do
44
44
 
45
45
  def this_line_of_code
46
46
  file, line = caller[0].split(":").take(2)
47
- File.read(file).lines[line.to_i].strip
47
+ File.read(file).lines.to_a[line.to_i].strip
48
48
  end
49
49
 
50
50
  def get_printed(formatter)
@@ -1,4 +1,4 @@
1
- require_relative 'lib/error_to_communicate/version'
1
+ require File.expand_path('../lib/error_to_communicate/version', __FILE__)
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'what_weve_got_here_is_an_error_to_communicate'
4
4
  s.version = ErrorToCommunicate::VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: what_weve_got_here_is_an_error_to_communicate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Cheek
@@ -15,88 +15,88 @@ dependencies:
15
15
  name: rouge
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.8'
21
- - - "!="
21
+ - - ! '!='
22
22
  - !ruby/object:Gem::Version
23
23
  version: 1.9.1
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
28
+ - - ~>
29
29
  - !ruby/object:Gem::Version
30
30
  version: '1.8'
31
- - - "!="
31
+ - - ! '!='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.9.1
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rspec
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.2'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.2'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haiti
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "<"
52
+ - - <
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.3'
55
- - - ">="
55
+ - - ! '>='
56
56
  - !ruby/object:Gem::Version
57
57
  version: 0.2.0
58
58
  type: :development
59
59
  prerelease: false
60
60
  version_requirements: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - "<"
62
+ - - <
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0.3'
65
- - - ">="
65
+ - - ! '>='
66
66
  - !ruby/object:Gem::Version
67
67
  version: 0.2.0
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: pry
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "<"
72
+ - - <
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0.11'
75
- - - ">="
75
+ - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: 0.10.0
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - "<"
82
+ - - <
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0.11'
85
- - - ">="
85
+ - - ! '>='
86
86
  - !ruby/object:Gem::Version
87
87
  version: 0.10.0
88
88
  - !ruby/object:Gem::Dependency
89
89
  name: rake
90
90
  requirement: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - "~>"
92
+ - - ~>
93
93
  - !ruby/object:Gem::Version
94
94
  version: '10.4'
95
95
  type: :development
96
96
  prerelease: false
97
97
  version_requirements: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - "~>"
99
+ - - ~>
100
100
  - !ruby/object:Gem::Version
101
101
  version: '10.4'
102
102
  description: Hooks into program lifecycle to display error messages to you in a helpufl
@@ -106,9 +106,9 @@ executables: []
106
106
  extensions: []
107
107
  extra_rdoc_files: []
108
108
  files:
109
- - ".gitignore"
110
- - ".rspec"
111
- - ".travis.yml"
109
+ - .gitignore
110
+ - .rspec
111
+ - .travis.yml
112
112
  - Gemfile
113
113
  - Rakefile
114
114
  - Readme.md
@@ -166,17 +166,17 @@ require_paths:
166
166
  - lib
167
167
  required_ruby_version: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - ">="
169
+ - - ! '>='
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  requirements:
174
- - - ">="
174
+ - - ! '>='
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
178
  rubyforge_project:
179
- rubygems_version: 2.4.5
179
+ rubygems_version: 2.4.1
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: Readable, helpful error messages