zemus 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +5 -0
- data/lib/zemus.rb +11 -0
- data/lib/zemus/generic.rb +23 -0
- data/lib/zemus/image.rb +18 -0
- data/lib/zemus/kickstarter.rb +23 -0
- data/lib/zemus/parser.rb +18 -0
- data/lib/zemus/sound.rb +24 -0
- data/lib/zemus/soundcloud.rb +17 -0
- data/lib/zemus/version.rb +3 -0
- data/lib/zemus/vimeo.rb +19 -0
- data/lib/zemus/vine.rb +21 -0
- data/lib/zemus/youtube.rb +37 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/zemus/image_spec.rb +10 -0
- data/spec/zemus/kickstarter_spec.rb +8 -0
- data/spec/zemus/sound_spec.rb +8 -0
- data/spec/zemus/soundcloud_spec.rb +8 -0
- data/spec/zemus/version_spec.rb +9 -0
- data/spec/zemus/vimeo_spec.rb +8 -0
- data/spec/zemus/vine_spec.rb +8 -0
- data/spec/zemus/youtube_spec.rb +8 -0
- data/spec/zemus_spec.rb +66 -0
- data/zemus.gemspec +24 -0
- metadata +145 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Jon Dodson & Mark Tabler
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Zemus
|
2
|
+
|
3
|
+
Zemus is a ruby gem that translates URLs into embedable code you can insert on a page. It does its magic by simply inspecting and hacking up the URL itself, it makes no external requests to a webservice.
|
4
|
+
|
5
|
+
It currently translates the follow URLs to embedabble HTML:
|
6
|
+
|
7
|
+
* images
|
8
|
+
* mp3s
|
9
|
+
* youtube
|
10
|
+
* vimeo
|
11
|
+
* vine
|
12
|
+
* kickstarter
|
13
|
+
* soundcloud
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
gem 'zemus'
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Zemus.embed("http://i.imgur.com/r8JB38S.jpg")
|
28
|
+
|
29
|
+
Zemus.embed("http://www.youtube.com/watch?v=bjAcMDGJcHI")
|
30
|
+
|
31
|
+
Zemus.embed("http://www.podtrac.com/pts/redirect.mp3/content.duckfeed.tv/bsc/bsc_E001.mp3")
|
32
|
+
|
33
|
+
Zemus.embed("https://soundcloud.com/destructoid/super-mario-world-by-video")
|
34
|
+
|
35
|
+
Zemus.embed("http://vimeo.com/21929292")
|
36
|
+
|
37
|
+
Zemus.embed("https://vine.co/v/bFPjjheVnau/embed/simple")
|
38
|
+
|
39
|
+
## TODO / Contributions
|
40
|
+
|
41
|
+
When we output HTML for images and other iframes we tack on some HTML and classes some people may not need. For instance, to get the images we embed to be responsive we tack on the Bootstrap 3 "img-responsive img-thumbnail" classes. We also put a link under the Kickstarter embed to take the person to the page itself. I totally get some people may not want that so feel free to submit a patch to pull this stuff these extras to a config.
|
42
|
+
|
43
|
+
If there is another URL you want to embed, submit the patch. As long as you can create the embed from the URL itself, we will consider the patch. Also, we currently want to keep the things we embed to HTML5 widgets.
|
44
|
+
|
45
|
+
## They That Created The Greatness
|
46
|
+
|
47
|
+
Zemus was extracted from and is running in production at http://cheerfulghost.com by Jon Dodson and Mark Tabler.
|
48
|
+
|
49
|
+
## Even more
|
50
|
+
|
51
|
+
Zemus was named after the antagonist of Final Fantasy IV.
|
52
|
+
|
53
|
+
http://finalfantasy.wikia.com/wiki/Zemus
|
data/Rakefile
ADDED
data/lib/zemus.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Zemus
|
2
|
+
class Generic
|
3
|
+
|
4
|
+
def self.valid?(url)
|
5
|
+
true
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(url)
|
9
|
+
@url = url
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_embed
|
13
|
+
url = @url
|
14
|
+
|
15
|
+
display = url
|
16
|
+
if display.length > 40
|
17
|
+
display = "#{display[0,40]}.."
|
18
|
+
end
|
19
|
+
|
20
|
+
"<a href='#{url}' target='_blank'>#{display}</a>"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/zemus/image.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Zemus
|
2
|
+
class Image
|
3
|
+
|
4
|
+
def self.valid?(url)
|
5
|
+
url.downcase =~ /\.jpg/ || url.downcase =~ /\.jpeg/ ||
|
6
|
+
url.downcase =~ /\.png/ || url.downcase =~ /\.gif/
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(url)
|
10
|
+
@url = url
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_embed
|
14
|
+
"<img src='#{@url}' class='img-responsive img-thumbnail' />"
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Zemus
|
2
|
+
class Kickstarter
|
3
|
+
|
4
|
+
def self.valid?(url)
|
5
|
+
url =~ /kickstarter.com\/projects\//
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(url)
|
9
|
+
@url = url
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_embed
|
13
|
+
embed = "<iframe width='100%' height='' scrolling='no' src='http://www.kickstarter.com/projects/#{kickstarter_id}/widget/video.html' frameborder='0'> </iframe>"
|
14
|
+
embed += "<a href='#{@url}' target='_blank' class='btn btn-default btn-xs'><i class='glyphicon glyphicon-heart'></i> Back this on Kickstarter!</a>"
|
15
|
+
|
16
|
+
embed
|
17
|
+
end
|
18
|
+
|
19
|
+
def kickstarter_id
|
20
|
+
@url.split("kickstarter.com/projects/").last.split("?").first
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/zemus/parser.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Zemus
|
2
|
+
class Parser
|
3
|
+
|
4
|
+
def self.url_classes
|
5
|
+
[Image, Kickstarter, Sound, Soundcloud, Vimeo,
|
6
|
+
Vine, Youtube]
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.build_embedder(url)
|
10
|
+
url_classes.each do |klass|
|
11
|
+
if klass.valid?(url)
|
12
|
+
return klass.new(url)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
Generic.new(url)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/zemus/sound.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Zemus
|
2
|
+
class Sound
|
3
|
+
|
4
|
+
def self.valid?(url)
|
5
|
+
url =~ /.mp3/
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(url)
|
9
|
+
@url = url
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_embed
|
13
|
+
filename = @url.split("/").last
|
14
|
+
|
15
|
+
embed = "<audio controls='controls' class='media-object'>"
|
16
|
+
embed += "<source src='#{@url}' type='audio/mpeg' />"
|
17
|
+
embed += "</audio>"
|
18
|
+
embed += "<div><a href='#{@url}' target='_blank' class='img-thumbnail' download='#{filename}'><i class='glyphicon glyphicon-music'></i> Download this podcast.</a></div>"
|
19
|
+
|
20
|
+
embed
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Zemus
|
2
|
+
class Soundcloud
|
3
|
+
|
4
|
+
def self.valid?(url)
|
5
|
+
url =~ /soundcloud.com/
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(url)
|
9
|
+
@url = url
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_embed
|
13
|
+
"<iframe autosize='false' width='100%' height='166' scrolling='no' frameborder='no' src='https://w.soundcloud.com/player/?url=#{@url}'></iframe>"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/lib/zemus/vimeo.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Zemus
|
2
|
+
class Vimeo
|
3
|
+
|
4
|
+
def self.valid?(url)
|
5
|
+
url =~ /vimeo.com/
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(url)
|
9
|
+
@url = url
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_embed
|
13
|
+
id = @url.split('/').last
|
14
|
+
|
15
|
+
"<iframe src='http://player.vimeo.com/video/#{id}' width='100%' height='' frameborder='0'></iframe>"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/lib/zemus/vine.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Zemus
|
2
|
+
class Vine
|
3
|
+
|
4
|
+
def self.valid?(url)
|
5
|
+
url =~ /vine.co/
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(url)
|
9
|
+
@url = url
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_embed
|
13
|
+
"<iframe class='vine-embed' src='https://vine.co/v/#{vine_id}/embed/simple' width='100%' height='' frameborder='0'></iframe><script async src='//platform.vine.co/static/scripts/embed.js' charset='utf-8'></script>"
|
14
|
+
end
|
15
|
+
|
16
|
+
def vine_id
|
17
|
+
@url.split("/v").last.split("/")[1]
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Zemus
|
2
|
+
class Youtube
|
3
|
+
|
4
|
+
def self.valid?(url)
|
5
|
+
[ /^http(s?):\/\/youtube.com/, /^http(s?):\/\/www.youtube.com/, /^http(s?):\/\/www.m.youtube.com/,
|
6
|
+
/^http(s?):\/\/m.youtube.com/, /^http(s?)(s?):\/\/youtu.be/, /^http(s?):\/\/www.youtu.be/,
|
7
|
+
/^m.youtube.com/, /^youtu.be/, /^youtube.com/ ].map do |link_style|
|
8
|
+
url =~ link_style
|
9
|
+
end.any?
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(url)
|
13
|
+
@url = url
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_embed
|
17
|
+
"<iframe width='100%' height='' src='http://www.youtube.com/embed/#{youtube_id}?wmode=opaque' frameborder='0' allowfullscreen></iframe>"
|
18
|
+
end
|
19
|
+
|
20
|
+
def youtube_id
|
21
|
+
id = ''
|
22
|
+
|
23
|
+
url = @url.gsub("&feature=player_embedded", "")
|
24
|
+
|
25
|
+
if url =~ /\?v=/
|
26
|
+
id = url.split('?v=').last.split("&").first
|
27
|
+
elsif url =~ /&v=/
|
28
|
+
id = url.split('&v=').last.split("&").first
|
29
|
+
else
|
30
|
+
id = url.split('/').last.split("&").first
|
31
|
+
end
|
32
|
+
|
33
|
+
id
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require_relative('../spec_helper')
|
2
|
+
|
3
|
+
describe Zemus::Image do
|
4
|
+
it "embeds images" do
|
5
|
+
url = "http://google.com/image.gif"
|
6
|
+
Zemus::Image.new(url).to_embed.
|
7
|
+
should eq("<img src='http://google.com/image.gif' class='img-responsive img-thumbnail' />")
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative('../spec_helper')
|
2
|
+
|
3
|
+
describe Zemus::Kickstarter do
|
4
|
+
it "embeds kickstarter" do
|
5
|
+
Zemus::Kickstarter.new("http://www.kickstarter.com/projects/sleepninja/monsters-ate-my-birthday-cake").to_embed.
|
6
|
+
should eq("<iframe width='100%' height='' scrolling='no' src='http://www.kickstarter.com/projects/sleepninja/monsters-ate-my-birthday-cake/widget/video.html' frameborder='0'> </iframe><a href='http://www.kickstarter.com/projects/sleepninja/monsters-ate-my-birthday-cake' target='_blank' class='btn btn-default btn-xs'><i class='glyphicon glyphicon-heart'></i> Back this on Kickstarter!</a>")
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative('../spec_helper')
|
2
|
+
|
3
|
+
describe Zemus::Sound do
|
4
|
+
it "embeds sound" do
|
5
|
+
Zemus::Sound.new("http://www.podtrac.com/pts/redirect.mp3/content.duckfeed.tv/bsc/bsc_E001.mp3").to_embed.
|
6
|
+
should eq("<audio controls='controls' class='media-object'><source src='http://www.podtrac.com/pts/redirect.mp3/content.duckfeed.tv/bsc/bsc_E001.mp3' type='audio/mpeg' /></audio><div><a href='http://www.podtrac.com/pts/redirect.mp3/content.duckfeed.tv/bsc/bsc_E001.mp3' target='_blank' class='img-thumbnail' download='bsc_E001.mp3'><i class='glyphicon glyphicon-music'></i> Download this podcast.</a></div>")
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative('../spec_helper')
|
2
|
+
|
3
|
+
describe Zemus::Soundcloud do
|
4
|
+
it "embeds soundcloud" do
|
5
|
+
Zemus::Soundcloud.new("https://soundcloud.com/destructoid/super-mario-world-by-video").to_embed.
|
6
|
+
should eq("<iframe autosize='false' width='100%' height='166' scrolling='no' frameborder='no' src='https://w.soundcloud.com/player/?url=https://soundcloud.com/destructoid/super-mario-world-by-video'></iframe>")
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative('../spec_helper')
|
2
|
+
|
3
|
+
describe Zemus::Vimeo do
|
4
|
+
it "embeds vimeo" do
|
5
|
+
Zemus::Vimeo.new("http://vimeo.com/21929292").to_embed.
|
6
|
+
should eq("<iframe src='http://player.vimeo.com/video/21929292' width='100%' height='' frameborder='0'></iframe>")
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative('../spec_helper')
|
2
|
+
|
3
|
+
describe Zemus::Vine do
|
4
|
+
it "embeds vine" do
|
5
|
+
Zemus::Vine.new("https://vine.co/v/bFPjjheVnau/embed/simple").to_embed.
|
6
|
+
should eq("<iframe class='vine-embed' src='https://vine.co/v/bFPjjheVnau/embed/simple' width='100%' height='' frameborder='0'></iframe><script async src='//platform.vine.co/static/scripts/embed.js' charset='utf-8'></script>")
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative('../spec_helper')
|
2
|
+
|
3
|
+
describe Zemus::Youtube do
|
4
|
+
it "embeds youtube" do
|
5
|
+
Zemus::Youtube.new("youtube.com/watch?v=Ai7pMPCDHpo").to_embed.
|
6
|
+
should eq("<iframe width='100%' height='' src='http://www.youtube.com/embed/Ai7pMPCDHpo?wmode=opaque' frameborder='0' allowfullscreen></iframe>")
|
7
|
+
end
|
8
|
+
end
|
data/spec/zemus_spec.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require_relative('./spec_helper')
|
2
|
+
|
3
|
+
describe Zemus do
|
4
|
+
|
5
|
+
it "accepts test for images" do
|
6
|
+
url = "www.google.com/sample.gif"
|
7
|
+
Zemus.embed(url).should == "<img src='www.google.com/sample.gif' class='img-responsive img-thumbnail' />"
|
8
|
+
|
9
|
+
url = 'http://play-mario-onlne.com/old-school-mario.png'
|
10
|
+
Zemus.embed(url).should == "<img src='http://play-mario-onlne.com/old-school-mario.png' class='img-responsive img-thumbnail' />"
|
11
|
+
|
12
|
+
url = 'http://play-mario-onlne.com/old-school-mario.jpg'
|
13
|
+
Zemus.embed(url).should == "<img src='http://play-mario-onlne.com/old-school-mario.jpg' class='img-responsive img-thumbnail' />"
|
14
|
+
|
15
|
+
url = 'http://play-mario-onlne.com/old-school-mario.jpeg'
|
16
|
+
Zemus.embed(url).should == "<img src='http://play-mario-onlne.com/old-school-mario.jpeg' class='img-responsive img-thumbnail' />"
|
17
|
+
|
18
|
+
url = 'http://play-mario-onlne.com/old-school-mario.GIF'
|
19
|
+
Zemus.embed(url).should == "<img src='http://play-mario-onlne.com/old-school-mario.GIF' class='img-responsive img-thumbnail' />"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "acceptance tests for (kick start) starter" do
|
23
|
+
[
|
24
|
+
"youtube.com/watch?v=Ai7pMPCDHpo", "youtu.be/Ai7pMPCDHpo",
|
25
|
+
"youtube.com/embed/Ai7pMPCDHpo", "youtube.com/watch?feature=player_embedded&v=Ai7pMPCDHpo",
|
26
|
+
"youtube.com/watch?v=Ai7pMPCDHpo&feature=player_embedded",
|
27
|
+
"youtube.com/watch?v=Ai7pMPCDHpo&feature=youtu.be&hd", "m.youtube.com/#/watch?client=mv-google&gl=US&v=Ai7pMPCDHpo&oref=http%3A%2F%2Fm.youtube.com%2F"
|
28
|
+
].each do |url_format|
|
29
|
+
[ "", "http://", "http://www.", "https://", "https://www." ].each do |subdomain|
|
30
|
+
url = "#{subdomain}#{url_format}"
|
31
|
+
|
32
|
+
Zemus.embed(url).should eq("<iframe width='100%' height='' src='http://www.youtube.com/embed/Ai7pMPCDHpo?wmode=opaque' frameborder='0' allowfullscreen></iframe>")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "acceptance tests for sound" do
|
38
|
+
url = "http://www.podtrac.com/pts/redirect.mp3/content.duckfeed.tv/bsc/bsc_E001.mp3"
|
39
|
+
|
40
|
+
Zemus.embed(url).should eq("<audio controls='controls' class='media-object'><source src='http://www.podtrac.com/pts/redirect.mp3/content.duckfeed.tv/bsc/bsc_E001.mp3' type='audio/mpeg' /></audio><div><a href='http://www.podtrac.com/pts/redirect.mp3/content.duckfeed.tv/bsc/bsc_E001.mp3' target='_blank' class='img-thumbnail' download='bsc_E001.mp3'><i class='glyphicon glyphicon-music'></i> Download this podcast.</a></div>")
|
41
|
+
end
|
42
|
+
|
43
|
+
it "acceptance test for sound-claus" do
|
44
|
+
url = "https://soundcloud.com/destructoid/super-mario-world-by-video"
|
45
|
+
|
46
|
+
Zemus.embed(url).should eq("<iframe autosize='false' width='100%' height='166' scrolling='no' frameborder='no' src='https://w.soundcloud.com/player/?url=https://soundcloud.com/destructoid/super-mario-world-by-video'></iframe>")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "acceptance test for vimeo" do
|
50
|
+
url = "http://vimeo.com/21929292"
|
51
|
+
|
52
|
+
Zemus.embed(url).should eq("<iframe src='http://player.vimeo.com/video/21929292' width='100%' height='' frameborder='0'></iframe>")
|
53
|
+
end
|
54
|
+
|
55
|
+
it "acceptance test for vine" do
|
56
|
+
url = "https://vine.co/v/bFPjjheVnau/embed/simple"
|
57
|
+
|
58
|
+
Zemus.embed(url).should eq("<iframe class='vine-embed' src='https://vine.co/v/bFPjjheVnau/embed/simple' width='100%' height='' frameborder='0'></iframe><script async src='//platform.vine.co/static/scripts/embed.js' charset='utf-8'></script>")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "acceptance test for the generic fallback" do
|
62
|
+
url = "http://google.com/asdfhjklkjsdf/43123123/32124lkjklj123123/foo.html"
|
63
|
+
|
64
|
+
Zemus.embed(url).should eq("<a href='http://google.com/asdfhjklkjsdf/43123123/32124lkjklj123123/foo.html' target='_blank'>http://google.com/asdfhjklkjsdf/43123123..</a>")
|
65
|
+
end
|
66
|
+
end
|
data/zemus.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'zemus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "zemus"
|
8
|
+
spec.version = Zemus::VERSION
|
9
|
+
spec.authors = ["Jon Dodson", "Mark Tabler"]
|
10
|
+
spec.email = ["jdodson@cheerfulghost.com", "mark.tabler@fallingmanstudios.net"]
|
11
|
+
spec.description = %q{Embeds various media URLs as viewable content}
|
12
|
+
spec.summary = %q{Parses and embeds various media URLs as viewable content}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zemus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jon Dodson
|
14
|
+
- Mark Tabler
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2013-10-17 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: bundler
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 9
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
version: "1.3"
|
34
|
+
type: :development
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rspec
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
type: :development
|
63
|
+
version_requirements: *id003
|
64
|
+
description: Embeds various media URLs as viewable content
|
65
|
+
email:
|
66
|
+
- jdodson@cheerfulghost.com
|
67
|
+
- mark.tabler@fallingmanstudios.net
|
68
|
+
executables: []
|
69
|
+
|
70
|
+
extensions: []
|
71
|
+
|
72
|
+
extra_rdoc_files: []
|
73
|
+
|
74
|
+
files:
|
75
|
+
- .gitignore
|
76
|
+
- Gemfile
|
77
|
+
- LICENSE.txt
|
78
|
+
- README.md
|
79
|
+
- Rakefile
|
80
|
+
- lib/zemus.rb
|
81
|
+
- lib/zemus/generic.rb
|
82
|
+
- lib/zemus/image.rb
|
83
|
+
- lib/zemus/kickstarter.rb
|
84
|
+
- lib/zemus/parser.rb
|
85
|
+
- lib/zemus/sound.rb
|
86
|
+
- lib/zemus/soundcloud.rb
|
87
|
+
- lib/zemus/version.rb
|
88
|
+
- lib/zemus/vimeo.rb
|
89
|
+
- lib/zemus/vine.rb
|
90
|
+
- lib/zemus/youtube.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
- spec/zemus/image_spec.rb
|
93
|
+
- spec/zemus/kickstarter_spec.rb
|
94
|
+
- spec/zemus/sound_spec.rb
|
95
|
+
- spec/zemus/soundcloud_spec.rb
|
96
|
+
- spec/zemus/version_spec.rb
|
97
|
+
- spec/zemus/vimeo_spec.rb
|
98
|
+
- spec/zemus/vine_spec.rb
|
99
|
+
- spec/zemus/youtube_spec.rb
|
100
|
+
- spec/zemus_spec.rb
|
101
|
+
- zemus.gemspec
|
102
|
+
homepage: ""
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
version: "0"
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
hash: 3
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
version: "0"
|
128
|
+
requirements: []
|
129
|
+
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 1.8.24
|
132
|
+
signing_key:
|
133
|
+
specification_version: 3
|
134
|
+
summary: Parses and embeds various media URLs as viewable content
|
135
|
+
test_files:
|
136
|
+
- spec/spec_helper.rb
|
137
|
+
- spec/zemus/image_spec.rb
|
138
|
+
- spec/zemus/kickstarter_spec.rb
|
139
|
+
- spec/zemus/sound_spec.rb
|
140
|
+
- spec/zemus/soundcloud_spec.rb
|
141
|
+
- spec/zemus/version_spec.rb
|
142
|
+
- spec/zemus/vimeo_spec.rb
|
143
|
+
- spec/zemus/vine_spec.rb
|
144
|
+
- spec/zemus/youtube_spec.rb
|
145
|
+
- spec/zemus_spec.rb
|