jekyll_flexible_include 2.0.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5c1b70f6c4d2af7c842a903f5fed045b3a94f4e774d202ce4c46f1b95c0bc36
4
- data.tar.gz: 06d010e24a73c1de5ab88aa32482af9b34aedecdb5965884fb41eada3304417b
3
+ metadata.gz: 45d4ee5a84b021c967aaafa2e1894537041e4770c0604a76f02d8d9e03fc3c9e
4
+ data.tar.gz: 9f6337ca74f362b8a3870eb347f988ebc21ceaf73e3073c4bdd42c0bd2818cde
5
5
  SHA512:
6
- metadata.gz: 00cb719cdc78b8b2ef6540e3591cf69b49ad02b2088627f6cc9997f612211a3de6ce359264c7dedf5be31ba6903cf6ae08308a5331078f46a665f160d540dc0e
7
- data.tar.gz: 4de33e76a9cf52af682f1f01cc4b362ee6175ecf2484962ef6acb797b8367322a81da9f0a6e9ed332aa18aef0d604c97ba71c91ac60277c1e54c351171ae11c9
6
+ metadata.gz: 5dbdeef00337d13e4a2db94c80e25a324e2bf731886ead64678b3e579a2fb2b568fa9b3c2e68cafa00e21a2bc72fe47d2463e0f046df58f96285f76de0cc78e0
7
+ data.tar.gz: dae0c2b23c91458111599ee0db43dad4dc863dc14f6d52ba48e919bff0132d3b3eae160f748fffa7aabe5f82a82f0702113fad71bc6c7a2c16d2ad5f0f8a8180
@@ -0,0 +1,75 @@
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
+ "type": "Ruby",
17
+ },
18
+ {
19
+ "cwd": "${workspaceRoot}",
20
+ "debuggerPort": "1234",
21
+ "name": "Debug Jekyll",
22
+ "program": "/usr/local/bin/jekyll",
23
+ "args": [
24
+ "serve",
25
+ "--livereload_port", "35721",
26
+ "--force_polling",
27
+ "--host", "0.0.0.0",
28
+ "--port", "4001",
29
+ "--future",
30
+ "--incremental",
31
+ "--livereload",
32
+ "--drafts",
33
+ "--unpublished"
34
+ ],
35
+ "request": "launch",
36
+ "restart": true,
37
+ "showDebuggerOutput": true,
38
+ "stopOnEntry": true,
39
+ "type": "Ruby",
40
+ },
41
+ {
42
+ "name": "Debug Local Ruby",
43
+ "type": "Ruby",
44
+ "request": "launch",
45
+ "program": "${workspaceRoot}/main.rb"
46
+ },
47
+ {
48
+ "args": [
49
+ "-I",
50
+ "${workspaceRoot}",
51
+ "${file}"
52
+ ],
53
+ "cwd": "${workspaceRoot}",
54
+ "name": "RSpec - active spec file only",
55
+ "program": "/home/mslinn/.gems/bin/rspec",
56
+ "showDebuggerOutput": false,
57
+ "request": "launch",
58
+ "type": "Ruby",
59
+ "useBundler": true,
60
+ },
61
+ {
62
+ "args": [
63
+ "-I",
64
+ "${workspaceRoot}"
65
+ ],
66
+ "cwd": "${workspaceRoot}",
67
+ "name": "RSpec - all",
68
+ "program": "/home/mslinn/.gems/bin/rspec",
69
+ "request": "launch",
70
+ "showDebuggerOutput": false,
71
+ "type": "Ruby",
72
+ "useBundler": true,
73
+ }
74
+ ]
75
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "ruby.rubocop.configFilePath": ".rubocop.yml",
3
+ "ruby.rubocop.useBundler": true
4
+ }
data/CHANGELOG.md CHANGED
@@ -1,10 +1,14 @@
1
- # HEAD
1
+ ## 2.0.2 / 2022-03-11
2
+ * This version should actually work, crossing fingers
2
3
 
4
+ ## 2.0.1 / 2022-03-11
5
+ * Struggling with poorly documented gem naming conventions, this release is broken, do not use
3
6
  ## 2.0.0 / 2022-03-11
4
- * Made into a Ruby gem and published on RubyGems.org
7
+ * Made into a Ruby gem and published on RubyGems.org as [jekyll_flexible_include](https://rubygems.org/gems/jekyll_flexible_include).
5
8
  * `bin/attach` script added for debugging
6
9
  * Rubocop standards added
7
10
  * Proper versioning and CHANGELOG.md added
11
+ * This release is broken, do not use
8
12
 
9
13
  ## 1.1.1 / 2021-05-01
10
14
  * Handles spaces in filenames properly.
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in jekyll_flexible_include_plugin.gemspec
5
+ # Specify your gem's dependencies in jekyll_flexible_include.gemspec
6
6
  gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
data/Gemfile.lock CHANGED
@@ -1,25 +1,73 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll_flexible_include (2.0.0)
4
+ jekyll_flexible_include (2.0.2)
5
+ jekyll (>= 3.5.0)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
10
+ addressable (2.8.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
9
12
  ast (2.4.2)
10
13
  coderay (1.1.3)
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)
11
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 (0.9.5)
28
+ concurrent-ruby (~> 1.0)
29
+ jekyll (3.9.1)
30
+ addressable (~> 2.4)
31
+ colorator (~> 1.0)
32
+ em-websocket (~> 0.5)
33
+ i18n (~> 0.7)
34
+ jekyll-sass-converter (~> 1.0)
35
+ jekyll-watch (~> 2.0)
36
+ kramdown (>= 1.17, < 3)
37
+ liquid (~> 4.0)
38
+ mercenary (~> 0.3.3)
39
+ pathutil (~> 0.9)
40
+ rouge (>= 1.7, < 4)
41
+ safe_yaml (~> 1.0)
42
+ jekyll-sass-converter (1.5.2)
43
+ sass (~> 3.4)
44
+ jekyll-watch (2.2.1)
45
+ listen (~> 3.0)
46
+ kramdown (2.3.1)
47
+ rexml
48
+ liquid (4.0.3)
49
+ listen (3.7.1)
50
+ rb-fsevent (~> 0.10, >= 0.10.3)
51
+ rb-inotify (~> 0.9, >= 0.9.10)
52
+ mercenary (0.3.6)
12
53
  method_source (1.0.0)
13
54
  parallel (1.21.0)
14
55
  parser (3.1.1.0)
15
56
  ast (~> 2.4.1)
57
+ pathutil (0.16.2)
58
+ forwardable-extended (~> 2.6)
16
59
  pry (0.14.1)
17
60
  coderay (~> 1.1)
18
61
  method_source (~> 1.0)
62
+ public_suffix (4.0.6)
19
63
  rainbow (3.1.1)
20
64
  rake (13.0.6)
65
+ rb-fsevent (0.11.1)
66
+ rb-inotify (0.10.1)
67
+ ffi (~> 1.0)
21
68
  regexp_parser (2.2.1)
22
69
  rexml (3.2.5)
70
+ rouge (3.28.0)
23
71
  rspec (3.11.0)
24
72
  rspec-core (~> 3.11.0)
25
73
  rspec-expectations (~> 3.11.0)
@@ -50,7 +98,17 @@ GEM
50
98
  rubocop-performance (1.13.3)
51
99
  rubocop (>= 1.7.0, < 2.0)
52
100
  rubocop-ast (>= 0.4.0)
101
+ rubocop-rake (0.6.0)
102
+ rubocop (~> 1.0)
103
+ ruby-debug-ide (0.7.3)
104
+ rake (>= 0.8.1)
53
105
  ruby-progressbar (1.11.0)
106
+ safe_yaml (1.0.5)
107
+ sass (3.7.4)
108
+ sass-listen (~> 4.0.0)
109
+ sass-listen (4.0.0)
110
+ rb-fsevent (~> 0.9, >= 0.9.4)
111
+ rb-inotify (~> 0.9, >= 0.9.7)
54
112
  unicode-display_width (2.1.0)
55
113
 
56
114
  PLATFORMS
@@ -58,12 +116,16 @@ PLATFORMS
58
116
 
59
117
  DEPENDENCIES
60
118
  bundler
119
+ debase
120
+ jekyll
61
121
  jekyll_flexible_include!
62
122
  pry
63
123
  rake (~> 13.0)
64
124
  rspec
65
125
  rubocop
66
126
  rubocop-jekyll
127
+ rubocop-rake
128
+ ruby-debug-ide
67
129
 
68
130
  BUNDLED WITH
69
131
  2.3.7
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # Jekyll `flexible_include` Plugin
1
+ Jekyll `flexible_include` Plugin
2
+ [![Gem Version](https://badge.fury.io/rb/jekyll_flexible_include.svg)](https://badge.fury.io/rb/jekyll_flexible_include)
3
+ ===========
2
4
 
3
5
  `Flexible_include` is a Jekyll plugin that includes the contents of a file or the result of a process into a generated page. `Flexible_include` is useful because Jekyll's built-in `include` tag only supports the including of files residing within the `_includes/` subfolder of a Jekyll project, and because `flexible_include` offers additional ways of including content.
4
6
 
@@ -68,6 +70,14 @@ Following is a workaround.
68
70
  ## Known Issues
69
71
  If the plugin does not work:
70
72
  1. Ensure `_config.yml` doesn't have `safe: true`. That prevents all plugins from working.
73
+ 2. If you have version older than v2.x.x, delete the file `_plugins/flexible_include.rb` or you will have version conflicts.
74
+
75
+
76
+ ## Development
77
+
78
+ 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.
79
+
80
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
71
81
 
72
82
 
73
83
  ## Contributing
@@ -1,25 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/flexible_include/version"
3
+ require_relative "lib/jekyll_flexible_include/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "jekyll_flexible_include"
6
+ spec.name = 'jekyll_flexible_include'
7
7
  spec.version = JekyllFlexibleIncludePlugin::VERSION
8
- spec.authors = ["Mike Slinn"]
9
- spec.email = ["mslinn@mslinn.com"]
8
+ spec.authors = ['Mike Slinn']
9
+ spec.email = 'mslinn@mslinn.com'
10
10
 
11
- spec.summary = "Jekyll plugin supports various ways to include content into the generated site."
11
+ spec.summary = "This Jekyll plugin supports various ways to include content into the generated site."
12
12
  spec.description = <<~END_OF_DESC
13
13
  Jekyll's built-in include tag only supports including files within the _includes folder.
14
- This plugin supports 4 types of includes:
15
-
16
- - Absolute filenames (recognized by filename paths that start with /).
17
-
18
- - Filenames relative to the top-level directory of the Jekyll web site (relative paths do not start with . or /).
19
-
20
- - Filenames relative to the user home directory (recognized by filename paths starting with ~/).
21
-
22
- - Executable filenames on the PATH (recognized by filename paths that begin with !).
14
+ This plugin supports 4 types of includes: absolute filenames,
15
+ filenames relative to the top-level directory of the Jekyll web site,
16
+ filenames relative to the user home directory,
17
+ and executable filenames on the PATH.
23
18
  END_OF_DESC
24
19
  spec.homepage = "https://github.com/mslinn/jekyll_flexible_include_plugin"
25
20
  spec.license = "MIT"
@@ -42,10 +37,18 @@ Gem::Specification.new do |spec|
42
37
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
43
38
  spec.require_paths = ["lib"]
44
39
 
40
+ spec.post_install_message = "Thanks for installing jekyll_flexible_include!"
41
+
42
+ spec.add_runtime_dependency 'jekyll', '>= 3.5.0'
43
+
45
44
  spec.add_development_dependency 'bundler'
45
+ spec.add_development_dependency 'debase'
46
+ spec.add_development_dependency 'jekyll'
46
47
  spec.add_development_dependency 'pry'
47
48
  spec.add_development_dependency 'rake'
48
49
  spec.add_development_dependency 'rspec'
49
50
  spec.add_development_dependency 'rubocop'
50
51
  spec.add_development_dependency 'rubocop-jekyll'
52
+ spec.add_development_dependency 'rubocop-rake'
53
+ spec.add_development_dependency 'ruby-debug-ide'
51
54
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllFlexibleIncludePlugin
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.2"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "flexible_include/version"
3
+ require_relative "jekyll_flexible_include/version"
4
4
 
5
5
  module Jekyll
6
6
  module Tags
@@ -63,22 +63,6 @@ module Jekyll
63
63
  params
64
64
  end
65
65
 
66
- def validate_file_name(file)
67
- # TODO allow filenames relative to home directory
68
- if file.match VALID_FILENAME_CHARS
69
- raise ArgumentError, <<~MSG
70
- Invalid syntax for the flexible_ include tag. The included file contains invalid characters or sequences:
71
-
72
- #{file}
73
-
74
- Valid syntax:
75
-
76
- #{syntax_example}
77
-
78
- MSG
79
- end
80
- end
81
-
82
66
  def validate_params
83
67
  unless @params.match FULL_VALID_SYNTAX
84
68
  raise ArgumentError, <<~MSG
@@ -94,6 +78,11 @@ module Jekyll
94
78
  end
95
79
  end
96
80
 
81
+ # See https://gist.github.com/steakknife/4606598
82
+ def expand_env_vars(str)
83
+ str.gsub(/\$([a-zA-Z_]+[a-zA-Z0-9_]*)|\$\{(.+)\}/) { ENV[Regexp.last_match(1) || egexp.last_match(2)] }
84
+ end
85
+
97
86
  # Grab file read opts in the context
98
87
  def file_read_opts(context)
99
88
  context.registers[:site].file_read_opts
@@ -112,25 +101,26 @@ module Jekyll
112
101
 
113
102
  def render(context) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
114
103
  file = render_variable(context) || @file
115
- # strip leading and trailing quotes
116
- file = file.gsub!(/\A'|'\Z/, '')
117
- # validate_file_name(file) # TODO uncomment and fix validate_file_name
104
+ # strip leading and trailing quotes, and expand environment variables
105
+ file = expand_env_vars(file.gsub(/\A'|'\Z/, ''))
118
106
  path = file
119
- if /^\//.match(file) # Is the file absolute?
107
+ case file
108
+ when %r{\A/} # Is the file absolute?
120
109
  # puts "********** render path=#{path}, file=#{file} *************"
121
- elsif /~/.match(file) # Is the file relative to user's home directory?
110
+ when /\A~/ # Is the file relative to user's home directory?
122
111
  # puts "********** render original file=#{file}, path=#{path} *************"
123
112
  file.slice! "~/"
124
113
  path = File.join(ENV['HOME'], file)
125
114
  # puts "********** render path=#{path}, file=#{file} *************"
126
- elsif /\!/.match(file) # Is the file on the PATH?
115
+ when /\A!/ # Is the file on the PATH?
127
116
  # puts "********** render original file=#{file}, path=#{path} *************"
128
117
  file.slice! "!"
129
118
  path = File.which(file)
119
+ Jekyll.logger.error "Flexible_include error: #{file} was not found on the PATH, output was not included" unless path
130
120
  # puts "********** render path=#{path}, file=#{file} *************"
131
- else # The file is relative
132
- source = File.expand_path(context.registers[:site].config['source']).freeze # website root directory
133
- path = File.join(source, file) # Fully qualified path of include file
121
+ else # The file is relative
122
+ source = File.expand_path(context.registers[:site].config['source']) # website root directory
123
+ path = File.join(source, file) # Fully qualified path of include file
134
124
  # puts "********** render file=#{file}, path=#{path}, source=#{source} *************"
135
125
  end
136
126
  return unless path
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_flexible_include
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-11 00:00:00.000000000 Z
11
+ date: 2022-03-13 00:00:00.000000000 Z
12
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
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -24,6 +38,34 @@ dependencies:
24
38
  - - ">="
25
39
  - !ruby/object:Gem::Version
26
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: debase
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: jekyll
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'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: pry
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -94,35 +136,59 @@ dependencies:
94
136
  - - ">="
95
137
  - !ruby/object:Gem::Version
96
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-rake
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'
97
167
  description: |
98
168
  Jekyll's built-in include tag only supports including files within the _includes folder.
99
- This plugin supports 4 types of includes:
100
-
101
- - Absolute filenames (recognized by filename paths that start with /).
102
-
103
- - Filenames relative to the top-level directory of the Jekyll web site (relative paths do not start with . or /).
104
-
105
- - Filenames relative to the user home directory (recognized by filename paths starting with ~/).
106
-
107
- - Executable filenames on the PATH (recognized by filename paths that begin with !).
108
- email:
109
- - mslinn@mslinn.com
169
+ This plugin supports 4 types of includes: absolute filenames,
170
+ filenames relative to the top-level directory of the Jekyll web site,
171
+ filenames relative to the user home directory,
172
+ and executable filenames on the PATH.
173
+ email: mslinn@mslinn.com
110
174
  executables: []
111
175
  extensions: []
112
176
  extra_rdoc_files: []
113
177
  files:
114
178
  - ".editorconfig"
115
179
  - ".rubocop.yml"
180
+ - ".vscode/launch.json"
181
+ - ".vscode/settings.json"
116
182
  - CHANGELOG.md
117
183
  - Gemfile
118
184
  - Gemfile.lock
119
185
  - LICENSE
120
186
  - README.md
121
187
  - Rakefile
122
- - jekyll_flexible_include_plugin.gemspec
123
- - lib/flexible_include.rb
124
- - lib/flexible_include/version.rb
125
- - sig/jekyll_flexible_include_plugin.rbs
188
+ - jekyll_flexible_include.gemspec
189
+ - lib/jekyll_flexible_include.rb
190
+ - lib/jekyll_flexible_include/version.rb
191
+ - sig/jekyll_flexible_include.rbs
126
192
  homepage: https://github.com/mslinn/jekyll_flexible_include_plugin
127
193
  licenses:
128
194
  - MIT
@@ -131,7 +197,7 @@ metadata:
131
197
  homepage_uri: https://github.com/mslinn/jekyll_flexible_include_plugin
132
198
  source_code_uri: https://github.com/mslinn/jekyll_flexible_include_plugin
133
199
  changelog_uri: https://github.com/mslinn/jekyll_flexible_include_plugin/CHANGELOG.md
134
- post_install_message:
200
+ post_install_message: Thanks for installing jekyll_flexible_include!
135
201
  rdoc_options: []
136
202
  require_paths:
137
203
  - lib
@@ -149,6 +215,6 @@ requirements: []
149
215
  rubygems_version: 3.2.5
150
216
  signing_key:
151
217
  specification_version: 4
152
- summary: Jekyll plugin supports various ways to include content into the generated
218
+ summary: This Jekyll plugin supports various ways to include content into the generated
153
219
  site.
154
220
  test_files: []