pageflow-oembed 1.0.0

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: 2371778074195896b81827f2a795f3499c18b6d8
4
+ data.tar.gz: 4b9135c2b5bb7d7e59497ec26459fc6ebbe29076
5
+ SHA512:
6
+ metadata.gz: ce5e2fedf29871d021fc32c0b3c4d79ddb047b8b8dc9420d94b2c70365b33f44e4b48b658d79d13761aaa6c263dba276044dc0cb115ed760b603f863e2b64bad
7
+ data.tar.gz: 82eca1dd591e3db49682543d02eeeef157f23870525a8c8bb0676e195c3a3fcb102a2559cdd15411c22b026c7dc590fae48a23e10afbb61027acb5924fbfdc6c
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.14.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at joost@spacebabies.nl. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pageflow-oembed.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Joost Baaij
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # Pageflow::Oembed
2
+
3
+ This plugin will search for links in your Pageflow stories, and turn them
4
+ into embedded content when possible. For example, instead of a link to a
5
+ [Tweet URL](https://twitter.com/scrollytelling/status/885128273239396352), people
6
+ reading your story will see the Tweet embedded in the page.
7
+
8
+ It usually works using [oEmbed](http://oembed.com), the standard protocol for discovering
9
+ and showing embedded content. Although sometimes we use a JavaScript SDK, since it
10
+ gives better results. When we do use oEmbed, the embed-code is cached in
11
+ the database.
12
+
13
+ The best aspect about this plugin is for editors working with Pageflow. You
14
+ don't have to do anything out of the ordinary. Continue to add links as normal,
15
+ using the built-in html editor in Pageflow. Your hand-creafted, artisanal words
16
+ are not affected by our code. The link will be visible to you as always. It's just
17
+ that on the front end, the link is replaced by the embedded content.
18
+
19
+ If you don't want the embed, remove the link. In a future release there might
20
+ be a mechanism to deal with this.
21
+
22
+ ### Whitelisted URLs
23
+
24
+ We work with a whitelist and will convert only some links.
25
+
26
+ Currently supported:
27
+
28
+ * twitter: https://twitter.com/scrollytelling/status/885128273239396352
29
+
30
+ Note that the URL you use must look exactly like the ones above.
31
+
32
+ More providers will follow.
33
+
34
+ ### Just use JavaScript
35
+
36
+ jQuery is not used at all. This plugin contains two polyfills to get IE on board.
37
+ And if you are using an ancient browser, well, that's your choice.
38
+
39
+ ### Heads up: social scripts will be included in the page
40
+
41
+ To create the best versions of embedded content, we usually include the
42
+ JavaScript SDK a provider has created. For example, Twitter. The widget sans JS
43
+ is hardly usable, and certainly won't open the Twitter app on your phone. If
44
+ you hate the thought of being tracked on the interwebs, well, I hear what you're
45
+ saying but we gotta be pragmatic. Should I make using the SDKs configurable?
46
+
47
+
48
+ ## Scrollytelling. What's that now?
49
+
50
+ We are [Scrollytelling](https://www.scrollytelling.io/). We enable online
51
+ stories. we host multimedia content for national media. We run a custom version
52
+ of the awesome [Pageflow](https://github.com/codevise/pageflow) storytelling
53
+ tool. We continously give back to the community and we hope that you'll
54
+ enjoy this plugin too.
55
+
56
+
57
+ ## Installation
58
+
59
+ Add this line to your application's Gemfile:
60
+
61
+ ```ruby
62
+ gem 'pageflow-oembed'
63
+ ```
64
+
65
+ And then execute:
66
+
67
+ $ bundle
68
+
69
+ ## Configuration
70
+
71
+ Add it to the Pageflow initializer in the host application:
72
+
73
+ ```ruby
74
+ # config/initializer/pageflow.rb
75
+ Pageflow.configure do |config|
76
+ config.plugin(Pageflow::Oembed.plugin)
77
+ end
78
+ ```
79
+
80
+ Copy the migrations:
81
+
82
+ ```shell
83
+ rake pageflow_oembed:install:migrations
84
+ rake db:migrate SCOPE=pageflow_oembed
85
+ ```
86
+
87
+ Add it to the asset pipeline:
88
+
89
+ ```javascript
90
+ // app/assets/javascript/application.js
91
+ //= require pageflow/oembed
92
+ ```
93
+
94
+ ## Usage
95
+
96
+ In the Pageflow editor, insert a plain old link into the content text. Voila!
97
+
98
+ ## Development
99
+
100
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
101
+
102
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
103
+
104
+ ## Contributing
105
+
106
+ Bug reports and pull requests are welcome on GitHub at https://github.com/scrollytelling/pageflow-oembed. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
107
+
108
+
109
+ ## License
110
+
111
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,55 @@
1
+ //= require ./polyfills
2
+ //
3
+ pageflow.widgetTypes.register('pageflow_oembed', {
4
+ enhance: function(element) {
5
+ var urls = document.querySelectorAll('.contentText a');
6
+ var embedLinks = Array.from(urls).filter(this.embeddable);
7
+ for (var i = 0, len = embedLinks.length; i < len; i++) {
8
+ if( /twitter/i.test(embedLinks[i].getAttribute('href')) )
9
+ this.embedTwitter(embedLinks[i]);
10
+ };
11
+ },
12
+
13
+ embeddable: function(link) {
14
+ url = link.getAttribute('href');
15
+ return /https?:\/\/twitter.com\/\w*\/\w*\/\d*/.test(url);
16
+ },
17
+
18
+ token: function() {
19
+ return document.querySelector("meta[name='csrf-token']").content;
20
+ },
21
+
22
+ page: function(link) {
23
+ return link.closest('.page');
24
+ },
25
+
26
+ embedSpotify: function(link) {
27
+ var xhr = new XMLHttpRequest();
28
+ var url = link.getAttribute('href');
29
+ var data = {oembed: {url: url, locale: pageflow.seed.locale}};
30
+ xhr.open("POST", '/oembed/fetch', true);
31
+ xhr.setRequestHeader("Content-Type", "application/json");
32
+ xhr.setRequestHeader("X-CSRF-Token", this.token());
33
+ xhr.onload = function() {
34
+ oembed = JSON.parse(this.responseText);
35
+ link.outerHTML = oembed.html;
36
+ };
37
+ xhr.send(JSON.stringify(data));
38
+ },
39
+
40
+ embedTwitter: function(link) {
41
+ var url = link.getAttribute('href');
42
+ var tweetId = url.slice(-18);
43
+ var theme = this.page(link).classList.contains('invert') ? 'light' : 'dark';
44
+
45
+ link.insertAdjacentHTML('beforebegin', '<span id="tweet-'+tweetId+'"></span>')
46
+
47
+ var options = {omit_script: true, related: 'scrollytelling', lang: pageflow.seed.locale, theme: theme, dnt: 'true'};
48
+ twttr.widgets.createTweet(
49
+ tweetId,
50
+ document.getElementById('tweet-'+tweetId),
51
+ options
52
+ );
53
+ link.style.display = 'none';
54
+ }
55
+ });
@@ -0,0 +1,60 @@
1
+ // IE Polyfill for array.find()
2
+ // https://tc39.github.io/ecma262/#sec-array.prototype.find
3
+ if (!Array.prototype.find) {
4
+ Object.defineProperty(Array.prototype, 'find', {
5
+ value: function(predicate) {
6
+ // 1. Let O be ? ToObject(this value).
7
+ if (this == null) {
8
+ throw new TypeError('"this" is null or not defined');
9
+ }
10
+
11
+ var o = Object(this);
12
+
13
+ // 2. Let len be ? ToLength(? Get(O, "length")).
14
+ var len = o.length >>> 0;
15
+
16
+ // 3. If IsCallable(predicate) is false, throw a TypeError exception.
17
+ if (typeof predicate !== 'function') {
18
+ throw new TypeError('predicate must be a function');
19
+ }
20
+
21
+ // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
22
+ var thisArg = arguments[1];
23
+
24
+ // 5. Let k be 0.
25
+ var k = 0;
26
+
27
+ // 6. Repeat, while k < len
28
+ while (k < len) {
29
+ // a. Let Pk be ! ToString(k).
30
+ // b. Let kValue be ? Get(O, Pk).
31
+ // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
32
+ // d. If testResult is true, return kValue.
33
+ var kValue = o[k];
34
+ if (predicate.call(thisArg, kValue, k, o)) {
35
+ return kValue;
36
+ }
37
+ // e. Increase k by 1.
38
+ k++;
39
+ }
40
+
41
+ // 7. Return undefined.
42
+ return undefined;
43
+ }
44
+ });
45
+ }
46
+
47
+ // IE polyfill for Element.closest()
48
+ if (window.Element && !Element.prototype.closest) {
49
+ Element.prototype.closest =
50
+ function(s) {
51
+ var matches = (this.document || this.ownerDocument).querySelectorAll(s),
52
+ i,
53
+ el = this;
54
+ do {
55
+ i = matches.length;
56
+ while (--i >= 0 && matches.item(i) !== el) {};
57
+ } while ((i < 0) && (el = el.parentElement));
58
+ return el;
59
+ };
60
+ }
@@ -0,0 +1,6 @@
1
+ module Pageflow
2
+ module Oembed
3
+ class ApplicationController < ActionController::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,23 @@
1
+ module Pageflow
2
+ module Oembed
3
+ class OembedsController < ApplicationController
4
+ def fetch
5
+ oembed = Oembed.find_or_create_by(url: oembed_params[:url]) do |oembed|
6
+ oembed.attributes = Fetcher.fetch(oembed_params[:url], params: oembed_params.delete(:url))
7
+ end
8
+
9
+ if oembed.valid?
10
+ render json: oembed
11
+ else
12
+ render json: {error: oembed.errors, object: oembed}, status: :bad_request
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def oembed_params
19
+ params.require(:oembed).permit(:url, :theme, :locale)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ module Pageflow
2
+ module Oembed
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,42 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+
4
+ module Pageflow
5
+ module Oembed
6
+ class Fetcher
7
+ def initialize(url, params={})
8
+ @url = url
9
+ @params = params
10
+ end
11
+
12
+ attr_reader :url, :params
13
+
14
+ def self.fetch(url, params)
15
+ new(url, params).fetch
16
+ end
17
+
18
+ def fetch
19
+ # Twitter: GET https://publish.twitter.com/oembed?url=https%3A%2F%2Ftwitter.com%2FInterior%2Fstatus%2F507185938620219395
20
+ connection = Faraday.new(url: "https://publish.twitter.com") do |conn|
21
+ conn.request :json
22
+ conn.response :json, :content_type => /\bjson$/
23
+
24
+ conn.adapter Faraday.default_adapter
25
+ end
26
+
27
+ response = connection.get "/oembed", {
28
+ url: url,
29
+ omit_script: true,
30
+ related: 'scrollytelling',
31
+ lang: params[:locale] || 'en',
32
+ theme: params[:theme] || 'dark',
33
+ dnt: 'true'
34
+ }
35
+
36
+ oembed = response.body
37
+ oembed[:cache_until] = oembed[:cache_age].seconds.from_now
38
+ oembed
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,10 @@
1
+ module Pageflow
2
+ module Oembed
3
+ class Oembed < ApplicationRecord
4
+ self.inheritance_column = nil
5
+
6
+ validates_presence_of :url
7
+ validates_uniqueness_of :url
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ <script>window.twttr = (function(d, s, id) {
2
+ var js, fjs = d.getElementsByTagName(s)[0],
3
+ t = window.twttr || {};
4
+ if (d.getElementById(id)) return t;
5
+ js = d.createElement(s);
6
+ js.id = id;
7
+ js.src = "https://platform.twitter.com/widgets.js";
8
+ fjs.parentNode.insertBefore(js, fjs);
9
+
10
+ t._e = [];
11
+ t.ready = function(f) {
12
+ t._e.push(f);
13
+ };
14
+
15
+ return t;
16
+ }(document, "script", "twitter-wjs"));</script>
@@ -0,0 +1 @@
1
+ <div data-widget="pageflow_oembed"></div>
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pageflow/oembed"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ nl:
2
+ pageflow:
3
+ pageflow_oembed:
4
+ widget_type_name: "When available, replace plain links with embedded content."
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Pageflow::Oembed::Engine.routes.draw do
2
+ post :fetch, to: "oembeds#fetch"
3
+ end
@@ -0,0 +1,24 @@
1
+ class CreatePageflowOembeds < ActiveRecord::Migration
2
+ def change
3
+ create_table :pageflow_oembed_oembeds do |t|
4
+ t.string :type, null: false, default: ''
5
+ t.string :version, null: false, default: ''
6
+ t.string :url, null: false, default: ''
7
+ t.string :title
8
+ t.string :author_name
9
+ t.string :author_url
10
+ t.text :html
11
+ t.integer :width, limit: 8
12
+ t.integer :height, limit: 8
13
+ t.string :provider_name
14
+ t.string :provider_url
15
+ t.integer :cache_age, limit: 8
16
+ t.datetime :cache_until
17
+ t.string :thumbnail_url
18
+ t.integer :thumbnail_width, limit: 8
19
+ t.integer :thumbnail_height, limit: 8
20
+ t.index :url, unique: true
21
+ t.timestamps
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ require 'rails/engine'
2
+
3
+ module Pageflow
4
+ module Oembed
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace Pageflow::Oembed
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ require 'pageflow/plugin'
2
+
3
+ module Pageflow
4
+ module Oembed
5
+ class Plugin < ::Pageflow::Plugin
6
+ def configure(config)
7
+ config.widget_types.register(Pageflow::Oembed.widget_type, default: true)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Pageflow
2
+ module Oembed
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ require 'pageflow/widget_type'
2
+
3
+ module Pageflow
4
+ module Oembed
5
+ class WidgetType < ::Pageflow::WidgetType
6
+ def name
7
+ 'pageflow_oembed'
8
+ end
9
+
10
+ def roles
11
+ ['oembed']
12
+ end
13
+
14
+ def render(template, entry)
15
+ template.render(
16
+ partial: "pageflow/oembed/widget",
17
+ locals: {
18
+ entry: entry
19
+ }
20
+ )
21
+ end
22
+
23
+ def render_head_fragment(template, entry)
24
+ template.render(
25
+ partial: 'pageflow/oembed/head',
26
+ locals: {
27
+ entry: entry
28
+ }
29
+ )
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,16 @@
1
+ require "pageflow/oembed/version"
2
+ require "pageflow/oembed/plugin"
3
+ require "pageflow/oembed/widget_type"
4
+ require "pageflow/oembed/engine"
5
+
6
+ module Pageflow
7
+ module Oembed
8
+ def self.widget_type
9
+ WidgetType.new
10
+ end
11
+
12
+ def self.plugin
13
+ Plugin.new
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pageflow/oembed/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pageflow-oembed"
8
+ spec.version = Pageflow::Oembed::VERSION
9
+ spec.authors = ["Joost Baaij"]
10
+ spec.email = ["joost@spacebabies.nl"]
11
+
12
+ spec.summary = "Turn links to embeddable content into the actual embedded content itself."
13
+ spec.description = "This plugin enhances Pageflow stories with OEmbed functionality. When a link is present in the body text, and its URL is whitelisted, the link is changed into the embedded content. The embedded content is stored on the local server. When available and/or better somehow, we also use a provider's JavaScript SDK."
14
+ spec.homepage = "https://github.com/scrollytelling/pageflow-oembed"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_runtime_dependency "pageflow", "< 12.0.0"
34
+ spec.add_runtime_dependency 'rails', '>= 3.0'
35
+ spec.add_runtime_dependency "faraday"
36
+ spec.add_runtime_dependency "faraday_middleware"
37
+
38
+ spec.add_development_dependency "bundler", "~> 1.14"
39
+ spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_development_dependency "rspec", "~> 3.0"
41
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pageflow-oembed
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Joost Baaij
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-07-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pageflow
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "<"
18
+ - !ruby/object:Gem::Version
19
+ version: 12.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "<"
25
+ - !ruby/object:Gem::Version
26
+ version: 12.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday
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: faraday_middleware
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.14'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.14'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ description: This plugin enhances Pageflow stories with OEmbed functionality. When
112
+ a link is present in the body text, and its URL is whitelisted, the link is changed
113
+ into the embedded content. The embedded content is stored on the local server. When
114
+ available and/or better somehow, we also use a provider's JavaScript SDK.
115
+ email:
116
+ - joost@spacebabies.nl
117
+ executables: []
118
+ extensions: []
119
+ extra_rdoc_files: []
120
+ files:
121
+ - ".gitignore"
122
+ - ".rspec"
123
+ - ".travis.yml"
124
+ - CODE_OF_CONDUCT.md
125
+ - Gemfile
126
+ - LICENSE.txt
127
+ - README.md
128
+ - Rakefile
129
+ - app/assets/javascript/pageflow/oembed.js
130
+ - app/assets/javascript/pageflow/polyfills.js
131
+ - app/controllers/pageflow/oembed/application_controller.rb
132
+ - app/controllers/pageflow/oembed/oembeds_controller.rb
133
+ - app/models/pageflow/oembed/application_record.rb
134
+ - app/models/pageflow/oembed/fetcher.rb
135
+ - app/models/pageflow/oembed/oembed.rb
136
+ - app/views/pageflow/oembed/_head.html.erb
137
+ - app/views/pageflow/oembed/_widget.html.erb
138
+ - bin/console
139
+ - bin/setup
140
+ - config/locales/nl.yml
141
+ - config/routes.rb
142
+ - db/migrate/20170715161924_create_pageflow_oembeds.rb
143
+ - lib/pageflow/oembed.rb
144
+ - lib/pageflow/oembed/engine.rb
145
+ - lib/pageflow/oembed/plugin.rb
146
+ - lib/pageflow/oembed/version.rb
147
+ - lib/pageflow/oembed/widget_type.rb
148
+ - pageflow-oembed.gemspec
149
+ homepage: https://github.com/scrollytelling/pageflow-oembed
150
+ licenses:
151
+ - MIT
152
+ metadata:
153
+ allowed_push_host: https://rubygems.org
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.5.1
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Turn links to embeddable content into the actual embedded content itself.
174
+ test_files: []