jekyll_video 0.1.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
+ SHA256:
3
+ metadata.gz: f3103fb3d5dfc593bce47d14e6da474862304dcb113e2405403304abffd44435
4
+ data.tar.gz: 75dcf2187bde6290299a36fb3f4c0ffe473d93a983ad1d519daea86299dfa648
5
+ SHA512:
6
+ metadata.gz: e0fe2a040f1d70d32080b16ccd6c9bd5cbbabe3de26b7ab179030141e8691c4e725f3cad4d94ff7dd1dab287a0f0914d4af29712233d16bd6ba31f6e0150026a
7
+ data.tar.gz: 73ef9f4d303c8087967930a0fc6cd767c31f441993c90aedb38d93daad555c2f2644ac87b9045bafb80a5685abd055d000ab375969478a24d7bdc54d3f607d9a
data/.rubocop.yml ADDED
@@ -0,0 +1,70 @@
1
+ require:
2
+ # - rubocop-jekyll
3
+ - rubocop-md
4
+ - rubocop-performance
5
+ - rubocop-rake
6
+ - rubocop-rspec
7
+
8
+ AllCops:
9
+ Exclude:
10
+ - binstub/**/*
11
+ - exe/**/*
12
+ - vendor/**/*
13
+ - Gemfile*
14
+ NewCops: enable
15
+
16
+ Gemspec/DeprecatedAttributeAssignment:
17
+ Enabled: false
18
+
19
+ Gemspec/RequireMFA:
20
+ Enabled: false
21
+
22
+ Layout/HashAlignment:
23
+ EnforcedColonStyle: table
24
+ EnforcedHashRocketStyle: table
25
+
26
+ Layout/LineLength:
27
+ Max: 150
28
+
29
+ Metrics/AbcSize:
30
+ Max: 35
31
+
32
+ Metrics/BlockLength:
33
+ Exclude:
34
+ - jekyll_video.gemspec
35
+ Max: 30
36
+
37
+ Metrics/CyclomaticComplexity:
38
+ Max: 15
39
+
40
+ Metrics/MethodLength:
41
+ Max: 40
42
+
43
+ Metrics/ModuleLength:
44
+ Enabled: false
45
+
46
+ Metrics/PerceivedComplexity:
47
+ Max: 15
48
+
49
+ Naming/FileName:
50
+ Exclude:
51
+ - Rakefile
52
+
53
+ Style/Documentation:
54
+ Enabled: false
55
+
56
+ Style/FrozenStringLiteralComment:
57
+ Enabled: false
58
+
59
+ Style/TrailingCommaInHashLiteral:
60
+ EnforcedStyleForMultiline: comma
61
+
62
+ RSpec/FilePath:
63
+ IgnoreMethods: true
64
+ SpecSuffixOnly: true
65
+
66
+ RSpec/ExampleLength:
67
+ Max: 30
68
+
69
+ RSpec/MultipleExpectations:
70
+ Max: 15
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Change Log
2
+
3
+ ## 0.1.0
4
+
5
+ * Initial release.
data/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # `Jekyll_video` [![Gem Version](https://badge.fury.io/rb/jekyll_video.svg)](https://badge.fury.io/rb/jekyll_video)
2
+
3
+ Embeds a video HTML tag into a Jekyll web page.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add the following to your Jekyll website's `Gemfile`:
9
+
10
+ ```ruby
11
+ group :jekyll_plugins do
12
+ gem 'jekyll_video'
13
+ end
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ ```shell
19
+ $ bundle
20
+ ```
21
+
22
+ Add the following CSS:
23
+
24
+ ```css
25
+ .rounded {
26
+ border: 1px solid;
27
+ border-radius: 7px;
28
+ }
29
+
30
+ .shadow {
31
+ border: thin gray solid;
32
+ box-shadow: 5px 5px 6px #999;
33
+ }
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ See the `demo/` directory for an example.
39
+
40
+
41
+ ## Development
42
+
43
+ After checking out this git repository, install dependencies by typing:
44
+
45
+ ```shell
46
+ $ bin/setup
47
+ ```
48
+
49
+ You should do the above before running Visual Studio Code.
50
+
51
+
52
+ ### Run the Tests
53
+
54
+ ```shell
55
+ $ bundle exec rake test
56
+ ```
57
+
58
+
59
+ ### Interactive Session
60
+
61
+ The following will allow you to experiment:
62
+
63
+ ```shell
64
+ $ bin/console
65
+ ```
66
+
67
+
68
+ ### Local Installation
69
+
70
+ To install this gem onto your local machine, type:
71
+
72
+ ```shell
73
+ $ bundle exec rake install
74
+ ```
75
+
76
+
77
+ ### To Release A New Version
78
+
79
+ To create a git tag for the new version, push git commits and tags,
80
+ and push the new version of the gem to https://rubygems.org, type:
81
+
82
+ ```shell
83
+ $ bundle exec rake release
84
+ ```
85
+
86
+
87
+ ## Contributing
88
+
89
+ Bug reports and pull requests are welcome at https://github.com/mslinn/jekyll_video.
90
+
91
+
92
+ ## License
93
+
94
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ desc 'Bump patch version'
11
+ task :patch do
12
+ system 'gem bump --tag'
13
+ end
14
+
15
+ desc 'Bump minor version'
16
+ task :minor do
17
+ system 'gem bump --version minor --tag'
18
+ end
19
+
20
+ desc 'Bump major version'
21
+ task :major do
22
+ system 'gem bump --version major --tag'
23
+ end
24
+
25
+ task publish: [:build] do
26
+ $VERBOSE = nil
27
+ load 'jekyll_video/version.rb'
28
+ system "gem push pkg/jekyll_video-#{JekyllVideo::VERSION}.gem"
29
+ end
30
+
31
+ desc 'Bump patch version, create git tag, build the gem and release to geminabox (default)'
32
+ task release_patch: %i[test patch publish]
33
+
34
+ desc 'Bump minor version, create git tag, build the gem and release to geminabox'
35
+ task release_minor: %i[test minor publish]
36
+
37
+ desc 'Bump major version, create git tag, build the gem and release to geminabox'
38
+ task release_major: %i[test major publish]
39
+
40
+ task default: :test
@@ -0,0 +1,33 @@
1
+ require_relative 'lib/jekyll_video/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ host = 'https://github.com/mslinn/jekyll_video'
5
+
6
+ spec.authors = ['Mike Slinn']
7
+ spec.description = <<~END_DESC
8
+ Embed an HTML video into a web page.
9
+ END_DESC
10
+ spec.email = ['mslinn@mslinn.com']
11
+ spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
12
+ spec.homepage = 'https://github.com/mslinn/jekyll_video'
13
+ spec.license = 'MIT'
14
+ spec.metadata = {
15
+ 'allowed_push_host' => 'https://rubygems.org',
16
+ 'bug_tracker_uri' => "#{host}/issues",
17
+ 'changelog_uri' => "#{host}/CHANGELOG.md",
18
+ 'homepage_uri' => spec.homepage,
19
+ 'source_code_uri' => host,
20
+ }
21
+ spec.name = 'jekyll_video'
22
+ spec.post_install_message = <<~END_MESSAGE
23
+
24
+ Thanks for installing #{spec.name}!
25
+
26
+ END_MESSAGE
27
+ spec.require_paths = ['lib']
28
+ spec.required_ruby_version = '>= 2.6.0'
29
+ spec.summary = 'Embed an HTML video into a web page.'
30
+ spec.version = JekyllVideo::VERSION
31
+ spec.add_dependency 'jekyll', '>= 3.5.0'
32
+ spec.add_dependency 'jekyll_plugin_support', '>= 0.7.0'
33
+ end
@@ -0,0 +1,3 @@
1
+ module JekyllVideo
2
+ VERSION = '0.1.0'.freeze unless defined? VERSION
3
+ end
@@ -0,0 +1,12 @@
1
+ require 'jekyll'
2
+ require 'jekyll_plugin_logger'
3
+ require 'jekyll_plugin_support'
4
+
5
+ require_relative 'jekyll_video/version'
6
+
7
+ # Require all Ruby files in 'lib/', except this file
8
+ Dir[File.join(__dir__, '*.rb')].each do |file|
9
+ require file unless file.end_with?('/jekyll_video.rb')
10
+ end
11
+
12
+ # Write the code for your gem here
data/lib/video.rb ADDED
@@ -0,0 +1,39 @@
1
+ require 'jekyll_plugin_support'
2
+ require_relative 'jekyll_video/version'
3
+
4
+ # This Jekyll tag plugin is a minimal example.
5
+ #
6
+ # See https://www.mslinn.com/jekyll/10200-jekyll-plugin-background.html
7
+ # See https://www.mslinn.com/jekyll/10400-jekyll-plugin-template-collection.html
8
+ #
9
+ # @example Embed a video
10
+ # {% video 'https://asdf.com/myvideo.mp4' %}
11
+ #
12
+ # The Jekyll log level defaults to :info, which means all the Jekyll.logger statements below will not generate output.
13
+ # You can control the log level when you start Jekyll.
14
+ # To set the log level to :debug, write an entry into _config.yml, like this:
15
+ # plugin_loggers:
16
+ # Video: debug
17
+ module JekyllVideo
18
+ # This class implements the Jekyll video functionality
19
+ class Video < JekyllSupport::JekyllTag
20
+ PLUGIN_NAME = 'video'.freeze
21
+ VERSION = JekyllVideo::VERSION
22
+
23
+ # @return [void]
24
+ def render_impl
25
+ classes = @helper.parameter_specified?('classes') || 'shadow rounded'
26
+ src = @helper.parameter_specified?('src') || @argument_string
27
+ style = @helper.parameter_specified?('style') || ''
28
+ width = @helper.parameter_specified?('width') || '100%'
29
+
30
+ <<~END_OUTPUT
31
+ <video class="jekyll_video #{classes}" controls width="#{width}" style="#{style}">
32
+ <source src="#{src}">
33
+ </video>
34
+ END_OUTPUT
35
+ end
36
+
37
+ JekyllPluginHelper.register(self, PLUGIN_NAME)
38
+ end
39
+ end
@@ -0,0 +1,13 @@
1
+ require_relative '../lib/jekyll_video'
2
+
3
+ RSpec.describe JekyllVideo::JekyllVideo do
4
+ let(:logger) do
5
+ PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
6
+ end
7
+
8
+ let(:parse_context) { TestParseContext.new }
9
+
10
+ it 'has a test' do
11
+ expect(true).to be_true
12
+ end
13
+ end
@@ -0,0 +1,79 @@
1
+ require 'jekyll'
2
+ require 'jekyll_plugin_logger'
3
+ require 'liquid'
4
+ require 'fileutils'
5
+ require 'yaml'
6
+ require_relative '../lib/<%= @gem_name %>'
7
+
8
+ RSpec.configure do |config|
9
+ config.filter_run :focus
10
+ # config.order = 'random'
11
+ config.run_all_when_everything_filtered = true
12
+
13
+ # See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
14
+ config.example_status_persistence_file_path = '../spec/status_persistence.txt'
15
+
16
+ config.filter_run_when_matching focus: true
17
+ end
18
+
19
+ Registers = Struct.new(:page, :site)
20
+
21
+ # Mock for Collections
22
+ class Collections
23
+ def values
24
+ []
25
+ end
26
+ end
27
+
28
+ # Mock for Site
29
+ class SiteMock
30
+ attr_reader :config
31
+
32
+ def initialize
33
+ @config = YAML.safe_load_file(File.read('../demo/_config.yml'))
34
+ @config['env'] = { 'JEKYLL_ENV' => 'development' }
35
+ end
36
+
37
+ def collections
38
+ Collections.new
39
+ end
40
+ end
41
+
42
+ class TestLiquidContext < Liquid::Context
43
+ def initialize
44
+ super
45
+
46
+ page = {
47
+ 'content' => 'blah blah',
48
+ 'description' => 'Jekyll plugin support demo',
49
+ 'dir' => '/',
50
+ 'excerpt' => nil,
51
+ 'layout' => 'default',
52
+ 'name' => 'index.html',
53
+ 'path' => 'index.html',
54
+ 'title' => 'Welcome',
55
+ 'url' => '/',
56
+ }
57
+
58
+ @content = 'Interior of the tag'
59
+ @registers = Registers.new(
60
+ page,
61
+ SiteMock.new
62
+ )
63
+ end
64
+ end
65
+
66
+ # Mock for Liquid::ParseContent
67
+ class TestParseContext < Liquid::ParseContext
68
+ attr_reader :line_number, :registers
69
+
70
+ def initialize
71
+ super
72
+ @line_number = 123
73
+
74
+ @registers = Registers.new(
75
+ { 'path' => 'path/to/page.html' },
76
+ SiteMock.new
77
+ )
78
+ end
79
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll_video
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mike Slinn
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-11-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.5.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: jekyll_plugin_support
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.7.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.7.0
41
+ description: 'Embed an HTML video into a web page.
42
+
43
+ '
44
+ email:
45
+ - mslinn@mslinn.com
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".rubocop.yml"
51
+ - CHANGELOG.md
52
+ - README.md
53
+ - Rakefile
54
+ - jekyll_video.gemspec
55
+ - lib/jekyll_video.rb
56
+ - lib/jekyll_video/version.rb
57
+ - lib/video.rb
58
+ - spec/jekyll_video_spec.rb
59
+ - spec/spec_helper.rb
60
+ homepage: https://github.com/mslinn/jekyll_video
61
+ licenses:
62
+ - MIT
63
+ metadata:
64
+ allowed_push_host: https://rubygems.org
65
+ bug_tracker_uri: https://github.com/mslinn/jekyll_video/issues
66
+ changelog_uri: https://github.com/mslinn/jekyll_video/CHANGELOG.md
67
+ homepage_uri: https://github.com/mslinn/jekyll_video
68
+ source_code_uri: https://github.com/mslinn/jekyll_video
69
+ post_install_message: |2+
70
+
71
+ Thanks for installing jekyll_video!
72
+
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 2.6.0
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubygems_version: 3.3.3
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Embed an HTML video into a web page.
91
+ test_files: []
92
+ ...