jekyll-copyr 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
+ SHA256:
3
+ metadata.gz: 90eb1672594e9af2a7a669387b0c24fa126c06d9e86a5c10c9cfc1d9c04b265b
4
+ data.tar.gz: f37a92f37974365ae1af5c446f2bf540109f22132dcf09bd4a0efe7bad9628eb
5
+ SHA512:
6
+ metadata.gz: 2309aed0ff26672b6430a589268d3e9c6f13a2a5200a2fadee49e4bb31ed447e5d0ef0e351905eebf69d66fd01f0d60e4c5914d41064cf400510e0ef7027ed85
7
+ data.tar.gz: ffc39dcb66989229ac5dbbef8d5cf0b5395b8795bdaa97ccc3f356b0d12b3aad4631dce4d95f934be5f8dee8021a2a54180f292081e1e5a3b1e9d48ca594bb70
data/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ *.gem
2
+ *.rbc
3
+ *.sassc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ .rvmrc
8
+ .rspec
9
+ .rspec_status
10
+ .sass-cache
11
+ .DS_Store
12
+ Gemfile.lock # gem projects only!
13
+ InstalledFiles
14
+ _yardoc
15
+ doc/
16
+ coverage
17
+ lib/bundler/man
18
+ capybara-*.html
19
+ pkg
20
+ rdoc
21
+ spec/reports
22
+ spec/tmp
23
+ test/tmp
24
+ test/version_tmp
25
+ tmp
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ require: rubocop-jekyll
2
+ inherit_gem:
3
+ rubocop-jekyll: .rubocop.yml
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.6
7
+ Exclude:
8
+ - vendor/**/*
9
+
10
+ Layout/LineLength:
11
+ Exclude:
12
+ - spec/**/*
13
+ - jekyll-copyr.gemspec
14
+
15
+ Layout/BlockLength:
16
+ Exclude:
17
+ - spec/**/*
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"]
data/Gemfile.lock ADDED
@@ -0,0 +1,111 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll-copyr (1.0.0)
5
+ jekyll (>= 3.3, < 5.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.0)
13
+ colorator (1.1.0)
14
+ concurrent-ruby (1.1.6)
15
+ diff-lcs (1.3)
16
+ em-websocket (0.5.1)
17
+ eventmachine (>= 0.12.9)
18
+ http_parser.rb (~> 0.6.0)
19
+ eventmachine (1.2.7)
20
+ ffi (1.12.2)
21
+ forwardable-extended (2.6.0)
22
+ http_parser.rb (0.6.0)
23
+ i18n (1.8.2)
24
+ concurrent-ruby (~> 1.0)
25
+ jaro_winkler (1.5.4)
26
+ jekyll (4.0.0)
27
+ addressable (~> 2.4)
28
+ colorator (~> 1.0)
29
+ em-websocket (~> 0.5)
30
+ i18n (>= 0.9.5, < 2)
31
+ jekyll-sass-converter (~> 2.0)
32
+ jekyll-watch (~> 2.0)
33
+ kramdown (~> 2.1)
34
+ kramdown-parser-gfm (~> 1.0)
35
+ liquid (~> 4.0)
36
+ mercenary (~> 0.3.3)
37
+ pathutil (~> 0.9)
38
+ rouge (~> 3.0)
39
+ safe_yaml (~> 1.0)
40
+ terminal-table (~> 1.8)
41
+ jekyll-sass-converter (2.1.0)
42
+ sassc (> 2.0.1, < 3.0)
43
+ jekyll-watch (2.2.1)
44
+ listen (~> 3.0)
45
+ kramdown (2.1.0)
46
+ kramdown-parser-gfm (1.1.0)
47
+ kramdown (~> 2.0)
48
+ liquid (4.0.3)
49
+ listen (3.2.1)
50
+ rb-fsevent (~> 0.10, >= 0.10.3)
51
+ rb-inotify (~> 0.9, >= 0.9.10)
52
+ mercenary (0.3.6)
53
+ parallel (1.19.1)
54
+ parser (2.7.0.5)
55
+ ast (~> 2.4.0)
56
+ pathutil (0.16.2)
57
+ forwardable-extended (~> 2.6)
58
+ public_suffix (4.0.3)
59
+ rainbow (3.0.0)
60
+ rake (13.0.1)
61
+ rb-fsevent (0.10.3)
62
+ rb-inotify (0.10.1)
63
+ ffi (~> 1.0)
64
+ rexml (3.2.4)
65
+ rouge (3.17.0)
66
+ rspec (3.9.0)
67
+ rspec-core (~> 3.9.0)
68
+ rspec-expectations (~> 3.9.0)
69
+ rspec-mocks (~> 3.9.0)
70
+ rspec-core (3.9.1)
71
+ rspec-support (~> 3.9.1)
72
+ rspec-expectations (3.9.1)
73
+ diff-lcs (>= 1.2.0, < 2.0)
74
+ rspec-support (~> 3.9.0)
75
+ rspec-mocks (3.9.1)
76
+ diff-lcs (>= 1.2.0, < 2.0)
77
+ rspec-support (~> 3.9.0)
78
+ rspec-support (3.9.2)
79
+ rubocop (0.80.1)
80
+ jaro_winkler (~> 1.5.1)
81
+ parallel (~> 1.10)
82
+ parser (>= 2.7.0.1)
83
+ rainbow (>= 2.2.2, < 4.0)
84
+ rexml
85
+ ruby-progressbar (~> 1.7)
86
+ unicode-display_width (>= 1.4.0, < 1.7)
87
+ rubocop-jekyll (0.11.0)
88
+ rubocop (>= 0.68.0, < 0.81.0)
89
+ rubocop-performance (~> 1.2)
90
+ rubocop-performance (1.5.2)
91
+ rubocop (>= 0.71.0)
92
+ ruby-progressbar (1.10.1)
93
+ safe_yaml (1.0.5)
94
+ sassc (2.2.1)
95
+ ffi (~> 1.9)
96
+ terminal-table (1.8.0)
97
+ unicode-display_width (~> 1.1, >= 1.1.1)
98
+ unicode-display_width (1.6.1)
99
+
100
+ PLATFORMS
101
+ ruby
102
+
103
+ DEPENDENCIES
104
+ bundler (~> 2.0.2)
105
+ jekyll-copyr!
106
+ rake (~> 13.0)
107
+ rspec (~> 3.0)
108
+ rubocop-jekyll (~> 0.11.0)
109
+
110
+ BUNDLED WITH
111
+ 2.0.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Danger Cove
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,54 @@
1
+ # Jekyll Copyr
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/jekyll-copyr.svg)](https://badge.fury.io/rb/jekyll-copyr)
4
+
5
+ A Jekyll plugin that taps into `FileUtils.cp_r` from your `_config.yml`. Easily copy files from anywhere into your site.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ # Gemfile
13
+
14
+ gem 'jekyll-copyr'
15
+ ```
16
+
17
+ And then add this line to your application's `_config.yml`:
18
+
19
+ ```yml
20
+ # _config.yml
21
+
22
+ plugins:
23
+ - jekyll-copyr
24
+
25
+ jekyll-copyr:
26
+ enabled: true # Optional, defaults to true
27
+ tasks:
28
+ - from: "./node_modules/@fortawesome/fontawesome-free/webfonts/."
29
+ to: "./_site/assets/webfonts/"
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ Add the `from` and `to` path of the files you want to copy into the array below `tasks`. You can add as many tasks as you want. The task above copies all the webfonts from fontawesome into the `_site` directory.
35
+
36
+ ## Purpose
37
+
38
+ I've built this plugin to work around the need to ship my entire `node_modules` folder just to use some webfonts from Font Awesome.
39
+
40
+ You can also copy files from outside your project folder into your site. This allows you to share files between projects.
41
+
42
+ ## Development
43
+
44
+ After checking out the repo, run `script/bootstrap` to install dependencies. Then, run `rake spec` to run the tests.
45
+
46
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `lib/jekyll-copyr/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).
47
+
48
+ ## Contributing
49
+
50
+ Bug reports and pull requests are welcome on GitHub at https://github.com/boyvanamstel/jekyll-copyr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to behave appropriately.
51
+
52
+ ## License
53
+
54
+ 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,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "jekyll-copyr/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "jekyll-copyr"
9
+ spec.version = Jekyll::Copyr::VERSION
10
+ spec.authors = ["Boy van Amstel"]
11
+
12
+ spec.summary = "A plugin for Jekyll to easily copy files."
13
+ spec.homepage = "https://www.github.com/dangercove/jekyll-copyr"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["source_code_uri"] = spec.homepage
20
+ spec.metadata["changelog_uri"] = spec.homepage
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| 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_dependency "jekyll", ">= 3.3", "< 5.0"
34
+ spec.add_development_dependency "bundler", "~> 2.0.2"
35
+ spec.add_development_dependency "rake", "~> 13.0"
36
+ spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency "rubocop-jekyll", "~> 0.11.0"
38
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ Jekyll::Hooks.register :site, :post_write do |site|
4
+ copier = Jekyll::Copyr::Copier.new site.config.fetch "jekyll-copyr", nil
5
+ copier.process_post_write
6
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+
5
+ module Jekyll
6
+ module Copyr
7
+ class Copier
8
+ DEFAULTS = { "enabled" => true, "tasks" => [] }.freeze
9
+
10
+ def initialize(config = {})
11
+ if config.is_a?(Hash)
12
+ @config = Utils.deep_merge_hashes DEFAULTS, config
13
+ else
14
+ @config = nil
15
+ Jekyll.logger.warn "Copyr:", "Expected a hash but got #{config.inspect}"
16
+ Jekyll.logger.warn "", "Files will not be copied for this site."
17
+ end
18
+ @enabled = @config["enabled"]
19
+ @tasks = @config["tasks"].map { |task_hash| Task.new task_hash }
20
+ end
21
+
22
+ def process_post_write
23
+ return unless @enabled == true
24
+
25
+ @tasks.each { |task| process task }
26
+ end
27
+
28
+ private
29
+
30
+ def process(task)
31
+ FileUtils.mkdir_p task.to
32
+ FileUtils.cp_r task.from, task.to
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Copyr
5
+ class Task
6
+ attr_accessor :from, :to
7
+
8
+ def initialize(task_hash = {})
9
+ @from = File.expand_path task_hash.fetch "from", nil
10
+ @to = File.expand_path task_hash.fetch "to", nil
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Copyr
5
+ VERSION = "1.0.0"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require "jekyll-copyr/version"
5
+ require "jekyll-copyr/copier"
6
+ require "jekyll-copyr/task"
7
+ require "jekyll/hooks/copyr"
8
+
9
+ module Jekyll
10
+ module Copyr
11
+ end
12
+ end
data/script/bootstrap 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
data/script/cibuild ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ set -ex
4
+
5
+ bundle exec rspec
6
+ bundle exec rubocop -S -D
7
+ bundle exec gem build jekyll-copyr.gemspec
data/script/release ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ set -ex
4
+
5
+ bundle exec rake release
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-copyr
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Boy van Amstel
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-03-22 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.3'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.3'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 2.0.2
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.2
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '13.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '13.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop-jekyll
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 0.11.0
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 0.11.0
89
+ description:
90
+ email:
91
+ executables: []
92
+ extensions: []
93
+ extra_rdoc_files: []
94
+ files:
95
+ - ".gitignore"
96
+ - ".rubocop.yml"
97
+ - Gemfile
98
+ - Gemfile.lock
99
+ - LICENSE
100
+ - README.md
101
+ - Rakefile
102
+ - jekyll-copyr.gemspec
103
+ - lib/jekyll-copyr.rb
104
+ - lib/jekyll-copyr/copier.rb
105
+ - lib/jekyll-copyr/task.rb
106
+ - lib/jekyll-copyr/version.rb
107
+ - lib/jekyll/hooks/copyr.rb
108
+ - script/bootstrap
109
+ - script/cibuild
110
+ - script/release
111
+ homepage: https://www.github.com/dangercove/jekyll-copyr
112
+ licenses:
113
+ - MIT
114
+ metadata:
115
+ source_code_uri: https://www.github.com/dangercove/jekyll-copyr
116
+ changelog_uri: https://www.github.com/dangercove/jekyll-copyr
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubygems_version: 3.0.3
133
+ signing_key:
134
+ specification_version: 4
135
+ summary: A plugin for Jekyll to easily copy files.
136
+ test_files: []