reviewed_braai 0.1.6 → 0.2.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.
- data/lib/reviewed_braai/errors.rb +24 -14
- data/lib/reviewed_braai/handlers/default.rb +1 -5
- data/lib/reviewed_braai/matchers/default.rb +5 -2
- data/lib/reviewed_braai/version.rb +1 -1
- metadata +13 -7
- checksums.yaml +0 -15
@@ -1,37 +1,47 @@
|
|
1
1
|
module ReviewedBraai
|
2
|
+
|
3
|
+
module Notifications
|
4
|
+
def self.notify error
|
5
|
+
if error.opts[:airbrake] && defined?(Airbrake)
|
6
|
+
Airbrake.notify(error, error.opts)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.log error_message
|
11
|
+
Rails.logger.warn(error_message) if defined?(Rails) && defined?(Rails.logger)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
2
15
|
class TagRenderError < StandardError
|
3
16
|
|
4
|
-
attr_accessor :key
|
17
|
+
attr_accessor :key, :opts
|
5
18
|
|
6
19
|
def initialize(opts={})
|
7
|
-
|
8
|
-
error_class:
|
20
|
+
@opts = {
|
21
|
+
error_class: self.class.to_s,
|
9
22
|
error_message: "Tag Render Error",
|
10
23
|
key: "Key not supplied",
|
11
24
|
airbrake: true
|
12
25
|
}.merge!(opts)
|
13
26
|
|
14
|
-
@key =
|
27
|
+
@key = @opts[:key]
|
15
28
|
|
16
|
-
|
17
|
-
Airbrake.notify(error)
|
18
|
-
elsif defined?(Rails) && defined?(Rails.logger)
|
19
|
-
Rails.logger.warn(error.to_s)
|
20
|
-
end
|
29
|
+
Notifications.notify(self) || Notifications.log(@opts.to_s)
|
21
30
|
|
22
|
-
super(
|
31
|
+
super(@opts[:error_message])
|
23
32
|
end
|
24
33
|
|
25
|
-
class
|
34
|
+
class MatchNotFound < TagRenderError
|
26
35
|
def initialize(error={})
|
27
|
-
error = { error_message: "
|
36
|
+
error = { error_message: "Braai Match Not Found", airbrake: false }.merge!(error)
|
28
37
|
super(error)
|
29
38
|
end
|
30
39
|
end
|
31
40
|
|
32
|
-
|
41
|
+
|
42
|
+
class TemplateNotFound < TagRenderError
|
33
43
|
def initialize(error={})
|
34
|
-
error = { error_message: "
|
44
|
+
error = { error_message: "Template not Found" }.merge!(error)
|
35
45
|
super(error)
|
36
46
|
end
|
37
47
|
end
|
@@ -2,11 +2,7 @@ module ReviewedBraai
|
|
2
2
|
module Handlers
|
3
3
|
class Default < ::Braai::Handlers::Default
|
4
4
|
def perform
|
5
|
-
|
6
|
-
value
|
7
|
-
else
|
8
|
-
raise ::ReviewedBraai::TagRenderError::MatchNotFound.new(key: key)
|
9
|
-
end
|
5
|
+
super || raise(::ReviewedBraai::TagRenderError::MatchNotFound.new(key: key))
|
10
6
|
end
|
11
7
|
end
|
12
8
|
|
@@ -6,10 +6,13 @@ module ReviewedBraai
|
|
6
6
|
Braai::Template.map(Braai::Matchers::DefaultMatcher, ReviewedBraai::Handlers::Default)
|
7
7
|
Braai::Template.map(Braai::Matchers::RegionMatcher, ReviewedBraai::Handlers::DefaultRegion)
|
8
8
|
|
9
|
-
Braai::Handlers.rescue_from ReviewedBraai::TagRenderError, ->(handler) do
|
9
|
+
Braai::Handlers.rescue_from ReviewedBraai::TagRenderError, ->(handler, e) do
|
10
10
|
# puts %{handler: #{handler.inspect}}
|
11
|
-
"<!-- #{handler.key} -->"
|
11
|
+
"<!-- #{e.class.to_s}: #{handler.key} -->"
|
12
12
|
end
|
13
|
+
|
14
|
+
# fallback match for any {{ word stuff="123" }} that isn't already commented out.
|
15
|
+
Braai::Template.add_fallback(/(?!<!-- [\w: ]*)({{\s*(\w+)\s(.*?)\s*}}(?!\s*-->))/, ReviewedBraai::Handlers::Default)
|
13
16
|
end
|
14
17
|
end
|
15
18
|
end
|
metadata
CHANGED
@@ -1,32 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reviewed_braai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Kevin Incorvia
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: braai
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
21
|
+
version: 1.6.0
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
29
|
+
version: 1.6.0
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rspec
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -70,25 +75,26 @@ files:
|
|
70
75
|
- README.rdoc
|
71
76
|
homepage: http://www.reviewed.com
|
72
77
|
licenses: []
|
73
|
-
metadata: {}
|
74
78
|
post_install_message:
|
75
79
|
rdoc_options: []
|
76
80
|
require_paths:
|
77
81
|
- lib
|
78
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
79
84
|
requirements:
|
80
85
|
- - ! '>='
|
81
86
|
- !ruby/object:Gem::Version
|
82
87
|
version: '0'
|
83
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
84
90
|
requirements:
|
85
91
|
- - ! '>='
|
86
92
|
- !ruby/object:Gem::Version
|
87
93
|
version: '0'
|
88
94
|
requirements: []
|
89
95
|
rubyforge_project:
|
90
|
-
rubygems_version:
|
96
|
+
rubygems_version: 1.8.25
|
91
97
|
signing_key:
|
92
|
-
specification_version:
|
98
|
+
specification_version: 3
|
93
99
|
summary: Braai matchers for Reviewed.com
|
94
100
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
MWFiMGUyYzYwMTNlMjE0MmMxM2U3ZWRjNmFmY2ZjZTI2ZGVlNjEwMg==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZTMxNGFkY2RkYjQ5MzE5YTE5YmJiN2I1Yzg2YjNiN2JjNjM1NmVjZA==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
Y2I2ZTBmYmI2MWJiODhkZGJhNmI0MzlhMDMyZThjYzIxOTI3MGQ2YjhiNGJk
|
10
|
-
NjFlYWY0MGE1NTlhY2I4MzA0NDgyY2ZhNjE2NThjNTY5MDYzYTRlNzkxNDZm
|
11
|
-
OWZjZTg4MjU3N2U3MmI1OWE5NDMyNGI0NWJjM2I2NzU4NDBhMGU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NDY5NDhmZjFhYzg5YzFiODU3NzljNGZmZWI5N2U2YmU4MGU3MjcxZGVhMGM4
|
14
|
-
YWZiNzgyMzM3OGM2ZmNjMDY3NmVlNGZlMjQ3NGFjNGNhMmFlNmNkNmM0NDFj
|
15
|
-
OWFmNmJmZjMzMmQxM2NlYWZkYWM3ZmVhYmJjNmFiMGEzZjYyZjQ=
|