jekyll_make_archive 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +13 -0
- data/.ruby-version +1 -0
- data/.vscode/launch.json +47 -0
- data/.vscode/settings.json +3 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +134 -0
- data/LICENSE.txt +21 -0
- data/README.md +88 -0
- data/Rakefile +4 -0
- data/jekyll_make_archive.gemspec +46 -0
- data/lib/jekyll_make_archive/version.rb +5 -0
- data/lib/jekyll_make_archive.rb +165 -0
- data/sig/jekyll_make_archive.rbs +4 -0
- metadata +218 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d351abd9df4f884d406561fa62ef938ddcdf1fd5494391054aab76696d25aebf
|
4
|
+
data.tar.gz: ccf8ef089c791115d7ff251e259398688abf850c597391f3e8817f9280f4ed55
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 36ebd892e99a81d464593a4a15cf488e1849a46597d479b5a38bb4d93402d5c8786d681fa7de03ae6141ab5d67f8fe2084c8a3ebcf7748cc3f02ae9e9bb1a1a0
|
7
|
+
data.tar.gz: 1acc75d0a82f2aed49148300cb254b49905e3000b43911fde3a0623efd4f1ee149efd855ea59d16095e18a3aa6f473315e2c74568caaa77ed70625162a4e8fb6
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.0
|
data/.vscode/launch.json
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
{
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
3
|
+
// Hover to view descriptions of existing attributes.
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
{
|
8
|
+
"cwd": "${workspaceRoot}",
|
9
|
+
"name": "Attach rdebug-ide",
|
10
|
+
"request": "attach",
|
11
|
+
"remoteHost": "localhost",
|
12
|
+
"remotePort": "1234",
|
13
|
+
"remoteWorkspaceRoot": "/",
|
14
|
+
"restart": true,
|
15
|
+
"showDebuggerOutput": true,
|
16
|
+
"stopOnEntry": true,
|
17
|
+
"type": "Ruby",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"args": [
|
21
|
+
"-I",
|
22
|
+
"${workspaceRoot}",
|
23
|
+
"${file}"
|
24
|
+
],
|
25
|
+
"cwd": "${workspaceRoot}",
|
26
|
+
"name": "RSpec - active spec file only",
|
27
|
+
"program": "${env:HOME}/.rbenv/shims/rspec",
|
28
|
+
"showDebuggerOutput": false,
|
29
|
+
"request": "launch",
|
30
|
+
"type": "Ruby",
|
31
|
+
"useBundler": true,
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"args": [
|
35
|
+
"-I",
|
36
|
+
"${workspaceRoot}"
|
37
|
+
],
|
38
|
+
"cwd": "${workspaceRoot}",
|
39
|
+
"name": "RSpec - all",
|
40
|
+
"program": "${env:HOME}/.rbenv/shims/rspec",
|
41
|
+
"request": "launch",
|
42
|
+
"showDebuggerOutput": false,
|
43
|
+
"type": "Ruby",
|
44
|
+
"useBundler": true,
|
45
|
+
}
|
46
|
+
]
|
47
|
+
}
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
## 1.0.0 / 2022-03-13
|
2
|
+
* Made into a Ruby gem and published on RubyGems.org as [jekyll_make_archive](https://rubygems.org/gems/jekyll_make_archive).
|
3
|
+
* `bin/attach` script added for debugging
|
4
|
+
* Rubocop standards added
|
5
|
+
* Proper versioning and CHANGELOG.md added
|
6
|
+
|
7
|
+
## 2020-12-29
|
8
|
+
* Initial version published
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jekyll_make_archive (1.0.0)
|
5
|
+
jekyll (>= 3.5.0)
|
6
|
+
jekyll_plugin_logger
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.8.0)
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
13
|
+
ast (2.4.2)
|
14
|
+
colorator (1.1.0)
|
15
|
+
concurrent-ruby (1.1.9)
|
16
|
+
debase (0.2.4.1)
|
17
|
+
debase-ruby_core_source (>= 0.10.2)
|
18
|
+
debase-ruby_core_source (0.10.14)
|
19
|
+
diff-lcs (1.5.0)
|
20
|
+
em-websocket (0.5.3)
|
21
|
+
eventmachine (>= 0.12.9)
|
22
|
+
http_parser.rb (~> 0)
|
23
|
+
eventmachine (1.2.7)
|
24
|
+
ffi (1.15.5)
|
25
|
+
forwardable-extended (2.6.0)
|
26
|
+
http_parser.rb (0.8.0)
|
27
|
+
i18n (1.10.0)
|
28
|
+
concurrent-ruby (~> 1.0)
|
29
|
+
jekyll (4.2.2)
|
30
|
+
addressable (~> 2.4)
|
31
|
+
colorator (~> 1.0)
|
32
|
+
em-websocket (~> 0.5)
|
33
|
+
i18n (~> 1.0)
|
34
|
+
jekyll-sass-converter (~> 2.0)
|
35
|
+
jekyll-watch (~> 2.0)
|
36
|
+
kramdown (~> 2.3)
|
37
|
+
kramdown-parser-gfm (~> 1.0)
|
38
|
+
liquid (~> 4.0)
|
39
|
+
mercenary (~> 0.4.0)
|
40
|
+
pathutil (~> 0.9)
|
41
|
+
rouge (~> 3.0)
|
42
|
+
safe_yaml (~> 1.0)
|
43
|
+
terminal-table (~> 2.0)
|
44
|
+
jekyll-sass-converter (2.2.0)
|
45
|
+
sassc (> 2.0.1, < 3.0)
|
46
|
+
jekyll-watch (2.2.1)
|
47
|
+
listen (~> 3.0)
|
48
|
+
jekyll_plugin_logger (2.0.0)
|
49
|
+
jekyll
|
50
|
+
kramdown (2.3.1)
|
51
|
+
rexml
|
52
|
+
kramdown-parser-gfm (1.1.0)
|
53
|
+
kramdown (~> 2.0)
|
54
|
+
liquid (4.0.3)
|
55
|
+
listen (3.7.1)
|
56
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
57
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
58
|
+
mercenary (0.4.0)
|
59
|
+
parallel (1.21.0)
|
60
|
+
parser (3.1.1.0)
|
61
|
+
ast (~> 2.4.1)
|
62
|
+
pathutil (0.16.2)
|
63
|
+
forwardable-extended (~> 2.6)
|
64
|
+
public_suffix (4.0.6)
|
65
|
+
rainbow (3.1.1)
|
66
|
+
rake (13.0.6)
|
67
|
+
rb-fsevent (0.11.1)
|
68
|
+
rb-inotify (0.10.1)
|
69
|
+
ffi (~> 1.0)
|
70
|
+
regexp_parser (2.2.1)
|
71
|
+
rexml (3.2.5)
|
72
|
+
rouge (3.28.0)
|
73
|
+
rspec (3.11.0)
|
74
|
+
rspec-core (~> 3.11.0)
|
75
|
+
rspec-expectations (~> 3.11.0)
|
76
|
+
rspec-mocks (~> 3.11.0)
|
77
|
+
rspec-core (3.11.0)
|
78
|
+
rspec-support (~> 3.11.0)
|
79
|
+
rspec-expectations (3.11.0)
|
80
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
+
rspec-support (~> 3.11.0)
|
82
|
+
rspec-mocks (3.11.0)
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
+
rspec-support (~> 3.11.0)
|
85
|
+
rspec-support (3.11.0)
|
86
|
+
rubocop (1.18.4)
|
87
|
+
parallel (~> 1.10)
|
88
|
+
parser (>= 3.0.0.0)
|
89
|
+
rainbow (>= 2.2.2, < 4.0)
|
90
|
+
regexp_parser (>= 1.8, < 3.0)
|
91
|
+
rexml
|
92
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
93
|
+
ruby-progressbar (~> 1.7)
|
94
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
95
|
+
rubocop-ast (1.16.0)
|
96
|
+
parser (>= 3.1.1.0)
|
97
|
+
rubocop-jekyll (0.12.0)
|
98
|
+
rubocop (~> 1.18.0)
|
99
|
+
rubocop-performance (~> 1.2)
|
100
|
+
rubocop-performance (1.13.3)
|
101
|
+
rubocop (>= 1.7.0, < 2.0)
|
102
|
+
rubocop-ast (>= 0.4.0)
|
103
|
+
rubocop-rake (0.6.0)
|
104
|
+
rubocop (~> 1.0)
|
105
|
+
rubocop-rspec (2.4.0)
|
106
|
+
rubocop (~> 1.0)
|
107
|
+
rubocop-ast (>= 1.1.0)
|
108
|
+
ruby-debug-ide (0.7.3)
|
109
|
+
rake (>= 0.8.1)
|
110
|
+
ruby-progressbar (1.11.0)
|
111
|
+
safe_yaml (1.0.5)
|
112
|
+
sassc (2.4.0)
|
113
|
+
ffi (~> 1.9)
|
114
|
+
terminal-table (2.0.0)
|
115
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
116
|
+
unicode-display_width (1.8.0)
|
117
|
+
|
118
|
+
PLATFORMS
|
119
|
+
x86_64-linux
|
120
|
+
|
121
|
+
DEPENDENCIES
|
122
|
+
bundler
|
123
|
+
debase
|
124
|
+
jekyll_make_archive!
|
125
|
+
rake (~> 13.0)
|
126
|
+
rspec (~> 3.0)
|
127
|
+
rubocop
|
128
|
+
rubocop-jekyll
|
129
|
+
rubocop-rake
|
130
|
+
rubocop-rspec
|
131
|
+
ruby-debug-ide
|
132
|
+
|
133
|
+
BUNDLED WITH
|
134
|
+
2.3.8
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Mike Slinn
|
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,88 @@
|
|
1
|
+
Jekyll_make_archive
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/jekyll_make_archive.svg)](https://badge.fury.io/rb/jekyll_make_archive)
|
3
|
+
===========
|
4
|
+
|
5
|
+
This is a Jekyll plugin that makes tar or zip files based on `_config.yml` entries.
|
6
|
+
|
7
|
+
In production mode, the archives are built each time Jekyll generates the web site. In development mode, the archives are only built if they do not already exist, or if `delete: true` is set for that archive in `_config.yml`. Archives are placed in the top-level of the Jekyll project, and are copied to `_site` by Jekyll's normal build process. Entries are created in `.gitignore` for each of the generated archives.
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
This plugin supports 4 types of file specifications:
|
11
|
+
|
12
|
+
* Absolute filenames (start with /).
|
13
|
+
* Filenames relative to the top-level directory of the Jekyll web site (do not preface with . or /).
|
14
|
+
* Filenames relative to the user home directory (preface with ~).
|
15
|
+
* Executable filenames on the PATH (preface with !).
|
16
|
+
|
17
|
+
## `_config.yml` Syntax
|
18
|
+
Any number of archives can be specified. Each archive has 3 properties: `archive_name`, `delete` (defaults to true) and `files`. Take care that the dashes have exactly 2 spaces before them, and that the 2 lines following each dash have exactly 4 spaces in front.
|
19
|
+
|
20
|
+
```
|
21
|
+
make_archive:
|
22
|
+
-
|
23
|
+
archive_name: cloud9.zip
|
24
|
+
delete: true # This is the default, and need not be specified.
|
25
|
+
files: [ index.html, 404.html, ~/.ssh/config, /etc/passwd, '!update' ]
|
26
|
+
-
|
27
|
+
archive_name: cloud9.tar
|
28
|
+
delete: false # Do not overwrite the archive if it already exists
|
29
|
+
files: [ index.html, 404.html, ~/.ssh/config, /etc/passwd, '!update' ]
|
30
|
+
```
|
31
|
+
|
32
|
+
|
33
|
+
## Additional Information
|
34
|
+
More information is available on my web site about [my Jekyll plugins](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html).
|
35
|
+
|
36
|
+
|
37
|
+
## Installation
|
38
|
+
|
39
|
+
Add this line to your application's Gemfile, within the `jekyll_plugins` group:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
group :jekyll_plugins do
|
43
|
+
gem 'jekyll_make_archive'
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
And then execute:
|
48
|
+
|
49
|
+
$ bundle install
|
50
|
+
|
51
|
+
Or install it yourself as:
|
52
|
+
|
53
|
+
$ gem install jekyll_make_archive
|
54
|
+
|
55
|
+
|
56
|
+
## Development
|
57
|
+
|
58
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
59
|
+
|
60
|
+
Install development dependencies like this:
|
61
|
+
```
|
62
|
+
$ BUNDLE_WITH="development" bundle install
|
63
|
+
```
|
64
|
+
|
65
|
+
To install this gem onto your local machine, run:
|
66
|
+
```shell
|
67
|
+
$ bundle exec rake install
|
68
|
+
```
|
69
|
+
|
70
|
+
To release a new version,
|
71
|
+
1. Update the version number in `version.rb`.
|
72
|
+
2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
|
73
|
+
3. Run the following:
|
74
|
+
```shell
|
75
|
+
$ bundle exec rake release
|
76
|
+
```
|
77
|
+
The above creates a git tag for the version, commits the created tag,
|
78
|
+
and pushes the new `.gem` file to [RubyGems.org](https://rubygems.org).
|
79
|
+
|
80
|
+
|
81
|
+
## Contributing
|
82
|
+
|
83
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mslinn/jekyll_make_archive.
|
84
|
+
|
85
|
+
|
86
|
+
## License
|
87
|
+
|
88
|
+
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,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/jekyll_make_archive/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "jekyll_make_archive"
|
7
|
+
spec.version = JekyllPre::VERSION
|
8
|
+
spec.authors = ["Mike Slinn"]
|
9
|
+
spec.email = ["mslinn@mslinn.com"]
|
10
|
+
|
11
|
+
spec.summary = "Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable text."
|
12
|
+
spec.description = "Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable text."
|
13
|
+
spec.homepage = "https://github.com/mslinn/jekyll_make_archive"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/mslinn/jekyll_make_archive"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/mslinn/jekyll_make_archive/CHANGELOG.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_dependency 'jekyll', '>= 3.5.0'
|
35
|
+
spec.add_dependency 'jekyll_plugin_logger'
|
36
|
+
|
37
|
+
spec.add_development_dependency 'bundler'
|
38
|
+
spec.add_development_dependency 'debase'
|
39
|
+
spec.add_development_dependency 'rake'
|
40
|
+
spec.add_development_dependency 'rspec', "~> 3.0"
|
41
|
+
spec.add_development_dependency 'rubocop'
|
42
|
+
spec.add_development_dependency 'rubocop-jekyll'
|
43
|
+
spec.add_development_dependency 'rubocop-rake'
|
44
|
+
spec.add_development_dependency 'rubocop-rspec'
|
45
|
+
spec.add_development_dependency 'ruby-debug-ide'
|
46
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "fileutils"
|
4
|
+
require "jekyll_plugin_logger"
|
5
|
+
require "ptools"
|
6
|
+
require "rubygems"
|
7
|
+
require "rubygems/package"
|
8
|
+
require "tmpdir"
|
9
|
+
require "zlib"
|
10
|
+
require "zip"
|
11
|
+
require_relative "jekyll_make_archive/version"
|
12
|
+
|
13
|
+
module Jekyll
|
14
|
+
# Makes tar or zip file based on _config.yml entry
|
15
|
+
class MakeArchive < Jekyll::Generator
|
16
|
+
priority :high
|
17
|
+
|
18
|
+
# Method prescribed by the Jekyll plugin lifecycle.
|
19
|
+
# @param site [Jekyll.Site] Automatically provided by Jekyll plugin mechanism
|
20
|
+
# @return [void]
|
21
|
+
def generate(site)d
|
22
|
+
@live_reload = site.config["livereload"]
|
23
|
+
|
24
|
+
archive_config = site.config["make_archive"]
|
25
|
+
return if archive_config.nil?
|
26
|
+
|
27
|
+
archive_config.each do |config|
|
28
|
+
setup_instance_variables config
|
29
|
+
create_archive site.source
|
30
|
+
site.keep_files << @archive_name
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def setup_instance_variables(config)
|
37
|
+
@archive_name = config["archive_name"] # Relative to _site
|
38
|
+
abort "Error: archive_name was not specified in _config.yml." if @archive_name.nil?
|
39
|
+
|
40
|
+
@archive_type = archive_type(@archive_name)
|
41
|
+
|
42
|
+
@archive_files = config["files"].compact
|
43
|
+
abort "Error: archive files were not specified in _config.yml." if @archive_files.nil?
|
44
|
+
|
45
|
+
delete_archive = config["delete"]
|
46
|
+
@force_delete = delete_archive.nil? ? !@live_reload : delete_archive
|
47
|
+
|
48
|
+
debug { "@archive_name=#{@archive_name}; @live_reload=#{@live_reload}; @force_delete=#{@force_delete}; @archive_files=#{@archive_files}" }
|
49
|
+
end
|
50
|
+
|
51
|
+
def archive_type(archive_name)
|
52
|
+
if archive_name.end_with? ".zip"
|
53
|
+
:zip
|
54
|
+
elsif archive_name.end_with? ".tar"
|
55
|
+
:tar
|
56
|
+
else
|
57
|
+
abort "Error: archive must be zip or tar; #{archive_name} is of an unknown archive type."
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_archive(source)
|
62
|
+
archive_name_full = "#{source}/#{@archive_name}"
|
63
|
+
archive_exists = File.exist?(archive_name_full)
|
64
|
+
return if archive_exists && @live_reload
|
65
|
+
|
66
|
+
debug { "#{archive_name_full} exists? #{archive_exists}" }
|
67
|
+
if archive_exists && @force_delete
|
68
|
+
debug "Deleting old #{archive_name_full}"
|
69
|
+
File.delete(archive_name_full)
|
70
|
+
end
|
71
|
+
|
72
|
+
make_tar_or_zip(archive_exists, archive_name_full, source)
|
73
|
+
|
74
|
+
debug { "Looking for #{@archive_name} in .gitignore..." }
|
75
|
+
return if File.foreach(".gitignore").grep(%r!^#{@archive_name}\n?!).any?
|
76
|
+
|
77
|
+
warn "#{@archive_name} not found in .gitignore, adding entry."
|
78
|
+
File.open(".gitignore", "a") do |f|
|
79
|
+
f.puts File.basename(@archive_name)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def make_tar(tar_name, source)
|
84
|
+
Dir.mktmpdir do |dirname|
|
85
|
+
@archive_files.each do |filename|
|
86
|
+
fn, filename_full = qualify_file_name(filename, source)
|
87
|
+
debug { "Copying #{filename_full} to temporary directory #{dirname}; filename=#{filename}; fn=#{fn}" }
|
88
|
+
FileUtils.copy(filename_full, dirname)
|
89
|
+
end
|
90
|
+
write_tar(tar_name, dirname)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def make_tar_or_zip(archive_exists, archive_name_full, source)
|
95
|
+
if !archive_exists || @force_delete
|
96
|
+
debug { "Making #{archive_name_full}" }
|
97
|
+
case @archive_type
|
98
|
+
when :tar
|
99
|
+
make_tar(archive_name_full, source)
|
100
|
+
when :zip
|
101
|
+
make_zip(archive_name_full, source)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def make_zip(zip_name, source)
|
107
|
+
Zip.default_compression = Zlib::DEFAULT_COMPRESSION
|
108
|
+
Zip::File.open(zip_name, Zip::File::CREATE) do |zipfile|
|
109
|
+
@archive_files.each do |filename|
|
110
|
+
filename_in_archive, filename_original = qualify_file_name(filename, source)
|
111
|
+
debug { "make_zip: adding #{filename_original} to #{zip_name} as #{filename_in_archive}" }
|
112
|
+
zipfile.add(filename_in_archive, filename_original)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def write_tar(tar_name, dirname)
|
118
|
+
# Modified from https://gist.github.com/sinisterchipmunk/1335041/5be4e6039d899c9b8cca41869dc6861c8eb71f13
|
119
|
+
File.open(tar_name, "wb") do |tarfile|
|
120
|
+
Gem::Package::TarWriter.new(tarfile) do |tar|
|
121
|
+
Dir[File.join(dirname, "**/*")].each do |filename|
|
122
|
+
write_tar_entry(tar, dirname, filename)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def write_tar_entry(tar, dirname, filename)
|
129
|
+
mode = File.stat(filename).mode
|
130
|
+
relative_file = filename.sub(%r!^#{Regexp.escape dirname}/?!, "")
|
131
|
+
if File.directory?(filename)
|
132
|
+
tar.mkdir relative_file, mode
|
133
|
+
else
|
134
|
+
tar.add_file relative_file, mode do |tf|
|
135
|
+
File.open(filename, "rb") { |f| tf.write f.read }
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# @return tuple of filename (without path) and fully qualified filename
|
141
|
+
def qualify_file_name(path, source)
|
142
|
+
case path[0]
|
143
|
+
when "/" # Is the file absolute?
|
144
|
+
debug { "Absolute filename: #{path}" }
|
145
|
+
[File.basename(path), path]
|
146
|
+
when "!" # Should the file be found on the PATH?
|
147
|
+
clean_path = path[1..-1]
|
148
|
+
filename_full = File.which(clean_path)
|
149
|
+
abort "Error: #{clean_path} is not on the PATH." if filename_full.nil?
|
150
|
+
|
151
|
+
debug { "File on PATH: #{clean_path} -> #{filename_full}" }
|
152
|
+
[File.basename(clean_path), filename_full]
|
153
|
+
when "~" # Is the file relative to user's home directory?
|
154
|
+
clean_path = path[2..-1]
|
155
|
+
filename_full = File.join(ENV["HOME"], clean_path)
|
156
|
+
debug { "File in home directory: #{clean_path} -> #{filename_full}" }
|
157
|
+
[File.basename(clean_path), filename_full]
|
158
|
+
else # The file is relative to the Jekyll website top-level directory
|
159
|
+
debug { "Relative filename: #{path}" }
|
160
|
+
[File.basename(path), File.join(source, path)] # join yields the fully qualified path
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
info { "Loaded jekyll_make_archive plugin." }
|
165
|
+
end
|
metadata
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll_make_archive
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Slinn
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-19 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_logger
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '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'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
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: debase
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
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: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-jekyll
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-rspec
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: ruby-debug-ide
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable
|
168
|
+
text.
|
169
|
+
email:
|
170
|
+
- mslinn@mslinn.com
|
171
|
+
executables: []
|
172
|
+
extensions: []
|
173
|
+
extra_rdoc_files: []
|
174
|
+
files:
|
175
|
+
- ".rspec"
|
176
|
+
- ".rubocop.yml"
|
177
|
+
- ".ruby-version"
|
178
|
+
- ".vscode/launch.json"
|
179
|
+
- ".vscode/settings.json"
|
180
|
+
- CHANGELOG.md
|
181
|
+
- Gemfile
|
182
|
+
- Gemfile.lock
|
183
|
+
- LICENSE.txt
|
184
|
+
- README.md
|
185
|
+
- Rakefile
|
186
|
+
- jekyll_make_archive.gemspec
|
187
|
+
- lib/jekyll_make_archive.rb
|
188
|
+
- lib/jekyll_make_archive/version.rb
|
189
|
+
- sig/jekyll_make_archive.rbs
|
190
|
+
homepage: https://github.com/mslinn/jekyll_make_archive
|
191
|
+
licenses:
|
192
|
+
- MIT
|
193
|
+
metadata:
|
194
|
+
allowed_push_host: https://rubygems.org
|
195
|
+
homepage_uri: https://github.com/mslinn/jekyll_make_archive
|
196
|
+
source_code_uri: https://github.com/mslinn/jekyll_make_archive
|
197
|
+
changelog_uri: https://github.com/mslinn/jekyll_make_archive/CHANGELOG.md
|
198
|
+
post_install_message:
|
199
|
+
rdoc_options: []
|
200
|
+
require_paths:
|
201
|
+
- lib
|
202
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 2.6.0
|
207
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
|
+
requirements:
|
209
|
+
- - ">="
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '0'
|
212
|
+
requirements: []
|
213
|
+
rubygems_version: 3.2.3
|
214
|
+
signing_key:
|
215
|
+
specification_version: 4
|
216
|
+
summary: Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable
|
217
|
+
text.
|
218
|
+
test_files: []
|