Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

different tests and corrections

  • Loading branch information...
commit 0ef1e287db024964ce19c20476857dda7a69418b 1 parent 2bfd455
@mamuso mamuso authored
View
38 README.markdown
@@ -1,4 +1,36 @@
-Videogrinder
-============
+Acts as unvlogable
+==================
+
+What the hell is this!
+----------------------
+
+This is the plugin that we use in [unvlog.com](http://unvlog.com) to manage the supported video services. Is an easy way to obtain a few basics about a video only through its url.
+
+A quick example:
+
+To include [this video](http://www.youtube.com/watch?v=GPQnbtldFyo) in [this post](http://unvlog.com/blat/2008/3/10/otro-pelotazo) we need to know its title, the correct way to embed it and its thumbnail url. With this plugin we have an easy access to this data:
+
+ @aha = UnvlogIt.new("http://www.youtube.com/watch?v=GPQnbtldFyo")
+ @aha.title => "paradon del portero"
+ @aha.thumbnail => "http://i4.ytimg.com/vi/GPQnbtldFyo/default.jpg"
+ @aha.embed_url => "http://www.youtube.com/v/GPQnbtldFyo"
+ @aha.embed_html(width, height) => "<object [...]</object>"
+
+There is also a method to know where to download the flv.
+
+
+Install it!
+-----------
+
+1. That is a plugin, then you need to do:
+
+ script/plugin install git://github.com/mamuso/acts_as_unvlogable.git
+
+2. Optionally you can create the `config/unvlogable.yml` to store keys for the different services. You have in the plugin a [sample file](http://github.com/mamuso/acts_as_unvlogable/tree/master/unvlogable_sample.yml)
+
+
+And... what else?
+-----------------
+
+To know the supported services and particular uses we will do (in a near future :D) a complete documentation in [the wiki](https://github.com/mamuso/acts_as_unvlogable/wikis)
-I swear this project will be documented soon.
View
6 Rakefile
@@ -5,17 +5,17 @@ require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
-desc 'Test the videogrinder plugin.'
+desc 'Test the acts_as_unvlogable plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
-desc 'Generate documentation for the videogrinder plugin.'
+desc 'Generate documentation for the acts_as_unvlogable plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'Videogrinder'
+ rdoc.title = 'Acts As Unvlogable'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
View
2  init.rb
@@ -1,5 +1,5 @@
# Main class
-require 'videogrinder'
+require 'acts_as_unvlogable'
# Gems & other herbs
require 'open-uri'
View
2  lib/videogrinder.rb → lib/acts_as_unvlogable.rb
@@ -1,4 +1,4 @@
-class Videogrinder
+class UnvlogIt
def initialize(url=nil, key=nil)
raise ArgumentError.new("We need a video url") if url.blank?
View
2  lib/vg_youtube.rb
@@ -8,7 +8,7 @@ class VgYoutube
def initialize(url=nil, key=nil)
# general settings
- settings ||= YAML.load_file(RAILS_ROOT + '/config/videogrinder.yml') rescue {}
+ settings ||= YAML.load_file(RAILS_ROOT + '/config/unvlogable.yml') rescue {}
object = YouTube::Client.new(key.nil? ? settings['youtube_key'] : key) rescue {}
@url = url
View
27 test/videogrinder_test.rb → test/acts_as_unvlogable_test.rb
@@ -5,7 +5,7 @@
$LOAD_PATH << File.dirname(__FILE__) + '/../lib'
# Main class
-require 'videogrinder'
+require 'acts_as_unvlogable'
# Gems & other herbs
require 'open-uri'
require 'youtube'
@@ -14,25 +14,28 @@
require 'vg_google'
-class VideogrinderTest < Test::Unit::TestCase
+class ActsAsUnvlogableTest < Test::Unit::TestCase
- context "Instancing Videogrinder" do
+ context "Instancing UnvlogIt" do
context "without any url" do
should "raise an ArgumentError exception" do
- assert_raise(ArgumentError, "We need a video url") { Videogrinder.new }
+ assert_raise(ArgumentError, "We need a video url") { UnvlogIt.new }
end
end
context "with an unsupported url" do
should "raise an ArgumentError exception" do
- assert_raise(ArgumentError, "Unsuported url or service") { Videogrinder.new("http://iwannagothere.net/") }
+ assert_raise(ArgumentError, "Unsuported url or service") { UnvlogIt.new("http://iwannagothere.net/") }
end
end
+# ----------------------------------------------------------
+# Testing youtube
+# ----------------------------------------------------------
context "with an existent youtube url" do
setup do
- @videotron = Videogrinder.new("http://www.youtube.com/watch?v=muLIPWjks_M", "RCofu-vAmeY") # => Ninja cat comes closer while not moving!
+ @videotron = UnvlogIt.new("http://www.youtube.com/watch?v=muLIPWjks_M", "RCofu-vAmeY") # => Ninja cat comes closer while not moving!
end
should "initialize a VgYoutube instance" do
assert_equal VgYoutube, @videotron.instance_values['object'].class
@@ -54,7 +57,7 @@ class VideogrinderTest < Test::Unit::TestCase
context "with an existent youtube url that can not be embedded" do
setup do
- @videotron = Videogrinder.new("http://www.youtube.com/watch?v=3Oec8RuwVVs", "RCofu-vAmeY") # => The Killers - Read My Mind
+ @videotron = UnvlogIt.new("http://www.youtube.com/watch?v=3Oec8RuwVVs", "RCofu-vAmeY") # => The Killers - Read My Mind
end
should "initialize a VgYoutube instance" do
assert_equal VgYoutube, @videotron.instance_values['object'].class
@@ -75,6 +78,16 @@ class VideogrinderTest < Test::Unit::TestCase
end
end
+ context "with an inexistent youtube url" do
+ should "raise an ArgumentError" do
+ assert_raise(ArgumentError, "Unsuported url or service") { UnvlogIt.new("http://www.youtube.com/watch?v=inexistente", "RCofu-vAmeY") }
+ end
+ end
+
+
+
+
+
end
end
View
0  videogrinder_sample.yml → unvlogable_sample.yml
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.