From 1b0dcca677b90b1f5a5097430ad185d7e910b5dc Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Fri, 26 Sep 2014 10:19:22 +0100 Subject: [PATCH] Make it a gem. --- .gitignore | 23 ++++++++++++++++- Gemfile | 4 +++ LICENCE.txt | 21 --------------- LICENSE.txt | 22 ++++++++++++++++ README.md | 34 ++++++++++++++++++++----- Rakefile | 2 ++ jekyll_video_tag.gemspec | 23 +++++++++++++++++ video_tag.rb => lib/jekyll_video_tag.rb | 19 +++----------- lib/jekyll_video_tag/version.rb | 3 +++ 9 files changed, 106 insertions(+), 45 deletions(-) create mode 100644 Gemfile delete mode 100644 LICENCE.txt create mode 100644 LICENSE.txt create mode 100644 Rakefile create mode 100644 jekyll_video_tag.gemspec rename video_tag.rb => lib/jekyll_video_tag.rb (60%) create mode 100644 lib/jekyll_video_tag/version.rb diff --git a/.gitignore b/.gitignore index 5df1b9b..31cafb5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,22 @@ -.sass-cache +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +*.bundle +*.so +*.o +*.a +mkmf.log diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..4fd2668 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in jekyll-video-tag.gemspec +gemspec diff --git a/LICENCE.txt b/LICENCE.txt deleted file mode 100644 index 19a121d..0000000 --- a/LICENCE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Dan Barber - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..8213d93 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2014 Dan Barber + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 71b3db2..84beb9d 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,39 @@ # Jekyll Video Tag -**Easy responsive videos for Jekyll.** - Jekyll Video Tag is a liquid tag that adds responsive videos to your [Jekyll](http://jekyllrb.com) static site. -### Usage +## Installation -Place the `video_tag.rb` file in your `_plugins` directory and add the CSS or Sass file to your site. +Add this line to your application's Gemfile: -```liquid + gem 'jekyll_video_tag' + +And then execute: + + $ bundle + +Or install it yourself as: + + $ gem install jekyll_video_tag + +## Usage + +``` liquid {% video {embed-url} width={width} height={height} %} ``` -### Example +The embed URL is the one that is referenced by the iframe in the video embed code. -```liquid +### Example: + +``` liquid {% video //www.youtube.com/embed/7eP4pw03PCg width=560 height=315 %} ``` + +## Contributing + +1. Fork it ( https://github.com/danbee/jekyll_video_tag/fork ) +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create a new Pull Request diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..809eb56 --- /dev/null +++ b/Rakefile @@ -0,0 +1,2 @@ +require "bundler/gem_tasks" + diff --git a/jekyll_video_tag.gemspec b/jekyll_video_tag.gemspec new file mode 100644 index 0000000..7b64318 --- /dev/null +++ b/jekyll_video_tag.gemspec @@ -0,0 +1,23 @@ +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'jekyll_video_tag/version' + +Gem::Specification.new do |spec| + spec.name = "jekyll_video_tag" + spec.version = JekyllVideoTag::VERSION + spec.authors = ["Dan Barber"] + spec.email = ["hello@danbarber.me"] + spec.summary = %q{TODO: Write a short summary. Required.} + spec.description = %q{TODO: Write a longer description. Optional.} + spec.homepage = "" + spec.license = "MIT" + + spec.files = `git ls-files -z`.split("\x0") + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ["lib"] + + spec.add_development_dependency "bundler", "~> 1.6" + spec.add_development_dependency "rake" +end diff --git a/video_tag.rb b/lib/jekyll_video_tag.rb similarity index 60% rename from video_tag.rb rename to lib/jekyll_video_tag.rb index 67fe236..2cdee02 100644 --- a/video_tag.rb +++ b/lib/jekyll_video_tag.rb @@ -1,18 +1,5 @@ -# Plugin for rendering responsive video in Jekyll -# Written by: Dan Barber -# Version: 0.0.2 -# =============================================== -# Usage: -# ------ -# {% video {embed-url} width={width} height={height} %} -# -# The embed URL is the one that is referenced by the iframe in the video embed code. -# -# Example: -# {% video //www.youtube.com/embed/7eP4pw03PCg width=560 height=315 %} - -module Jekyll - class VideoTag < Liquid::Tag +module JekyllVideoTag + class Tag < Liquid::Tag def initialize(tag_name, input, tokens) super @url = input.slice!(/[^ ]+/) @@ -43,4 +30,4 @@ module Jekyll end end -Liquid::Template.register_tag('video', Jekyll::VideoTag) +Liquid::Template.register_tag('video', JekyllVideoTag::Tag) diff --git a/lib/jekyll_video_tag/version.rb b/lib/jekyll_video_tag/version.rb new file mode 100644 index 0000000..2258748 --- /dev/null +++ b/lib/jekyll_video_tag/version.rb @@ -0,0 +1,3 @@ +module JekyllVideoTag + VERSION = "0.0.2" +end