blacklight-oembed 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 211931b0cdb41733c7a529ab07d4572921cc14ee
4
+ data.tar.gz: 2b6ec428af9919ae26b07e85cb60a29d94a830fe
5
+ SHA512:
6
+ metadata.gz: aa1956739ff28d2c74ffae1117dc54c0f6e4de61d763b6fb6391eaef29f122601222152535a77d428f5c592ef506a69de6102a05d637fbdd6f86dfe0fcf60db8
7
+ data.tar.gz: 67b7032a9a09af0c4f570d606a339acc6c9f7bc08dea8e883a4875159da667cf7c97a7a37e1f2e41a249109d20f9bf054d83b0b73879266dbdb265344f4af1ac
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ jetty
19
+ spec/internal
data/.travis.yml ADDED
@@ -0,0 +1,18 @@
1
+ notifications:
2
+ email: false
3
+
4
+ rvm:
5
+ - 2.1.0
6
+ - 2.0.0
7
+ - 1.9.3
8
+ - jruby-19mode
9
+
10
+ notifications:
11
+ irc: "irc.freenode.org#blacklight"
12
+ email:
13
+ - blacklight-commits@googlegroups.com
14
+
15
+ env:
16
+ global:
17
+ - JRUBY_OPTS="-J-Xms512m -J-Xmx1024m"
18
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
data/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in blacklight-gallery.gemspec
4
+ gemspec
5
+
6
+ file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__))
7
+ if File.exists?(file)
8
+ puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
9
+ instance_eval File.read(file)
10
+ else
11
+ gem 'rails', ENV['RAILS_VERSION']
12
+
13
+ # explicitly include sass-rails to get compatible sprocket dependencies
14
+ if ENV['RAILS_VERSION'] and ENV['RAILS_VERSION'] =~ /^4.2/
15
+ gem 'sass-rails', ">= 5.0.0.beta1"
16
+ gem 'responders', "~> 2.0"
17
+ else
18
+ gem 'sass-rails'
19
+ gem 'coffee-rails', "~> 4.0.0"
20
+ end
21
+ end
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2014 The Board of Trustees of the Leland Stanford Junior University.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Blacklight::Oembed
2
+ [![Gem Version](https://badge.fury.io/rb/blacklight-oembed.svg)](http://badge.fury.io/rb/blacklight-oembed)
3
+
4
+ Oembed views for Blacklight search results
5
+
6
+ ## Installation
7
+
8
+ Add this line to your Blacklight application's Gemfile:
9
+
10
+ gem 'blacklight-oembed'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install blacklight-oembed
19
+
20
+ ## Usage
21
+
22
+ Run the gallery generator:
23
+
24
+ $ rails g blacklight_oembed:install
25
+
26
+ ## Screenshot
27
+
28
+ ![Screenshot](docs/screen_shot.png)
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it ( http://github.com/<my-github-username>/blacklight-oembed/fork )
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,61 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.2.zip"
4
+ APP_ROOT = File.dirname(__FILE__)
5
+
6
+ require 'rspec/core/rake_task'
7
+ require 'engine_cart/rake_task'
8
+
9
+ require 'jettywrapper'
10
+
11
+ task :default => :ci
12
+
13
+ desc "Run specs"
14
+ RSpec::Core::RakeTask.new do |t|
15
+
16
+ end
17
+
18
+ desc "Load fixtures"
19
+ task :fixtures => ['engine_cart:generate'] do
20
+ within_test_app do
21
+ system "rake blacklight:solr:seed RAILS_ENV=test"
22
+ abort "Error running fixtures" unless $?.success?
23
+ end
24
+ end
25
+
26
+ desc "Execute Continuous Integration build"
27
+ task :ci => ['jetty:clean', 'engine_cart:generate'] do
28
+
29
+ ENV['environment'] = "test"
30
+ jetty_params = Jettywrapper.load_config
31
+ jetty_params[:startup_wait]= 60
32
+
33
+ Jettywrapper.wrap(jetty_params) do
34
+ Rake::Task['fixtures'].invoke
35
+ Rake::Task['spec'].invoke
36
+ end
37
+ end
38
+
39
+ task :server do
40
+ if File.exists? 'spec/internal'
41
+ within_test_app do
42
+ system "bundle update"
43
+ end
44
+ else
45
+ Rake::Task['engine_cart:generate'].invoke
46
+ end
47
+
48
+ unless File.exists? 'jetty'
49
+ Rake::Task['jetty:clean'].invoke
50
+ end
51
+
52
+ jetty_params = Jettywrapper.load_config
53
+ jetty_params[:startup_wait]= 60
54
+
55
+ Jettywrapper.wrap(jetty_params) do
56
+ within_test_app do
57
+ system "rake blacklight:solr:seed"
58
+ system "bundle exec rails s"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,15 @@
1
+ module Blacklight::Oembed
2
+ module OembedHelper
3
+ def render_oembed_tag document
4
+ url = document.first(blacklight_config.show.oembed_field)
5
+
6
+ return if url.blank?
7
+
8
+ begin
9
+ OEmbed::Providers.get(url).html.html_safe
10
+ rescue OEmbed::NotFound
11
+ link_to t(:'blacklight_oembed.catalog.view'), url
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ <% if rendered = render_oembed_tag(document) %>
2
+ <div class="oembed-widget">
3
+ <%= rendered %>
4
+ </div>
5
+ <% end %>
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'blacklight/oembed/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "blacklight-oembed"
8
+ spec.version = Blacklight::Oembed::VERSION
9
+ spec.authors = ["Chris Beer"]
10
+ spec.email = ["cabeer@stanford.edu"]
11
+ spec.summary = %q{Oembed display for Blacklight}
12
+ spec.homepage = "https://github.com/sul-dlss/blacklight-oembed"
13
+ spec.license = "Apache 2.0"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "rails"
21
+ spec.add_dependency "blacklight", "~> 5.0"
22
+ spec.add_dependency "bootstrap-sass", "~> 3.0"
23
+ spec.add_dependency "ruby-oembed"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.5"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "rspec-rails", "~> 3.1"
28
+ spec.add_development_dependency "rspec-its"
29
+ spec.add_development_dependency "rspec-activemodel-mocks"
30
+ spec.add_development_dependency "rspec-collection_matchers"
31
+ spec.add_development_dependency "jettywrapper"
32
+ spec.add_development_dependency "engine_cart"
33
+ spec.add_development_dependency "capybara"
34
+ spec.add_development_dependency "poltergeist", ">= 1.5.0"
35
+ end
data/config/jetty.yml ADDED
@@ -0,0 +1,6 @@
1
+ default:
2
+ jetty_port: 8983
3
+ test:
4
+ jetty_port: <%= ENV['TEST_JETTY_PORT'] || 8888 %>
5
+ jetty_home: <%= ENV['TEST_JETTY_PATH'] || File.expand_path(File.join('..', 'jetty'), __FILE__) %>
6
+ startup_wait: 15
@@ -0,0 +1,4 @@
1
+ en:
2
+ blacklight_oembed:
3
+ catalog:
4
+ view: View
data/config/routes.rb ADDED
File without changes
@@ -0,0 +1,13 @@
1
+ require 'blacklight'
2
+
3
+ module Blacklight
4
+ module Oembed
5
+ class Engine < Rails::Engine
6
+
7
+ initializer "oembed.initialize" do
8
+ OEmbed::Providers.register_all
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Blacklight
2
+ module Oembed
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "blacklight/oembed/version"
2
+ require 'oembed'
3
+ module Blacklight
4
+ module Oembed
5
+ require 'blacklight/oembed/engine'
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ require 'rails/generators'
2
+
3
+ module BlacklightOembed
4
+ class Install < Rails::Generators::Base
5
+
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ def assets
9
+ copy_file "blacklight_oembed.css.scss", "app/assets/stylesheets/blacklight_oembed.css.scss"
10
+ copy_file "blacklight_oembed.js", "app/assets/javascripts/blacklight_oembed.js"
11
+ end
12
+
13
+
14
+ def configuration
15
+ inject_into_file 'app/controllers/catalog_controller.rb', after: "configure_blacklight do |config|" do
16
+ <<-EOF
17
+
18
+ config.show.oembed_field = :oembed_url_ssm
19
+ config.show.partials.insert(1, :oembed)
20
+ EOF
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+
3
+ require 'engine_cart'
4
+ EngineCart.load_application!
5
+
6
+ require 'rspec/collection_matchers'
7
+ require 'rspec/its'
8
+ require 'rspec/rails'
9
+ require 'rspec/active_model/mocks'
10
+
11
+ require 'capybara/poltergeist'
12
+ Capybara.javascript_driver = :poltergeist
13
+
14
+ require 'blacklight'
15
+ require 'blacklight/oembed'
16
+
17
+ RSpec.configure do |c|
18
+ c.infer_spec_type_from_file_location!
19
+ end
@@ -0,0 +1,24 @@
1
+ require 'rails/generators'
2
+
3
+ class TestAppGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../../../test_app_templates", __FILE__)
5
+
6
+ def remove_index
7
+ remove_file "public/index.html"
8
+ end
9
+
10
+ def run_blacklight_generator
11
+ say_status("warning", "GENERATING BL", :yellow)
12
+
13
+ Bundler.with_clean_env do
14
+ run "bundle install"
15
+ end
16
+
17
+ generate 'blacklight:install'
18
+ end
19
+
20
+ def run_oembed_install
21
+ generate 'blacklight_oembed:install'
22
+ end
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,262 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blacklight-oembed
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Chris Beer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-18 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: blacklight
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bootstrap-sass
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby-oembed
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: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
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: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.1'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec-its
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: rspec-activemodel-mocks
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: rspec-collection_matchers
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: jettywrapper
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: engine_cart
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: poltergeist
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: 1.5.0
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: 1.5.0
209
+ description:
210
+ email:
211
+ - cabeer@stanford.edu
212
+ executables: []
213
+ extensions: []
214
+ extra_rdoc_files: []
215
+ files:
216
+ - ".gitignore"
217
+ - ".travis.yml"
218
+ - Gemfile
219
+ - LICENSE
220
+ - README.md
221
+ - Rakefile
222
+ - app/helpers/blacklight/oembed/oembed_helper.rb
223
+ - app/views/catalog/_oembed_default.html.erb
224
+ - blacklight-oembed.gemspec
225
+ - config/jetty.yml
226
+ - config/locales/blacklight-oembed.en.yml
227
+ - config/routes.rb
228
+ - lib/blacklight/oembed.rb
229
+ - lib/blacklight/oembed/engine.rb
230
+ - lib/blacklight/oembed/version.rb
231
+ - lib/generators/blacklight_oembed/install_generator.rb
232
+ - lib/generators/blacklight_oembed/templates/blacklight_oembed.css.scss
233
+ - lib/generators/blacklight_oembed/templates/blacklight_oembed.js
234
+ - spec/spec_helper.rb
235
+ - spec/test_app_templates/lib/generators/test_app_generator.rb
236
+ homepage: https://github.com/sul-dlss/blacklight-oembed
237
+ licenses:
238
+ - Apache 2.0
239
+ metadata: {}
240
+ post_install_message:
241
+ rdoc_options: []
242
+ require_paths:
243
+ - lib
244
+ required_ruby_version: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - ">="
247
+ - !ruby/object:Gem::Version
248
+ version: '0'
249
+ required_rubygems_version: !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - ">="
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ requirements: []
255
+ rubyforge_project:
256
+ rubygems_version: 2.2.2
257
+ signing_key:
258
+ specification_version: 4
259
+ summary: Oembed display for Blacklight
260
+ test_files:
261
+ - spec/spec_helper.rb
262
+ - spec/test_app_templates/lib/generators/test_app_generator.rb