render_me_pretty 0.6.0 → 0.7.0

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
  SHA256:
3
- metadata.gz: 9175cf8f3c94175794b0bc0f5ed0ef8e9620193889d9fb17da206bd1eda235b9
4
- data.tar.gz: aa14dc5c61c60629ab3e6871a65c9a80e2ec51523e0bfd252aba1f3401949668
3
+ metadata.gz: 4a5117eedab1ddd21a238ea2c8ad2d91d13d15858c9ad1edf4a2357c189d3720
4
+ data.tar.gz: d6383e807149c95e2e41e3ff4407bf8b14b21ad11e9241caac39a98f3578d85e
5
5
  SHA512:
6
- metadata.gz: 40315ff34828109eca1823fa9e4238021fc333d2311d8b22cc0d752b2b962d7cf53114b146737ba2954fcb8d52bbffdaadaae2de9fcf266f56845450dec2ce60
7
- data.tar.gz: a9067cc69cb6316cd37af1dd0d9175c18402d07c71e33afac2f04a0c31173134fa5247d0f47b87768eae5dbf0d4593ceaaa1a713bf65d289fbb0b1b8e14aef08
6
+ metadata.gz: 9bbec4ac5edfea32c599ce69683ce959dbe8921ad726735d41358b1fbc6099f17ff43542e359f274ae0d0a3b1dbc917fcef044f75a661f290359f4f7f9c5c7a5
7
+ data.tar.gz: 6f06d72786fd72e622e512ad4186543c6856e01057cba702e1abccd36421cf079e5845a19214a922c59794526972826d270195bdd6796efdde91ec6e1fb6a832
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.7.0]
7
+ - allow normal exit
8
+ - show full error message for syntax error
9
+
6
10
  ## [0.6.0]
7
11
  - Handle SyntaxError errors correctly
8
12
  - refactor into MainErrorHandler and SyntaxError classes
@@ -5,6 +5,11 @@ class RenderMePretty::Erb
5
5
  @exception = exception
6
6
  end
7
7
 
8
+ def handle
9
+ line_number = find_line_number
10
+ pretty_trace(line_number, full_message=true) # returns StringIO
11
+ end
12
+
8
13
  def pretty_trace(error_line_number, full_message=true)
9
14
  io = StringIO.new
10
15
 
@@ -12,7 +17,7 @@ class RenderMePretty::Erb
12
17
  io.puts "#{@exception.class}#{message}".colorize(:red)
13
18
 
14
19
  pretty_path = @path.sub(/^\.\//, '')
15
- io.puts "Error evaluating ERB template on line #{error_line_number.to_s.colorize(:red)} of: #{pretty_path}:"
20
+ io.puts "Error evaluating ERB template around line #{error_line_number.to_s.colorize(:red)} of: #{pretty_path}:"
16
21
 
17
22
  context = 5 # lines of context
18
23
  top, bottom = [error_line_number-context-1, 0].max, error_line_number+context-1
@@ -1,10 +1,5 @@
1
1
  class RenderMePretty::Erb
2
2
  class MainErrorHandler < BaseHandler
3
- def handle
4
- line_number = find_line_number
5
- pretty_trace(line_number, full_message=true) # returns StringIO
6
- end
7
-
8
3
  # For general Tilt errors first line of the backtrace that contains the path
9
4
  # of the file we're rendeirng and has the line number. Example:
10
5
  #
@@ -1,10 +1,5 @@
1
1
  class RenderMePretty::Erb
2
2
  class SyntaxErrorHandler < BaseHandler
3
- def handle
4
- line_number = find_line_number
5
- pretty_trace(line_number, full_message=false) # returns StringIO
6
- end
7
-
8
3
  # spec/fixtures/invalid/syntax.erb:2: syntax error, unexpected ';', expecting ']'
9
4
  # ); if ENV['TEST' ; _erbout.<<(-" missing ending...
10
5
  # ^
@@ -76,7 +76,11 @@ module RenderMePretty
76
76
  begin
77
77
  template.render(context)
78
78
  rescue Exception => e
79
- handle_exception(e)
79
+ if e.class == SystemExit # allow exit to happen normally
80
+ raise
81
+ else
82
+ handle_exception(e)
83
+ end
80
84
  end
81
85
  end
82
86
 
@@ -1,3 +1,3 @@
1
1
  module RenderMePretty
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_me_pretty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-19 00:00:00.000000000 Z
11
+ date: 2018-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport