ecm_youtube 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3a160b2fa1b6e9803c8c7e1858e853edaab1e9d9
4
+ data.tar.gz: 09ef000af8e3e23e017307061bb99184d038864e
5
+ SHA512:
6
+ metadata.gz: 44b4c8aebd85cccbecdc56875e9c32ca818950a80d3a2cae75c7dbac85d394ac18a1de965da6b5c220fc4265bf93a59207536e92752453d3201005e43a3f1c50
7
+ data.tar.gz: 5941b04786e94bce2b1e42f41473dfa7cc579841f36c6c1a09f115f4cd4b168f89b8feae7930bb302e6f46a82c2cacc2637622150cc6a0f4f40ce7c30a545393
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 Roberto Vasquez Angel
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.rdoc ADDED
@@ -0,0 +1,29 @@
1
+ = Ecm::Youtube
2
+
3
+
4
+ = Prerequisites
5
+
6
+
7
+ = Installation
8
+
9
+ Add it to your gemfile:
10
+
11
+ # Gemfile
12
+ gem 'ecm_youtube'
13
+
14
+ Bundle:
15
+
16
+ > bundle install
17
+
18
+ Add migrations:
19
+
20
+ > rake ecm_youtube:install:migrations
21
+
22
+ Migrate:
23
+
24
+ > rake db:migrate
25
+
26
+
27
+ = Running Specs
28
+
29
+ ./run_specs.sh
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Ecm::Youtube'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ Bundler::GemHelper.install_tasks
18
+
19
+ require 'rails/dummy/tasks'
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,14 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. It is generally better to create a new file per style scope.
11
+ *
12
+ *= require_tree .
13
+ *= require_self
14
+ */
@@ -0,0 +1,6 @@
1
+ module Ecm
2
+ module Youtube
3
+ class ApplicationController < ActionController::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Ecm
2
+ module Youtube
3
+ module ApplicationHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,19 @@
1
+ require_dependency 'concerns/model/translates_value'
2
+
3
+ module Ecm::Youtube
4
+ class Category < ActiveRecord::Base
5
+ include Concerns::Model::TranslatesValue
6
+
7
+ translates_value :identifier
8
+
9
+ # associations
10
+ has_many :videos
11
+
12
+ # validations
13
+ validates :identifier, presence: true, uniqueness: true
14
+
15
+ def human
16
+ "#{self.class.model_name.human}: #{translated_identifier}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,47 @@
1
+ module Ecm::Youtube
2
+ class Video < ActiveRecord::Base
3
+ include ActsAsPublished::ActiveRecord
4
+ include ActsAsList
5
+
6
+ YOUTUBE_METHODS = %w(available? video_id provider title description duration date thumbnail_small thumbnail_medium thumbnail_large embed_url embed_code)
7
+
8
+ acts_as_list scope: 'category_id'
9
+ acts_as_published
10
+
11
+ # associations
12
+ belongs_to :category
13
+
14
+ # callbacks
15
+ before_save :udpate_meta_data, if: Proc.new { |video| video.identifier_changed? }
16
+
17
+ # delegates
18
+ delegate *YOUTUBE_METHODS, to: :meta_data, prefix: true
19
+
20
+ # scopes
21
+ # default_scope { includes(:category).order('ecm_youtube_categories.identifier, position ASC') }
22
+
23
+ # validations
24
+ validates :category_id, presence: true
25
+ validates :identifier, presence: true, uniqueness: { scope: 'category_id' }
26
+
27
+ def human
28
+ "#{self.class.model_name.human}: #{title}"
29
+ end
30
+
31
+ def meta_data
32
+ @meta_data ||= VideoInfo.new(youtube_url)
33
+ end
34
+
35
+ private
36
+
37
+ def udpate_meta_data
38
+ self.title = meta_data_title
39
+ self.description = meta_data_description
40
+ self.duration = meta_data_duration
41
+ end
42
+
43
+ def youtube_url
44
+ "http://www.youtube.com/watch?v=#{identifier}"
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Youtube</title>
5
+ <%= stylesheet_link_tag "ecm/youtube/application", media: "all" %>
6
+ <%= javascript_include_tag "ecm/youtube/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,23 @@
1
+ de:
2
+ activerecord:
3
+ attributes:
4
+ ecm/youtube/category:
5
+ identifier: Bezeichner
6
+ created_at: Erstellt am
7
+ updated_at: Aktualisiert am
8
+ ecm/youtube/video:
9
+ category: Kategorie
10
+ description: Beschreibung
11
+ duration: Länge
12
+ identifier: Bezeichner
13
+ preview: Vorschau
14
+ title: Titel
15
+ created_at: Erstellt am
16
+ updated_at: Aktualisiert am
17
+ models:
18
+ ecm/youtube/category:
19
+ one: Kategorie
20
+ other: Kategorien
21
+ ecm/youtube/video:
22
+ one: Video
23
+ other: Videos
@@ -0,0 +1,23 @@
1
+ en:
2
+ activerecord:
3
+ attributes:
4
+ ecm/youtube/category:
5
+ identifier: Identifier
6
+ created_at: Created at
7
+ updated_at: Updated at
8
+ ecm/youtube/video:
9
+ category: Category
10
+ description: Description
11
+ duation: Duration
12
+ identifier: Identifier
13
+ preview: Preview
14
+ title: Title
15
+ created_at: Created at
16
+ updated_at: Updated at
17
+ models:
18
+ ecm/youtube/category:
19
+ one: Category
20
+ other: Categories
21
+ ecm/youtube/video:
22
+ one: Video
23
+ other: Videos
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Ecm::Youtube::Engine.routes.draw do
2
+ end
@@ -0,0 +1,9 @@
1
+ class CreateEcmYoutubeCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_youtube_categories do |t|
4
+ t.string :identifier
5
+
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ class CreateEcmYoutubeVideos < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_youtube_videos do |t|
4
+ t.integer :category_id, index: true
5
+ t.string :identifier
6
+ t.timestamp :published_at
7
+ t.integer :position
8
+
9
+ t.string :title
10
+ t.text :description
11
+ t.integer :duration
12
+
13
+ t.timestamps null: false
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ module Ecm
2
+ module Youtube
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Ecm::Youtube
5
+
6
+ config.generators do |g|
7
+ g.test_framework :rspec, fixture: false
8
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
9
+ g.assets false
10
+ g.helper false
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ module Ecm
2
+ module Youtube
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module Ecm
2
+ module Youtube
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ require 'acts_as_list'
2
+ require 'acts_as_published'
3
+ require 'rails_translates_value'
4
+ require 'video_info'
5
+
6
+ require 'ecm/youtube'
7
+ require 'ecm/youtube/engine'
@@ -0,0 +1,21 @@
1
+ module Ecm
2
+ module Youtube
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc 'Nothing to do at the moment'
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ # def generate_initializer
10
+ # copy_file 'initializer.rb', 'config/initializers/ecm_youtube.rb'
11
+ # end
12
+
13
+ # def generate_routes
14
+ # inject_into_file 'config/routes.rb', before: "\nend" do
15
+ # File.read(File.join(File.expand_path('../templates', __FILE__), 'routes.source'))
16
+ # end
17
+ # end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,2 @@
1
+ Ecm::Youtube.configure do |config|
2
+ end
@@ -0,0 +1,2 @@
1
+
2
+ # ECM Youtube Frontend Routing
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :youtube do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,278 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ecm_youtube
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Roberto Vasquez Angel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: acts_as_list
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: acts_as_published
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails_translates_value
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: video_info
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sqlite3
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rails-dummy
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-bundler
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-rails
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: guard-rspec
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rspec-rails
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: capybara
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: factory_girl_rails
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: shoulda-matchers
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ description: Youtube Module
224
+ email:
225
+ - roberto@vasquez-angel.de
226
+ executables: []
227
+ extensions: []
228
+ extra_rdoc_files: []
229
+ files:
230
+ - MIT-LICENSE
231
+ - README.rdoc
232
+ - Rakefile
233
+ - app/assets/javascripts/ecm/youtube/application.js
234
+ - app/assets/stylesheets/ecm/youtube/application.css
235
+ - app/controllers/ecm/youtube/application_controller.rb
236
+ - app/helpers/ecm/youtube/application_helper.rb
237
+ - app/models/ecm/youtube/category.rb
238
+ - app/models/ecm/youtube/video.rb
239
+ - app/views/layouts/ecm/youtube/application.html.erb
240
+ - config/locales/de.yml
241
+ - config/locales/en.yml
242
+ - config/routes.rb
243
+ - db/migrate/20151226161813_create_ecm_youtube_categories.rb
244
+ - db/migrate/20151226161819_create_ecm_youtube_videos.rb
245
+ - lib/ecm/youtube.rb
246
+ - lib/ecm/youtube/engine.rb
247
+ - lib/ecm/youtube/version.rb
248
+ - lib/ecm_youtube.rb
249
+ - lib/generators/ecm/youtube/install/install_generator.rb
250
+ - lib/generators/ecm/youtube/install/templates/initializer.rb
251
+ - lib/generators/ecm/youtube/install/templates/routes.source
252
+ - lib/tasks/ecm/youtube_tasks.rake
253
+ homepage: https://github.com/robotex82/ecm_youtube
254
+ licenses:
255
+ - MIT
256
+ metadata: {}
257
+ post_install_message:
258
+ rdoc_options: []
259
+ require_paths:
260
+ - lib
261
+ required_ruby_version: !ruby/object:Gem::Requirement
262
+ requirements:
263
+ - - ">="
264
+ - !ruby/object:Gem::Version
265
+ version: '0'
266
+ required_rubygems_version: !ruby/object:Gem::Requirement
267
+ requirements:
268
+ - - ">="
269
+ - !ruby/object:Gem::Version
270
+ version: '0'
271
+ requirements: []
272
+ rubyforge_project:
273
+ rubygems_version: 2.4.8
274
+ signing_key:
275
+ specification_version: 4
276
+ summary: Youtube Module
277
+ test_files: []
278
+ has_rdoc: