linkingpaths-acts_as_videoclub 0.0.2

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/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Linking Paths (http://www.linkingpaths.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,42 @@
1
+ ActsAsVideoclub
2
+ ===============
3
+
4
+ Allows for videos to be added to any model, with a helper for showing them on views
5
+
6
+ Right now it supports YouTube and Vimeo APIs, but adding additional sources is something trivial.
7
+
8
+
9
+ == Resources
10
+
11
+ Install
12
+ * Run the following command:
13
+
14
+ script/plugin install git://github.com/linkingpaths/acts_as_videoclub.git
15
+
16
+ == Usage
17
+
18
+ * Make your ActiveRecord model act as videoclub.
19
+
20
+ class Flat < ActiveRecord::Base
21
+ acts_as_videoclub
22
+ end
23
+
24
+ * Add a video
25
+
26
+ XXXX
27
+
28
+ * Show a video
29
+
30
+ XXXX
31
+
32
+ == Credits
33
+
34
+ XXXXX
35
+
36
+ == More
37
+
38
+ http://github.com/linkingpaths/acts_as_videoclub
39
+ http://github.com/linkingpaths/acts_as_videoclub/wikis
40
+
41
+
42
+ Copyright (c) 2008 Linking Paths, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the acts_as_videoclub plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for the acts_as_videoclub plugin.'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'ActsAsVideoclub'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ end
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{acts_as_videoclub}
3
+ s.version = "0.0.2"
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Linking Paths"]
7
+ s.date = %q{2008-10-16}
8
+ s.description = %q{External Video management plugin.}
9
+ s.email = ["aitor@linkingpaths.com"]
10
+ s.files = ["MIT-LICENSE", "README", "Rakefile", "acts_as_videoclub.gemspec", "generators", "generators/acts_as_videoclub_migration", "generators/acts_as_videoclub_migration/acts_as_videoclub_migration_generator.rb", "generators/acts_as_videoclub_migration/templates", "generators/acts_as_videoclub_migration/templates/migration.rb", "init.rb", "lib", "lib/acts_as_videoclub.rb", "lib/video.rb", "lib/videoclub_helper.rb", "tasks", "tasks/acts_as_videoclub_tasks.rake", "test", "test/acts_as_videoclub_test.rb"]
11
+ s.has_rdoc = true
12
+ s.homepage = %q{http://github.com/linkingpaths/acts_as_videoclub}
13
+ s.post_install_message = %q{
14
+ For more information on acts_as_videoclub, see http://github.com/linkingpaths/acts_as_videoclub
15
+
16
+ }
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{acts_as_videoclub}
19
+ s.rubygems_version = %q{1.2.0}
20
+ s.summary = %q{External Video management plugin.}
21
+
22
+ end
@@ -0,0 +1,13 @@
1
+ class ActsAsVideoclubMigrationGenerator < Rails::Generator::Base
2
+
3
+ def manifest
4
+ record do |m|
5
+ m.migration_template 'migration.rb', 'db/migrate'
6
+ end
7
+ end
8
+
9
+ def file_name
10
+ "acts_as_videoclub_migration"
11
+ end
12
+
13
+ end
@@ -0,0 +1,19 @@
1
+ class ActsAsVideoclubMigration < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :videos do |t|
5
+ t.string :source_url
6
+ t.string :title
7
+ t.string :description
8
+ t.integer :resource_id
9
+ t.string :resource_type
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+
15
+ def self.down
16
+ drop_table :videos
17
+ end
18
+
19
+ end
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'acts_as_videoclub'
@@ -0,0 +1,32 @@
1
+ require 'videoclub_helper'
2
+
3
+ module LinkingPaths
4
+ module Acts #:nodoc:
5
+ module Videoclub #:nodoc:
6
+
7
+ def self.included(base)
8
+ base.extend ClassMethods
9
+ end
10
+
11
+ module ClassMethods
12
+ def acts_as_videoclub
13
+ has_many :videos, :as => :resource
14
+
15
+ include LinkingPaths::Acts::Videoclub::InstanceMethods
16
+ end
17
+ end
18
+
19
+ # Adds instance methods.
20
+ module InstanceMethods
21
+ def has_videos?
22
+ self.videos.size > 0
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+ end
29
+
30
+ ActiveRecord::Base.send :include, LinkingPaths::Acts::Videoclub
31
+
32
+ ActionView::Base.send :include, LinkingPaths::Videoclub::Helper
data/lib/video.rb ADDED
@@ -0,0 +1,3 @@
1
+ class Video < ActiveRecord::Base
2
+ belongs_to :resource, :polymorphic => true
3
+ end
@@ -0,0 +1,38 @@
1
+ module LinkingPaths
2
+ module Videoclub #:nodoc:
3
+ module Helper #:nodoc:
4
+
5
+ def video_embed_code(video, options={})
6
+ options[:width] ||= "452"
7
+ options[:height] ||= "354"
8
+
9
+ case video.source_url
10
+ when /youtube/
11
+ video.source_url =~ /v=([^&]+)/
12
+ id = $1
13
+ <<-EOS
14
+ <object width="#{options[:width]}" height="#{options[:height]}">
15
+ <param name="movie" value="http://www.youtube.com/v/#{id}&hl=es"></param>
16
+ <param name="wmode" value="transparent"></param>
17
+ <embed src="http://www.youtube.com/v/#{id}&hl=es" type="application/x-shockwave-flash" wmode="transparent" width="#{options[:width]}" height="#{options[:height]}"></embed>
18
+ </object>
19
+ EOS
20
+ when /vimeo/
21
+ video.source_url =~ /vimeo.com\/([^&]+)/
22
+ id = $1
23
+ <<-EOS
24
+ <object type="application/x-shockwave-flash" width="#{options[:width]}" height="#{options[:height]}" data="http://www.vimeo.com/moogaloop.swf?clip_id=#{id}&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=">
25
+ <param name="quality" value="best" />
26
+ <param name="allowfullscreen" value="true" />
27
+ <param name="scale" value="showAll" />
28
+ <param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=#{id}&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" />
29
+ </object>
30
+ EOS
31
+ else
32
+ "El servicio de video usado no está soportado aun por el sistema o la url es incorrecta."
33
+ end
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :acts_as_videoclub do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,8 @@
1
+ require 'test/unit'
2
+
3
+ class ActsAsVideoclubTest < Test::Unit::TestCase
4
+ # Replace this with your real tests.
5
+ def test_this_plugin
6
+ flunk
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: linkingpaths-acts_as_videoclub
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Linking Paths
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-16 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: External Video management plugin.
17
+ email:
18
+ - aitor@linkingpaths.com
19
+ executables: []
20
+
21
+ extensions: []
22
+
23
+ extra_rdoc_files: []
24
+
25
+ files:
26
+ - MIT-LICENSE
27
+ - README
28
+ - Rakefile
29
+ - acts_as_videoclub.gemspec
30
+ - generators
31
+ - generators/acts_as_videoclub_migration
32
+ - generators/acts_as_videoclub_migration/acts_as_videoclub_migration_generator.rb
33
+ - generators/acts_as_videoclub_migration/templates
34
+ - generators/acts_as_videoclub_migration/templates/migration.rb
35
+ - init.rb
36
+ - lib
37
+ - lib/acts_as_videoclub.rb
38
+ - lib/video.rb
39
+ - lib/videoclub_helper.rb
40
+ - tasks
41
+ - tasks/acts_as_videoclub_tasks.rake
42
+ - test
43
+ - test/acts_as_videoclub_test.rb
44
+ has_rdoc: true
45
+ homepage: http://github.com/linkingpaths/acts_as_videoclub
46
+ post_install_message: |+
47
+
48
+ For more information on acts_as_videoclub, see http://github.com/linkingpaths/acts_as_videoclub
49
+
50
+ rdoc_options: []
51
+
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ requirements: []
67
+
68
+ rubyforge_project: acts_as_videoclub
69
+ rubygems_version: 1.2.0
70
+ signing_key:
71
+ specification_version: 2
72
+ summary: External Video management plugin.
73
+ test_files: []
74
+