onebox 1.3.8 → 1.3.9
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 +4 -4
- data/README.md +2 -2
- data/lib/onebox.rb +0 -2
- data/lib/onebox/engine.rb +0 -4
- data/lib/onebox/engine/github_commit_onebox.rb +1 -8
- data/lib/onebox/engine/github_gist_onebox.rb +1 -6
- data/lib/onebox/engine/github_pullrequest_onebox.rb +1 -8
- data/lib/onebox/engine/google_play_app_onebox.rb +1 -7
- data/lib/onebox/engine/image_onebox.rb +5 -0
- data/lib/onebox/engine/pubmed_onebox.rb +1 -6
- data/lib/onebox/engine/twitter_status_onebox.rb +1 -8
- data/lib/onebox/version.rb +1 -1
- data/onebox.gemspec +1 -2
- data/spec/lib/onebox/engine_spec.rb +0 -15
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7e63f64363e58311aad66504fd91ba7940eb2b3
|
4
|
+
data.tar.gz: 18d611e2867fd927ffb4835d30845886ae938411
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5140e35dcaefd82ae6a685ae9683095fbb5f4b674c03a4fa4d9c654c9cbe16dd68e9eab4848f0c293d6968c0f5626c20dad83fe6208071d96cde6cf946723186
|
7
|
+
data.tar.gz: 3755590cec94084263a1a542d094d4fe60e980c3a4b78058edaf0c2d6fdd1cca5ce64b93acb181e0f948624f8188bd19a4a7c1eeb6b8faa777eeea4ff357ab35
|
data/README.md
CHANGED
@@ -3,8 +3,8 @@ onebox
|
|
3
3
|
|
4
4
|
- [](https://rubygems.org/gems/onebox)
|
5
5
|
- [](https://codeclimate.com/github/dysania/onebox)
|
6
|
-
- [](https://travis-ci.org/discourse/onebox)
|
7
|
+
- [](https://gemnasium.com/discourse/onebox)
|
8
8
|
|
9
9
|
|
10
10
|
Onebox is a library for turning media URLs into simple HTML previews of the resource.
|
data/lib/onebox.rb
CHANGED
data/lib/onebox/engine.rb
CHANGED
@@ -5,14 +5,7 @@ module Onebox
|
|
5
5
|
include LayoutSupport
|
6
6
|
include JSON
|
7
7
|
|
8
|
-
|
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]}"
|
@@ -5,12 +5,7 @@ module Onebox
|
|
5
5
|
class GithubGistOnebox
|
6
6
|
include Engine
|
7
7
|
|
8
|
-
|
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]}"
|
@@ -5,14 +5,7 @@ module Onebox
|
|
5
5
|
include LayoutSupport
|
6
6
|
include JSON
|
7
7
|
|
8
|
-
|
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]}"
|
@@ -5,13 +5,7 @@ module Onebox
|
|
5
5
|
include LayoutSupport
|
6
6
|
include HTML
|
7
7
|
|
8
|
-
|
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
|
|
@@ -6,6 +6,11 @@ module Onebox
|
|
6
6
|
matches_regexp /^(https?:)?\/\/.+\.(png|jpg|jpeg|gif|bmp|tif|tiff)(\?.*)?$/i
|
7
7
|
|
8
8
|
def to_html
|
9
|
+
# Fix Dropbox image links
|
10
|
+
if /^https:\/\/www.dropbox.com\/s\//.match @url
|
11
|
+
@url.gsub!("https://www.dropbox.com","https://dl.dropboxusercontent.com")
|
12
|
+
end
|
13
|
+
|
9
14
|
"<a href='#{@url}' target='_blank'><img src='#{@url}'></a>"
|
10
15
|
end
|
11
16
|
end
|
@@ -4,12 +4,7 @@ module Onebox
|
|
4
4
|
include Engine
|
5
5
|
include LayoutSupport
|
6
6
|
|
7
|
-
|
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
|
|
@@ -5,14 +5,7 @@ module Onebox
|
|
5
5
|
include LayoutSupport
|
6
6
|
include HTML
|
7
7
|
|
8
|
-
|
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
|
|
data/lib/onebox/version.rb
CHANGED
data/onebox.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["holla@jzeta.com", "vyki.englert@gmail.com", "robin.ward@gmail.com"]
|
11
11
|
spec.description = %q{A gem for turning URLs into previews.}
|
12
12
|
spec.summary = spec.description
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/discourse/onebox"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -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"
|
@@ -66,21 +66,6 @@ describe Onebox::Engine do
|
|
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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onebox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joanna Zeta
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-06-
|
13
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
@@ -54,20 +54,6 @@ dependencies:
|
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 1.6.1
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: hexpress
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - "~>"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '1.2'
|
64
|
-
type: :runtime
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - "~>"
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '1.2'
|
71
57
|
- !ruby/object:Gem::Dependency
|
72
58
|
name: moneta
|
73
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -335,7 +321,7 @@ files:
|
|
335
321
|
- templates/twitterstatus.mustache
|
336
322
|
- templates/whitelistedgeneric.mustache
|
337
323
|
- templates/wikipedia.mustache
|
338
|
-
homepage: https://github.com/
|
324
|
+
homepage: https://github.com/discourse/onebox
|
339
325
|
licenses:
|
340
326
|
- MIT
|
341
327
|
metadata: {}
|