blacklight-oembed 0.1.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: db9d87b367dffd26913c0d1a57db4a08e2da50b2
4
- data.tar.gz: 1544b62ac3ab14deadbd1e11cea9d39563e60dbd
2
+ SHA256:
3
+ metadata.gz: 3c971144b04f02227444c36d711fb95b94dbcfe2a9127d2b89e15b194cb26296
4
+ data.tar.gz: ab3c66a5322c9d903ba28b00300b31191a1633ddd5baf7c4f471de8a90003286
5
5
  SHA512:
6
- metadata.gz: b800826445f20a4e9293daf0748e1d6281b972cf102a1cb79353680aec07c1b01b61d230b7f9cd8331ed4a7bb13c0154cc45f77af873f6514a5ecc28e5171072
7
- data.tar.gz: c78c6fa174c2da2b4f8ecb434041bad4e8489e40fb7861ea35c65bdd8a4502f545df2214f21d38f902437025fd50dd4569276c830e7451e247f5147d0515f09c
6
+ metadata.gz: 41af86fc4a6389c6e42168e5b59345c6c0ec45b05cd27585f5af8a8fdb2253ef55313062bd70f837c5522062627d258a125308858520c0ec980da33b593c1de0
7
+ data.tar.gz: 6cac86875cdfc798411c1fa5a433740521610712a32473c1d32b77743813ad7b5eebfd2e47c67d268cfc6ed6ab956f06eb7340fd25b5d321c167023eb5663107
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ tests_rails:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby: [2.7, 3.0]
15
+ rails_version: [5.2.4.4, 6.0.3.2, 6.1.1]
16
+ exclude:
17
+ - ruby: '3.0'
18
+ rails_version: '5.2.4.4'
19
+ env:
20
+ RAILS_VERSION: ${{ matrix.rails_version }}
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{ matrix.ruby }}
27
+ - name: Install dependencies
28
+ run: bundle install
29
+ - name: Run tests
30
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -15,5 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- jetty
19
- .internal_test_app
18
+ .internal_test_app
data/Gemfile CHANGED
@@ -3,11 +3,16 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in blacklight-gallery.gemspec
4
4
  gemspec
5
5
 
6
+ git_source(:github) do |repo_name|
7
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
8
+ "https://github.com/#{repo_name}.git"
9
+ end
10
+
6
11
  # BEGIN ENGINE_CART BLOCK
7
- # engine_cart: 0.8.0
8
- # engine_cart stanza: 0.8.0
12
+ # engine_cart: 2.2.1
13
+ # engine_cart stanza: 0.10.0
9
14
  # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
10
- file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
15
+ file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
11
16
  if File.exist?(file)
12
17
  begin
13
18
  eval_gemfile file
@@ -18,14 +23,27 @@ if File.exist?(file)
18
23
  else
19
24
  Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
20
25
 
21
- gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
26
+ if ENV['RAILS_VERSION']
27
+ if ENV['RAILS_VERSION'] == 'edge'
28
+ gem 'rails', github: 'rails/rails'
29
+ ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
30
+ else
31
+ gem 'rails', ENV['RAILS_VERSION']
32
+ end
33
+ end
22
34
 
23
- if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
24
- gem 'responders', "~> 2.0"
25
- gem 'sass-rails', ">= 5.0"
26
- else
27
- gem 'bootstrap-sass', '< 3.3.5' # 3.3.5 requires sass 3.3, incompatible with sass-rails 4.x
28
- gem 'sass-rails', "< 5.0"
35
+ case ENV['RAILS_VERSION']
36
+ when /^5.[12]/
37
+ gem 'sass-rails', '~> 5.0'
38
+ when /^4.2/
39
+ gem 'responders', '~> 2.0'
40
+ gem 'sass-rails', '>= 5.0'
41
+ gem 'coffee-rails', '~> 4.1.0'
42
+ when /^4.[01]/
43
+ gem 'sass-rails', '< 5.0'
29
44
  end
30
45
  end
31
46
  # END ENGINE_CART BLOCK
47
+ unless File.exist?(file)
48
+ eval_gemfile File.expand_path('spec/test_app_templates/Gemfile.extra', File.dirname(__FILE__))
49
+ end
data/README.md CHANGED
@@ -56,6 +56,14 @@ OEmbed::Providers.register(purl_provider)
56
56
 
57
57
  You need a solr field containing a URL to an embeddable object.
58
58
 
59
+ ### Additional configurations
60
+ Blacklight OEmbed allows for more configurations. In an initializer, you can add additional params that will be passed through to an OEmbed provider.
61
+
62
+ ```
63
+ # config/initializers/blacklight_oembed.rb
64
+ Blacklight::Oembed::Engine.config.additional_params = [:canvas_index]
65
+ ```
66
+
59
67
  ## Contributing
60
68
 
61
69
  1. Fork it ( http://github.com/sul-dlss/blacklight-oembed/fork )
data/Rakefile CHANGED
@@ -1,12 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
- ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip"
4
3
  APP_ROOT = File.dirname(__FILE__)
5
4
 
6
5
  require 'rspec/core/rake_task'
7
6
  require 'engine_cart/rake_task'
8
-
9
- require 'jettywrapper'
7
+ require 'solr_wrapper'
10
8
 
11
9
  task :default => :ci
12
10
 
@@ -24,15 +22,14 @@ task :fixtures => ['engine_cart:generate'] do
24
22
  end
25
23
 
26
24
  desc "Execute Continuous Integration build"
27
- task :ci => ['jetty:clean', 'engine_cart:generate'] do
25
+ task ci: 'engine_cart:generate' do
28
26
 
29
27
  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
28
+ SolrWrapper.wrap(port: '8983') do |solr|
29
+ solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path(File.dirname(__FILE__)), 'solr', 'conf')) do
30
+ Rake::Task['fixtures'].invoke
31
+ Rake::Task['spec'].invoke
32
+ end
36
33
  end
37
34
  end
38
35
 
@@ -45,14 +42,7 @@ task :server do
45
42
  Rake::Task['engine_cart:generate'].invoke
46
43
  end
47
44
 
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
45
+ SolrWrapper.wrap(port: '8983') do
56
46
  within_test_app do
57
47
  system "rake blacklight:index:seed"
58
48
  system "bundle exec rails s"
@@ -2,18 +2,28 @@ module Blacklight::Oembed
2
2
  class EmbedController < ActionController::Base
3
3
 
4
4
  def show
5
- render json: { html: get_embed_content(params[:url]) }
5
+ render json: { html: get_embed_content(params[:url], additional_params) }
6
6
  end
7
7
 
8
8
  private
9
9
 
10
- def get_embed_content url
10
+ ruby2_keywords def get_embed_content(url, add_params = {})
11
11
  begin
12
- OEmbed::Providers.get(url).html.html_safe
12
+ OEmbed::Providers.get(url, add_params.transform_values { |v| CGI.escape(v) }).html.html_safe
13
13
  rescue OEmbed::NotFound
14
14
  response.status = 400
15
15
  ""
16
16
  end
17
17
  end
18
+
19
+ ##
20
+ # Allows for blacklight-oembed users to pass through additional configured
21
+ # parameters
22
+ def additional_params
23
+ params
24
+ .slice(*Blacklight::Oembed::Engine.config.additional_params)
25
+ .to_unsafe_h
26
+ .symbolize_keys
27
+ end
18
28
  end
19
- end
29
+ end
@@ -18,18 +18,17 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "rails"
21
- spec.add_dependency "blacklight", ">= 5.0", "< 7"
22
- spec.add_dependency "bootstrap-sass", "~> 3.0"
21
+ spec.add_dependency 'blacklight', '~> 7.0'
23
22
  spec.add_dependency "ruby-oembed"
24
23
 
25
- spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "bundler", ">= 1.5"
26
25
  spec.add_development_dependency "rake"
27
26
  spec.add_development_dependency "rspec-rails", "~> 3.1"
28
27
  spec.add_development_dependency "rspec-its"
29
28
  spec.add_development_dependency "rspec-activemodel-mocks"
30
29
  spec.add_development_dependency "rspec-collection_matchers"
31
- spec.add_development_dependency "jettywrapper"
32
- spec.add_development_dependency "engine_cart", "~> 0.8"
30
+ spec.add_development_dependency "solr_wrapper"
31
+ spec.add_development_dependency "engine_cart", "~> 2.0"
33
32
  spec.add_development_dependency "capybara"
34
33
  spec.add_development_dependency "poltergeist", ">= 1.5.0"
35
34
  end
@@ -0,0 +1,5 @@
1
+ ---
2
+ ar:
3
+ blacklight_oembed:
4
+ catalog:
5
+ view: عرض
@@ -1,4 +1,5 @@
1
+ ---
1
2
  en:
2
3
  blacklight_oembed:
3
4
  catalog:
4
- view: View
5
+ view: View
@@ -5,6 +5,10 @@ module Blacklight
5
5
  class Engine < Rails::Engine
6
6
 
7
7
  Blacklight::Oembed::Engine.config.render_helper = :render_oembed_tag_async
8
+ ##
9
+ # Allows an adopter to pass additional parameters through to an OEmbed
10
+ # service. Examples of this could include `:canvas_index`, or `:max_width`
11
+ Blacklight::Oembed::Engine.config.additional_params = []
8
12
 
9
13
  end
10
14
  end
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Oembed
3
- VERSION = '0.1.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
@@ -0,0 +1,3 @@
1
+ {
2
+ "initArgs":{},
3
+ "managedList":[]}
@@ -0,0 +1,31 @@
1
+ <!--
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+
18
+ <!-- The content of this page will be statically included into the top
19
+ of the admin page. Uncomment this as an example to see there the content
20
+ will show up.
21
+
22
+ <hr>
23
+ <i>This line will appear before the first table</i>
24
+ <tr>
25
+ <td colspan="2">
26
+ This row will be appended to the end of the first table
27
+ </td>
28
+ </tr>
29
+ <hr>
30
+
31
+ -->
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+
19
+ <!-- If this file is found in the config directory, it will only be
20
+ loaded once at startup. If it is found in Solr's data
21
+ directory, it will be re-loaded every commit.
22
+ -->
23
+
24
+ <elevate>
25
+ <query text="foo bar">
26
+ <doc id="1" />
27
+ <doc id="2" />
28
+ <doc id="3" />
29
+ </query>
30
+
31
+ <query text="ipod">
32
+ <doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
33
+ <doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
34
+ </query>
35
+
36
+ </elevate>
@@ -0,0 +1,246 @@
1
+ # The ASF licenses this file to You under the Apache License, Version 2.0
2
+ # (the "License"); you may not use this file except in compliance with
3
+ # the License. You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ # Syntax:
14
+ # "source" => "target"
15
+ # "source".length() > 0 (source cannot be empty.)
16
+ # "target".length() >= 0 (target can be empty.)
17
+
18
+ # example:
19
+ # "??" => "A"
20
+ # "\u00C0" => "A"
21
+ # "\u00C0" => "\u0041"
22
+ # "??" => "ss"
23
+ # "\t" => " "
24
+ # "\n" => ""
25
+
26
+ # ?? => A
27
+ "\u00C0" => "A"
28
+
29
+ # ?? => A
30
+ "\u00C1" => "A"
31
+
32
+ # ?? => A
33
+ "\u00C2" => "A"
34
+
35
+ # ?? => A
36
+ "\u00C3" => "A"
37
+
38
+ # ?? => A
39
+ "\u00C4" => "A"
40
+
41
+ # ?? => A
42
+ "\u00C5" => "A"
43
+
44
+ # ?? => AE
45
+ "\u00C6" => "AE"
46
+
47
+ # ?? => C
48
+ "\u00C7" => "C"
49
+
50
+ # ?? => E
51
+ "\u00C8" => "E"
52
+
53
+ # ?? => E
54
+ "\u00C9" => "E"
55
+
56
+ # ?? => E
57
+ "\u00CA" => "E"
58
+
59
+ # ?? => E
60
+ "\u00CB" => "E"
61
+
62
+ # ?? => I
63
+ "\u00CC" => "I"
64
+
65
+ # ?? => I
66
+ "\u00CD" => "I"
67
+
68
+ # ?? => I
69
+ "\u00CE" => "I"
70
+
71
+ # ?? => I
72
+ "\u00CF" => "I"
73
+
74
+ # ?? => IJ
75
+ "\u0132" => "IJ"
76
+
77
+ # ?? => D
78
+ "\u00D0" => "D"
79
+
80
+ # ?? => N
81
+ "\u00D1" => "N"
82
+
83
+ # ?? => O
84
+ "\u00D2" => "O"
85
+
86
+ # ?? => O
87
+ "\u00D3" => "O"
88
+
89
+ # ?? => O
90
+ "\u00D4" => "O"
91
+
92
+ # ?? => O
93
+ "\u00D5" => "O"
94
+
95
+ # ?? => O
96
+ "\u00D6" => "O"
97
+
98
+ # ?? => O
99
+ "\u00D8" => "O"
100
+
101
+ # ?? => OE
102
+ "\u0152" => "OE"
103
+
104
+ # ??
105
+ "\u00DE" => "TH"
106
+
107
+ # ?? => U
108
+ "\u00D9" => "U"
109
+
110
+ # ?? => U
111
+ "\u00DA" => "U"
112
+
113
+ # ?? => U
114
+ "\u00DB" => "U"
115
+
116
+ # ?? => U
117
+ "\u00DC" => "U"
118
+
119
+ # ?? => Y
120
+ "\u00DD" => "Y"
121
+
122
+ # ?? => Y
123
+ "\u0178" => "Y"
124
+
125
+ # ?? => a
126
+ "\u00E0" => "a"
127
+
128
+ # ?? => a
129
+ "\u00E1" => "a"
130
+
131
+ # ?? => a
132
+ "\u00E2" => "a"
133
+
134
+ # ?? => a
135
+ "\u00E3" => "a"
136
+
137
+ # ?? => a
138
+ "\u00E4" => "a"
139
+
140
+ # ?? => a
141
+ "\u00E5" => "a"
142
+
143
+ # ?? => ae
144
+ "\u00E6" => "ae"
145
+
146
+ # ?? => c
147
+ "\u00E7" => "c"
148
+
149
+ # ?? => e
150
+ "\u00E8" => "e"
151
+
152
+ # ?? => e
153
+ "\u00E9" => "e"
154
+
155
+ # ?? => e
156
+ "\u00EA" => "e"
157
+
158
+ # ?? => e
159
+ "\u00EB" => "e"
160
+
161
+ # ?? => i
162
+ "\u00EC" => "i"
163
+
164
+ # ?? => i
165
+ "\u00ED" => "i"
166
+
167
+ # ?? => i
168
+ "\u00EE" => "i"
169
+
170
+ # ?? => i
171
+ "\u00EF" => "i"
172
+
173
+ # ?? => ij
174
+ "\u0133" => "ij"
175
+
176
+ # ?? => d
177
+ "\u00F0" => "d"
178
+
179
+ # ?? => n
180
+ "\u00F1" => "n"
181
+
182
+ # ?? => o
183
+ "\u00F2" => "o"
184
+
185
+ # ?? => o
186
+ "\u00F3" => "o"
187
+
188
+ # ?? => o
189
+ "\u00F4" => "o"
190
+
191
+ # ?? => o
192
+ "\u00F5" => "o"
193
+
194
+ # ?? => o
195
+ "\u00F6" => "o"
196
+
197
+ # ?? => o
198
+ "\u00F8" => "o"
199
+
200
+ # ?? => oe
201
+ "\u0153" => "oe"
202
+
203
+ # ?? => ss
204
+ "\u00DF" => "ss"
205
+
206
+ # ?? => th
207
+ "\u00FE" => "th"
208
+
209
+ # ?? => u
210
+ "\u00F9" => "u"
211
+
212
+ # ?? => u
213
+ "\u00FA" => "u"
214
+
215
+ # ?? => u
216
+ "\u00FB" => "u"
217
+
218
+ # ?? => u
219
+ "\u00FC" => "u"
220
+
221
+ # ?? => y
222
+ "\u00FD" => "y"
223
+
224
+ # ?? => y
225
+ "\u00FF" => "y"
226
+
227
+ # ??? => ff
228
+ "\uFB00" => "ff"
229
+
230
+ # ??? => fi
231
+ "\uFB01" => "fi"
232
+
233
+ # ??? => fl
234
+ "\uFB02" => "fl"
235
+
236
+ # ??? => ffi
237
+ "\uFB03" => "ffi"
238
+
239
+ # ??? => ffl
240
+ "\uFB04" => "ffl"
241
+
242
+ # ??? => ft
243
+ "\uFB05" => "ft"
244
+
245
+ # ??? => st
246
+ "\uFB06" => "st"