File tree 11 files changed +7
-66
lines changed
11 files changed +7
-66
lines changed Original file line number Diff line number Diff line change 2
2
require "multi_json"
3
3
require "nokogiri"
4
4
require "mustache"
5
- require "hexpress"
6
- require "hexpress/web"
7
5
require "ostruct"
8
6
require "moneta"
9
7
require "cgi"
Original file line number Diff line number Diff line change @@ -81,10 +81,6 @@ def priority
81
81
100
82
82
end
83
83
84
- def matches ( &block )
85
- matches_regexp ( Hexpress . new ( &block ) . to_r )
86
- end
87
-
88
84
def matches_regexp ( r )
89
85
class_variable_set :@@matcher , r
90
86
end
Original file line number Diff line number Diff line change @@ -5,14 +5,7 @@ class GithubCommitOnebox
5
5
include LayoutSupport
6
6
include JSON
7
7
8
- matches do
9
- http
10
- maybe ( "www." )
11
- domain ( "github" )
12
- tld ( "com" )
13
- anything
14
- with ( "/commit/" )
15
- end
8
+ matches_regexp Regexp . new ( "^http(?:s)?://(?:www\. )?(?:(?:\w )+\. )?(github)\. com(?:/)?(?:.)*/commit/" )
16
9
17
10
def url
18
11
"https://api.github.com/repos/#{ match [ :owner ] } /#{ match [ :repository ] } /commits/#{ match [ :sha ] } "
Original file line number Diff line number Diff line change @@ -5,12 +5,7 @@ module Engine
5
5
class GithubGistOnebox
6
6
include Engine
7
7
8
- matches do
9
- http
10
- with ( "gist." )
11
- domain ( "github" )
12
- tld ( "com" )
13
- end
8
+ matches_regexp Regexp . new ( "^http(?:s)?://gist\\ .(?:(?:\\ w)+\\ .)?(github)\\ .com(?:/)?" )
14
9
15
10
def url
16
11
"https://api.github.com/gists/#{ match [ :sha ] } "
Original file line number Diff line number Diff line change @@ -5,14 +5,7 @@ class GithubPullRequestOnebox
5
5
include LayoutSupport
6
6
include JSON
7
7
8
- matches do
9
- http
10
- maybe ( "www." )
11
- domain ( "github" )
12
- tld ( "com" )
13
- anything
14
- with ( "/pull/" )
15
- end
8
+ matches_regexp Regexp . new ( "^http(?:s)?://(?:www\\ .)?(?:(?:\\ w)+\\ .)?(github)\\ .com(?:/)?(?:.)*/pull/" )
16
9
17
10
def url
18
11
"https://api.github.com/repos/#{ match [ :owner ] } /#{ match [ :repository ] } /pulls/#{ match [ :number ] } "
Original file line number Diff line number Diff line change @@ -5,13 +5,7 @@ class GooglePlayAppOnebox
5
5
include LayoutSupport
6
6
include HTML
7
7
8
- matches do
9
- http
10
- with ( "play." )
11
- domain ( "google" )
12
- tld ( "com" )
13
- with ( "/store/apps/" )
14
- end
8
+ matches_regexp Regexp . new ( "^http(?:s)?://play\\ .(?:(?:\\ w)+\\ .)?(google)\\ .com(?:/)?/store/apps/" )
15
9
16
10
private
17
11
Original file line number Diff line number Diff line change @@ -4,12 +4,7 @@ class PubmedOnebox
4
4
include Engine
5
5
include LayoutSupport
6
6
7
- matches do
8
- http
9
- domain ( "www.ncbi.nlm.nih" )
10
- tld ( "gov" )
11
- has ( "/pubmed/" )
12
- end
7
+ matches_regexp Regexp . new ( "^http(?:s)?://(?:(?:\\ w)+\\ .)?(www.ncbi.nlm.nih)\\ .gov(?:/)?/pubmed/" )
13
8
14
9
private
15
10
Original file line number Diff line number Diff line change @@ -5,14 +5,7 @@ class TwitterStatusOnebox
5
5
include LayoutSupport
6
6
include HTML
7
7
8
- matches do
9
- http
10
- maybe ( "www." )
11
- domain ( "twitter" )
12
- tld ( "com" )
13
- anything
14
- has ( "/status/" )
15
- end
8
+ matches_regexp Regexp . new ( "^http(?:s)?://(?:www\\ .)?(?:(?:\\ w)+\\ .)?(twitter)\\ .com(?:/)?(?:.)*/status/" )
16
9
17
10
private
18
11
Original file line number Diff line number Diff line change 1
1
module Onebox
2
- VERSION = "1.3.8 "
2
+ VERSION = "1.3.9 "
3
3
end
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
21
21
spec . add_runtime_dependency "multi_json" , "~> 1.7"
22
22
spec . add_runtime_dependency "mustache" , "~> 0.99"
23
23
spec . add_runtime_dependency "nokogiri" , "~> 1.6.1"
24
- spec . add_runtime_dependency "hexpress" , "~> 1.2"
25
24
spec . add_runtime_dependency "moneta" , "~> 0.7"
26
25
27
26
spec . add_development_dependency "bundler" , "~> 1.3"
Original file line number Diff line number Diff line change @@ -66,21 +66,6 @@ class OneboxEngineTripleEqual
66
66
end
67
67
end
68
68
69
- describe ".matches" do
70
- class OneboxEngineMatches
71
- include Onebox ::Engine
72
-
73
- matches do
74
- find "foo.com"
75
- end
76
- end
77
-
78
- it "sets @@matcher to a regular expression" do
79
- regex = OneboxEngineMatches . class_variable_get ( :@@matcher )
80
- expect ( regex ) . to be_a ( Regexp )
81
- end
82
- end
83
-
84
69
end
85
70
86
71
describe ".onebox_name" do
You can’t perform that action at this time.
0 commit comments