jekyll_plugin_support 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -1
- data/CHANGELOG.md +33 -0
- data/README.md +43 -14
- data/jekyll_plugin_support.gemspec +1 -1
- data/lib/block/jekyll_plugin_support_block.rb +1 -1
- data/lib/helper/jekyll_plugin_helper.rb +4 -8
- data/lib/helper/jekyll_plugin_helper_class.rb +76 -8
- data/lib/jekyll_plugin_support/jekyll_plugin_support_class.rb +10 -5
- data/lib/jekyll_plugin_support/version.rb +1 -1
- data/lib/tag/jekyll_plugin_support_tag.rb +1 -1
- data/spec/expand_env_spec.rb +67 -0
- data/spec/jekyll_plugin_helper_options_spec.rb +4 -7
- data/spec/spec_helper.rb +2 -0
- data/spec/status_persistence.txt +52 -9
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a63b7533f8a3f533d8dc786921c5792b7517ac60c5fbb21f93b19e7a6a579f93
|
|
4
|
+
data.tar.gz: ad1d4c07e39743b8fd057f0235ab6ae6c1f89fa130026d7f7012d8a855cf5fc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db14aae8119f378a9032c6aefa6d9a0065e735c2dbf5965b136a1bf393782f573ed178645db5c50c420eb4b8767c046f7802be690628d3cc0efb57849e85ac00
|
|
7
|
+
data.tar.gz: 54ab6a67d6fecc4b587d00eda923868a0780555fa52af2ebe092fb080aa5537b01da7f99140cb0ab13c0ab9f3fc891b7f127f93d873c6b8c9eb478f90ba8c3fd
|
data/.rubocop.yml
CHANGED
|
@@ -92,7 +92,7 @@ RSpec/MultipleDescribes:
|
|
|
92
92
|
|
|
93
93
|
Security/Eval:
|
|
94
94
|
Exclude:
|
|
95
|
-
|
|
95
|
+
- spec/all_collections_tag/all_collections_tag_sort_spec.rb
|
|
96
96
|
|
|
97
97
|
Style/ClassVars:
|
|
98
98
|
Enabled: false
|
|
@@ -107,6 +107,11 @@ Style/GlobalVars:
|
|
|
107
107
|
Exclude:
|
|
108
108
|
- spec/mslinn_binary_search_spec.rb
|
|
109
109
|
|
|
110
|
+
Style/RedundantParentheses:
|
|
111
|
+
Exclude:
|
|
112
|
+
- README.md
|
|
113
|
+
- demo/_plugins/*.rb
|
|
114
|
+
|
|
110
115
|
Style/StringConcatenation:
|
|
111
116
|
Enabled: false
|
|
112
117
|
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.1.3 / 2025-01-02
|
|
4
|
+
|
|
5
|
+
* **BREAKING CHANGE**: Modified `JekyllPluginHelper.expand_env` to only expand Bash environment
|
|
6
|
+
variables (`$VAR` or `${VAR}`), not Windows environment variables (`%VAR%`). This prevents false
|
|
7
|
+
expansions in web content where text strings contain pairs of percent signs that are not
|
|
8
|
+
environment variables.
|
|
9
|
+
* Removed the `use_wslvar` parameter from `JekyllPluginHelper.expand_env` method signature.
|
|
10
|
+
* `JekyllPluginHelper.env_var_expand_windows` is still available for plugins that specifically
|
|
11
|
+
need Windows environment variable expansion.
|
|
12
|
+
* `jekyll_flexible_include_plugin` now explicitly calls both `env_var_expand_bash` and
|
|
13
|
+
`env_var_expand_windows` for file paths to maintain its ability to handle both Bash and
|
|
14
|
+
Windows environment variables.
|
|
15
|
+
* Updated `JekyllPluginHelper.find_windows_envar` to properly fall back to environment variable
|
|
16
|
+
search when `wslvar` is not available or doesn't find the variable.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 3.1.2 / 2025-11-17
|
|
20
|
+
|
|
21
|
+
* Support for [Claude CLI](https://www.mslinn.com/llm/7900-claude.html) is
|
|
22
|
+
provided in the `.claude` directory. This was implemented so it would work
|
|
23
|
+
with other LLMs, for example [Cursor](https://mslinn.com/llm/7980_cursor.html) and
|
|
24
|
+
[MiniMax Mini-Agent](https://www.mslinn.com/llm/7997-mini-agent.html).
|
|
25
|
+
* `JekyllPluginHelper.env_var_expand_windows` expands Windows environment
|
|
26
|
+
variables (surrounded by `%` characters) using a case-insensitive search,
|
|
27
|
+
which also works when running on Linux and macOS. This is used by
|
|
28
|
+
[`jekyll_flexible_include_plugin`](https://www.mslinn.com/jekyll_plugins/jekyll_flexible_include.html).
|
|
29
|
+
* `JekyllPluginHelper.wsl_detected?` detects if Jekyll is running under WSL
|
|
30
|
+
* Changed `JekyllPluginHelper.initialize` to make `no_arg_parsing` a keyword argument.
|
|
31
|
+
* Now requires `jekyll_draft` using `Gemfile` instead of the gemspec, to avoid a warning
|
|
32
|
+
when running `bundle install`.
|
|
33
|
+
* Handles `include` variables with types other than `String`.
|
|
34
|
+
|
|
35
|
+
|
|
3
36
|
## 3.1.1 / 2025-09-13
|
|
4
37
|
|
|
5
38
|
* Now looks up Windows environment variables (surrounded by `%` characters).
|
data/README.md
CHANGED
|
@@ -14,16 +14,36 @@ At present, only Jekyll tags and blocks are supported.
|
|
|
14
14
|
Public plugins that use `jekyll_plugin_support` include:
|
|
15
15
|
|
|
16
16
|
<ul style="columns: 2">
|
|
17
|
-
<li
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<li
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<li
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<li
|
|
17
|
+
<li>
|
|
18
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_badge'><code>jekyll_badge</code></a>
|
|
19
|
+
</li>
|
|
20
|
+
<li>
|
|
21
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_draft'><code>jekyll_draft</code></a>
|
|
22
|
+
</li>
|
|
23
|
+
<li>
|
|
24
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_emoji'><code>jekyll_emoji</code></a>
|
|
25
|
+
</li>
|
|
26
|
+
<li>
|
|
27
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_flexible_include.html'><code>jekyll_flexible_include</code></a>
|
|
28
|
+
</li>
|
|
29
|
+
<li>
|
|
30
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_google_translate'><code>jekyll_google_translate</code></a>
|
|
31
|
+
</li>
|
|
32
|
+
<li>
|
|
33
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_href.html'><code>jekyll_href</code></a>
|
|
34
|
+
</li>
|
|
35
|
+
<li>
|
|
36
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_img.html'><code>jekyll_img</code></a>
|
|
37
|
+
</li>
|
|
38
|
+
<li>
|
|
39
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_outline.html'><code>jekyll_outline</code></a>
|
|
40
|
+
</li>
|
|
41
|
+
<li>
|
|
42
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_pre.html'><code>jekyll_pre</code></a>
|
|
43
|
+
</li>
|
|
44
|
+
<li>
|
|
45
|
+
<a href='https://www.mslinn.com/jekyll_plugins/jekyll_quote.html'><code>jekyll_quote</code></a>
|
|
46
|
+
</li>
|
|
27
47
|
</ul>
|
|
28
48
|
|
|
29
49
|
... and also the demonstration plugins in
|
|
@@ -34,6 +54,7 @@ Public plugins that use `jekyll_plugin_support` include:
|
|
|
34
54
|
|
|
35
55
|
Jekyll plugin tags created from `jekyll_plugin_support` framework automatically have the following features:
|
|
36
56
|
|
|
57
|
+
0. Claude LLM support is provided
|
|
37
58
|
1. Boilerplate is removed, so you can focus on the required logic and output.
|
|
38
59
|
2. Arguments are parsed for keywords and name/value parameters.
|
|
39
60
|
3. Single or double quotes can be used for arguments and parameters.
|
|
@@ -73,15 +94,14 @@ Jekyll plugin tags created from `jekyll_plugin_support` framework automatically
|
|
|
73
94
|
|
|
74
95
|
### If You Need Windows Environment Variable Expansion
|
|
75
96
|
|
|
76
|
-
This
|
|
77
|
-
If you have a Mac, ignore the rest of this section, however be sure
|
|
78
|
-
not to try to include a file whose name contains two percent characters.
|
|
97
|
+
This works for Jekyll running on any OS.
|
|
79
98
|
|
|
99
|
+
A Jekyll Support plugin can selectively expand Windows-style environment variables
|
|
80
100
|
If a %WindowsStyleEnvironmentVariable% is detected in the `url` parameter,
|
|
81
101
|
`wslvar` is called.
|
|
82
102
|
If your WSL installation is old it might not have the `wslvar` command
|
|
83
103
|
|
|
84
|
-
The wslvar utility is part of the wslu package, a collection of useful utilities that come with WSL.
|
|
104
|
+
The wslvar utility is part of the `wslu` package, a collection of useful utilities that come with WSL.
|
|
85
105
|
The most straightforward fix is to reinstall it.
|
|
86
106
|
|
|
87
107
|
```shell
|
|
@@ -89,6 +109,15 @@ $ sudo apt update
|
|
|
89
109
|
$ sudo apt install wslu
|
|
90
110
|
```
|
|
91
111
|
|
|
112
|
+
If a Windows-style env var is evaluated on a non-Windows machine,
|
|
113
|
+
then a Bash environment variable of the same name is searched for and used, if found.
|
|
114
|
+
|
|
115
|
+
- If an exact case-sensitive match is found, it is used.
|
|
116
|
+
A debug-level log message is emitted stating what happened.
|
|
117
|
+
- If a case-insensitive match is found, it is used, and a warning is issued.
|
|
118
|
+
- If more than one case-insensitive match is found, Jekyll is shut down.
|
|
119
|
+
|
|
120
|
+
|
|
92
121
|
### For A Jekyll Website
|
|
93
122
|
|
|
94
123
|
`Jekyll_plugin_support` is packaged as a Ruby gem.
|
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
|
|
25
25
|
END_MESSAGE
|
|
26
26
|
spec.require_paths = ['lib']
|
|
27
|
-
spec.required_ruby_version = '>=
|
|
27
|
+
spec.required_ruby_version = '>= 3.4.0'
|
|
28
28
|
spec.summary = 'Provides a framework for writing and testing Jekyll plugins'
|
|
29
29
|
spec.test_files = spec.files.grep %r{^(test|spec|features)/}
|
|
30
30
|
spec.version = JekyllPluginSupportVersion::VERSION
|
|
@@ -30,7 +30,7 @@ module JekyllSupport
|
|
|
30
30
|
|
|
31
31
|
@logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
|
32
32
|
@logger.debug { "#{self.class}: respond_to?(:no_arg_parsing) #{respond_to?(:no_arg_parsing) ? 'yes' : 'no'}." }
|
|
33
|
-
@helper = JekyllPluginHelper.new
|
|
33
|
+
@helper = JekyllPluginHelper.new(tag_name, markup, @logger, no_arg_parsing: respond_to?(:no_arg_parsing))
|
|
34
34
|
|
|
35
35
|
@error_name = "#{tag_name.camelcase(:upper)}Error"
|
|
36
36
|
::JekyllSupport::CustomError.factory @error_name
|
|
@@ -9,16 +9,12 @@ module JekyllSupport
|
|
|
9
9
|
:keys_values, :jpsh_subclass_caller, :logger, :markup, :no_arg_parsing, :params, :params_original,
|
|
10
10
|
:tag_name
|
|
11
11
|
|
|
12
|
-
# See https://github.com/Shopify/liquid/wiki/Liquid-for-Programmers#create-your-own-tags
|
|
13
12
|
# @param tag_name [String] the name of the tag, which we already know.
|
|
14
|
-
# @param
|
|
15
|
-
# @param
|
|
16
|
-
#
|
|
17
|
-
# a boolean parameter that determines if error messages should display the line number the error occurred.
|
|
18
|
-
# This argument is used mostly to display localized error messages on Liquid built-in Tags and Filters.
|
|
19
|
-
# See https://github.com/Shopify/liquid/wiki/Liquid-for-Programmers#create-your-own-tags
|
|
13
|
+
# @param markup [String] the arguments from the tag, as a single string.
|
|
14
|
+
# @param logger [Jekyll::Logger] logger instance to use for logging messages.
|
|
15
|
+
# @param no_arg_parsing [Boolean] if true, argument parsing is suppressed.
|
|
20
16
|
# @return [void]
|
|
21
|
-
def initialize(tag_name, markup, logger, no_arg_parsing)
|
|
17
|
+
def initialize(tag_name, markup, logger, no_arg_parsing: false)
|
|
22
18
|
@tag_name = tag_name
|
|
23
19
|
@logger = logger
|
|
24
20
|
@markup = markup
|
|
@@ -5,9 +5,50 @@ require 'yaml'
|
|
|
5
5
|
module JekyllSupport
|
|
6
6
|
# Class methods for JekyllPluginHelper
|
|
7
7
|
class JekyllPluginHelper
|
|
8
|
-
#
|
|
8
|
+
# Case-insensitive search for a Bash environment variable name
|
|
9
|
+
# # @param name [String] name of environment variable to search for
|
|
10
|
+
# @return matching variable value, or nil if not found
|
|
11
|
+
def self.env_var_case_insensitive(name)
|
|
12
|
+
candidate = ENV.fetch(name, nil) # exact match first
|
|
13
|
+
return candidate if candidate
|
|
14
|
+
|
|
15
|
+
candidates = ENV.select do |key, _value| # case-insensitive search
|
|
16
|
+
key.casecmp?(name)
|
|
17
|
+
end.keys
|
|
18
|
+
case candidates.size
|
|
19
|
+
when 0
|
|
20
|
+
msg = "Environment variable #{name} is undefined, even with a case-insensitive search."
|
|
21
|
+
if Jekyll.logger
|
|
22
|
+
Jekyll.logger.warn msg
|
|
23
|
+
else
|
|
24
|
+
puts "jekyll_plugin_support warning: #{msg}".red
|
|
25
|
+
end
|
|
26
|
+
nil
|
|
27
|
+
when 1
|
|
28
|
+
candidates.first
|
|
29
|
+
else
|
|
30
|
+
msg = "Multiple case-insensitive matches found for environment variable #{name}: #{candidates.join(', ')}"
|
|
31
|
+
raise JekyllPluginSupportError, msg.red, []
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Expand an environment variable reference;
|
|
36
|
+
# - expand bash environment variables ($VAR or ${VAR})
|
|
37
|
+
# Note: Windows environment variables (%VAR%) are NOT expanded here
|
|
38
|
+
# because text content often contains percent pairs that aren't environment variables.
|
|
39
|
+
# Use env_var_expand_windows() directly if Windows environment variable expansion is needed.
|
|
9
40
|
def self.expand_env(str, logger = nil, die_if_undefined: false)
|
|
10
|
-
|
|
41
|
+
JekyllPluginHelper.env_var_expand_bash(str, logger, die_if_undefined: die_if_undefined)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# If a Windows-style env var is evaluated on a non-Windows machine,
|
|
45
|
+
# then a Bash environment variable of the same name is searched for and used, if found.
|
|
46
|
+
# - If an exact case-sensitive match is found, it is used.
|
|
47
|
+
# A debug-level log message is emitted stating what happened.
|
|
48
|
+
# - If a case-insensitive match is found, it is used, and a warning is issued.
|
|
49
|
+
# - If more than one case-insensitive match is found, Jekyll is shut down.
|
|
50
|
+
def self.env_var_expand_bash(str, logger = nil, die_if_undefined: false)
|
|
51
|
+
str&.gsub(/\$([a-zA-Z_][a-zA-Z0-9_]*)|\${\g<1>}/) do
|
|
11
52
|
envar = Regexp.last_match 1
|
|
12
53
|
unless ENV.key? envar
|
|
13
54
|
msg = "jekyll_plugin_support error: environment variable #{envar} is undefined"
|
|
@@ -21,12 +62,39 @@ module JekyllSupport
|
|
|
21
62
|
end
|
|
22
63
|
ENV.fetch(envar, nil)
|
|
23
64
|
end
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Called for Linux, MacOS, and Windows (with WSL)
|
|
68
|
+
#
|
|
69
|
+
def self.find_windows_envar(envar, use_wslvar: true)
|
|
70
|
+
if use_wslvar
|
|
71
|
+
wslvar_path = `which wslvar 2> /dev/null`.chomp
|
|
72
|
+
if wslvar_path.empty?
|
|
73
|
+
warn "jekyll_plugin_support warning: wslvar not found in PATH; will attempt to find $#{envar} in the bash environment variables."
|
|
74
|
+
return env_var_case_insensitive(envar)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
result = `wslvar #{envar} &2> /dev/null`.chomp
|
|
78
|
+
if result.empty?
|
|
79
|
+
warn "jekyll_plugin_support warning: wslvar did not find $#{envar}; will attempt to find it in the bash environment variables."
|
|
80
|
+
return env_var_case_insensitive(envar)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
return result
|
|
84
|
+
end
|
|
85
|
+
env_var_case_insensitive(envar)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Detect if Jekyll is running under WSL
|
|
89
|
+
def self.wsl_detected? = File.read('/proc/version').include?('-WSL')
|
|
90
|
+
|
|
91
|
+
def self.env_var_expand_windows(str, logger = nil, die_if_undefined: false, use_wslvar: true)
|
|
92
|
+
# Only expand %VAR% if str is not nil and contains a %
|
|
93
|
+
if str&.include?('%')
|
|
94
|
+
str.gsub(/%([a-zA-Z_][a-zA-Z0-9_]*)%|{\g<1>}/) do
|
|
27
95
|
envar = Regexp.last_match 1
|
|
28
|
-
value =
|
|
29
|
-
|
|
96
|
+
value = find_windows_envar(envar, use_wslvar: use_wslvar)
|
|
97
|
+
if value.to_s.empty?
|
|
30
98
|
msg = "jekyll_plugin_support error: Windows environment variable %#{envar}% is undefined"
|
|
31
99
|
raise JekyllPluginSupportError, msg.red, [] if die_if_undefined
|
|
32
100
|
|
|
@@ -39,7 +107,7 @@ module JekyllSupport
|
|
|
39
107
|
value
|
|
40
108
|
end
|
|
41
109
|
else
|
|
42
|
-
|
|
110
|
+
str
|
|
43
111
|
end
|
|
44
112
|
end
|
|
45
113
|
|
|
@@ -101,15 +101,16 @@ module JekyllSupport
|
|
|
101
101
|
|
|
102
102
|
def self.process_included_variables(logger, scope, markup)
|
|
103
103
|
scope['include']&.each do |name, value|
|
|
104
|
-
if
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
markup.gsub!("{{include.#{name}}}", value)
|
|
104
|
+
raise JekyllPluginSupportError, "include.#{name} is undefined." if name.nil?
|
|
105
|
+
raise JekyllPluginSupportError, "include.#{name} is a #{name.class}, not a String." unless name.instance_of?(String)
|
|
106
|
+
raise JekyllPluginSupportError, "include.#{name} has an undefined value." if value.nil?
|
|
107
|
+
|
|
108
|
+
markup.gsub!("{{include.#{name}}}", value.to_s)
|
|
109
109
|
end
|
|
110
110
|
markup
|
|
111
111
|
rescue StandardError => e
|
|
112
112
|
logger.error { e.full_message }
|
|
113
|
+
exit! 1
|
|
113
114
|
end
|
|
114
115
|
|
|
115
116
|
def self.process_layout_variables(logger, layout, markup)
|
|
@@ -127,6 +128,10 @@ module JekyllSupport
|
|
|
127
128
|
|
|
128
129
|
# Process assigned, captured and injected variables
|
|
129
130
|
def self.process_liquid_variables(logger, scope, markup)
|
|
131
|
+
unless markup.instance_of?(String)
|
|
132
|
+
logger.warn { "markup is a #{markup.class}, not a String" }
|
|
133
|
+
return markup
|
|
134
|
+
end
|
|
130
135
|
scope&.each do |name, value|
|
|
131
136
|
next if name.nil?
|
|
132
137
|
|
|
@@ -30,7 +30,7 @@ module JekyllSupport
|
|
|
30
30
|
|
|
31
31
|
@logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
|
32
32
|
@logger.debug { "#{self.class}: respond_to?(:no_arg_parsing) #{respond_to?(:no_arg_parsing) ? 'yes' : 'no'}." }
|
|
33
|
-
@helper = JekyllPluginHelper.new(tag_name, @argument_string, @logger, respond_to?(:no_arg_parsing))
|
|
33
|
+
@helper = JekyllPluginHelper.new(tag_name, @argument_string, @logger, no_arg_parsing: respond_to?(:no_arg_parsing))
|
|
34
34
|
|
|
35
35
|
@error_name = "#{tag_name.camelcase(:upper)}Error"
|
|
36
36
|
::JekyllSupport::CustomError.factory @error_name
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require_relative '../lib/jekyll_plugin_support'
|
|
3
|
+
|
|
4
|
+
ENV['SystemDrive'] = 'C:'
|
|
5
|
+
ENV['os'] = 'Windows_NT'
|
|
6
|
+
|
|
7
|
+
RSpec.describe('Bash and Windows environment variables') do # rubocop:disable RSpec/DescribeClass
|
|
8
|
+
it 'Expands bash environment variables only (no Windows expansion in expand_env)' do
|
|
9
|
+
actual = JekyllSupport::JekyllPluginHelper.expand_env '$HOME'
|
|
10
|
+
expect(actual).to eq(Dir.home)
|
|
11
|
+
|
|
12
|
+
actual = JekyllSupport::JekyllPluginHelper.expand_env '$HOME/abc'
|
|
13
|
+
expect(actual).to eq("#{Dir.home}/abc")
|
|
14
|
+
|
|
15
|
+
actual = JekyllSupport::JekyllPluginHelper.expand_env 'abc/$HOME/def'
|
|
16
|
+
expect(actual).to eq("abc/#{Dir.home}/def")
|
|
17
|
+
|
|
18
|
+
actual = JekyllSupport::JekyllPluginHelper.expand_env 'abc/$HOME/def'
|
|
19
|
+
expect(actual).to eq("abc/#{Dir.home}/def")
|
|
20
|
+
|
|
21
|
+
actual = JekyllSupport::JekyllPluginHelper.expand_env 'abc/$HOME/def/$HOST'
|
|
22
|
+
expect(actual).to eq("abc/#{Dir.home}/def/#{ENV.fetch('HOST', nil)}")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'Does NOT expand Windows environment variables in expand_env (only Bash)' do
|
|
26
|
+
# Windows environment variables should NOT be expanded by expand_env
|
|
27
|
+
actual = JekyllSupport::JekyllPluginHelper.expand_env '%SystemDrive%'
|
|
28
|
+
expect(actual).to eq('%SystemDrive%') # Should remain unchanged
|
|
29
|
+
|
|
30
|
+
actual = JekyllSupport::JekyllPluginHelper.expand_env '%SystemDrive%/abc'
|
|
31
|
+
expect(actual).to eq('%SystemDrive%/abc') # Should remain unchanged
|
|
32
|
+
|
|
33
|
+
actual = JekyllSupport::JekyllPluginHelper.expand_env 'abc/%SystemDrive%/def'
|
|
34
|
+
expect(actual).to eq('abc/%SystemDrive%/def') # Should remain unchanged
|
|
35
|
+
|
|
36
|
+
actual = JekyllSupport::JekyllPluginHelper.expand_env 'abc/%SystemDrive%/def/%os%'
|
|
37
|
+
expect(actual).to eq('abc/%SystemDrive%/def/%os%') # Should remain unchanged
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'expands Windows environment variables when env_var_expand_windows is called directly' do
|
|
41
|
+
actual = JekyllSupport::JekyllPluginHelper.env_var_expand_windows '%SystemDrive%'
|
|
42
|
+
expect(actual).to eq('C:')
|
|
43
|
+
|
|
44
|
+
actual = JekyllSupport::JekyllPluginHelper.env_var_expand_windows '%SystemDrive%/abc'
|
|
45
|
+
expect(actual).to eq('C:/abc')
|
|
46
|
+
|
|
47
|
+
actual = JekyllSupport::JekyllPluginHelper.env_var_expand_windows 'abc/%SystemDrive%/def'
|
|
48
|
+
expect(actual).to eq('abc/C:/def')
|
|
49
|
+
|
|
50
|
+
actual = JekyllSupport::JekyllPluginHelper.env_var_expand_windows 'abc/%SystemDrive%/def/%os%'
|
|
51
|
+
expect(actual).to eq('abc/C:/def/Windows_NT')
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'expands Windows environment variables when env_var_expand_windows is called directly with use_wslvar: false' do
|
|
55
|
+
actual = JekyllSupport::JekyllPluginHelper.env_var_expand_windows '%SystemDrive%', use_wslvar: false
|
|
56
|
+
expect(actual).to eq('C:')
|
|
57
|
+
|
|
58
|
+
actual = JekyllSupport::JekyllPluginHelper.env_var_expand_windows '%SystemDrive%/abc', use_wslvar: false
|
|
59
|
+
expect(actual).to eq('C:/abc')
|
|
60
|
+
|
|
61
|
+
actual = JekyllSupport::JekyllPluginHelper.env_var_expand_windows 'abc/%SystemDrive%/def', use_wslvar: false
|
|
62
|
+
expect(actual).to eq('abc/C:/def')
|
|
63
|
+
|
|
64
|
+
actual = JekyllSupport::JekyllPluginHelper.env_var_expand_windows 'abc/%SystemDrive%/def/%os%', use_wslvar: false
|
|
65
|
+
expect(actual).to eq('abc/C:/def/Windows_NT')
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
require 'jekyll'
|
|
2
|
-
require 'jekyll_plugin_logger'
|
|
3
1
|
require 'spec_helper'
|
|
4
|
-
# require 'rspec/match_ignoring_whitespace'
|
|
5
2
|
require_relative '../lib/jekyll_plugin_support'
|
|
6
3
|
require_relative '../lib/jekyll_plugin_support/jekyll_plugin_support_spec_support'
|
|
7
4
|
|
|
@@ -10,7 +7,7 @@ class JekyllPluginHelperOptionsTest
|
|
|
10
7
|
logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
|
11
8
|
|
|
12
9
|
it 'parses quoted string options' do
|
|
13
|
-
helper = described_class.new('my_tag', "colors='blue or green' blah ick", logger, false)
|
|
10
|
+
helper = described_class.new('my_tag', "colors='blue or green' blah ick", logger, no_arg_parsing: false)
|
|
14
11
|
helper.reinitialize helper.markup
|
|
15
12
|
expect(helper.keys_values.keys).to eq(%w[colors blah ick])
|
|
16
13
|
|
|
@@ -21,7 +18,7 @@ class JekyllPluginHelperOptionsTest
|
|
|
21
18
|
end
|
|
22
19
|
|
|
23
20
|
it 'parses unquoted string options' do
|
|
24
|
-
helper = described_class.new('my_tag', 'color=blue blah ick', logger, false)
|
|
21
|
+
helper = described_class.new('my_tag', 'color=blue blah ick', logger, no_arg_parsing: false)
|
|
25
22
|
helper.reinitialize helper.markup
|
|
26
23
|
expect(helper.keys_values.keys).to eq(%w[color blah ick])
|
|
27
24
|
|
|
@@ -32,7 +29,7 @@ class JekyllPluginHelperOptionsTest
|
|
|
32
29
|
end
|
|
33
30
|
|
|
34
31
|
it 'parses quoted booleans' do
|
|
35
|
-
helper = described_class.new('my_tag', "bool1='true' bool2='false' blah ick", logger, false)
|
|
32
|
+
helper = described_class.new('my_tag', "bool1='true' bool2='false' blah ick", logger, no_arg_parsing: false)
|
|
36
33
|
helper.reinitialize helper.markup
|
|
37
34
|
expect(helper.keys_values.keys).to eq(%w[bool1 bool2 blah ick])
|
|
38
35
|
|
|
@@ -48,7 +45,7 @@ class JekyllPluginHelperOptionsTest
|
|
|
48
45
|
end
|
|
49
46
|
|
|
50
47
|
it 'parses unquoted booleans' do
|
|
51
|
-
helper = described_class.new('my_tag', 'bool1=true bool2=false blah ick', logger, false)
|
|
48
|
+
helper = described_class.new('my_tag', 'bool1=true bool2=false blah ick', logger, no_arg_parsing: false)
|
|
52
49
|
helper.reinitialize helper.markup
|
|
53
50
|
expect(helper.keys_values.keys).to eq(%w[bool1 bool2 blah ick])
|
|
54
51
|
|
data/spec/spec_helper.rb
CHANGED
data/spec/status_persistence.txt
CHANGED
|
@@ -1,9 +1,52 @@
|
|
|
1
|
-
example_id
|
|
2
|
-
|
|
3
|
-
./spec/
|
|
4
|
-
./spec/
|
|
5
|
-
./spec/
|
|
6
|
-
./spec/
|
|
7
|
-
./spec/
|
|
8
|
-
./spec/
|
|
9
|
-
./spec/
|
|
1
|
+
example_id | status | run_time |
|
|
2
|
+
----------------------------------------------------------------- | ------- | --------------- |
|
|
3
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:1] | passed | 0.00367 seconds |
|
|
4
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:2] | passed | 0.00321 seconds |
|
|
5
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:3] | passed | 0.004 seconds |
|
|
6
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:4] | passed | 0.00724 seconds |
|
|
7
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:5] | passed | 0.00321 seconds |
|
|
8
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:6] | passed | 0.00501 seconds |
|
|
9
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:7] | passed | 0.00573 seconds |
|
|
10
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:8] | passed | 0.00661 seconds |
|
|
11
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:9] | passed | 0.00674 seconds |
|
|
12
|
+
./spec/all_collections_tag/all_collections_tag_sort_spec.rb[1:10] | passed | 0.00399 seconds |
|
|
13
|
+
./spec/bsearch_spec.rb[1:1] | pending | 0.00029 seconds |
|
|
14
|
+
./spec/bsearch_spec.rb[1:2] | pending | 0.00009 seconds |
|
|
15
|
+
./spec/custom_error_spec.rb[1:1] | passed | 0.0022 seconds |
|
|
16
|
+
./spec/custom_error_spec.rb[2:1] | passed | 0.0016 seconds |
|
|
17
|
+
./spec/date_sort_spec.rb[1:1] | passed | 0.00043 seconds |
|
|
18
|
+
./spec/date_sort_spec.rb[1:2] | passed | 0.00125 seconds |
|
|
19
|
+
./spec/date_sort_spec.rb[1:3] | passed | 0.00004 seconds |
|
|
20
|
+
./spec/date_sort_spec.rb[1:4] | passed | 0.00004 seconds |
|
|
21
|
+
./spec/date_sort_spec.rb[1:5] | passed | 0.00022 seconds |
|
|
22
|
+
./spec/date_sort_spec.rb[1:6] | passed | 0.00004 seconds |
|
|
23
|
+
./spec/date_sort_spec.rb[1:7] | passed | 0.00016 seconds |
|
|
24
|
+
./spec/date_sort_spec.rb[1:8] | passed | 0.00019 seconds |
|
|
25
|
+
./spec/date_sort_spec.rb[1:9] | passed | 0.00004 seconds |
|
|
26
|
+
./spec/date_sort_spec.rb[1:10] | passed | 0.00004 seconds |
|
|
27
|
+
./spec/expand_env_spec.rb[1:1] | passed | 0.0004 seconds |
|
|
28
|
+
./spec/expand_env_spec.rb[1:2] | passed | 2.09 seconds |
|
|
29
|
+
./spec/expand_env_spec.rb[1:3] | passed | 0.00015 seconds |
|
|
30
|
+
./spec/jekyll_plugin_helper_options_spec.rb[1:1] | passed | 0.00032 seconds |
|
|
31
|
+
./spec/jekyll_plugin_helper_options_spec.rb[1:2] | passed | 0.00013 seconds |
|
|
32
|
+
./spec/jekyll_plugin_helper_options_spec.rb[1:3] | passed | 0.00414 seconds |
|
|
33
|
+
./spec/jekyll_plugin_helper_options_spec.rb[1:4] | passed | 0.00074 seconds |
|
|
34
|
+
./spec/liquid_variable_parsing_spec.rb[1:1] | passed | 0.00186 seconds |
|
|
35
|
+
./spec/mslinn_binary_search_spec.rb[1:1] | passed | 0.00343 seconds |
|
|
36
|
+
./spec/mslinn_binary_search_spec.rb[1:2] | passed | 0.00018 seconds |
|
|
37
|
+
./spec/mslinn_binary_search_spec.rb[1:3] | passed | 0.00013 seconds |
|
|
38
|
+
./spec/send_chain_spec.rb[1:1] | passed | 0.00011 seconds |
|
|
39
|
+
./spec/send_chain_spec.rb[1:2] | passed | 0.00003 seconds |
|
|
40
|
+
./spec/send_chain_spec.rb[1:3] | passed | 0.00002 seconds |
|
|
41
|
+
./spec/send_chain_spec.rb[1:4] | passed | 0.00002 seconds |
|
|
42
|
+
./spec/send_chain_spec.rb[1:5] | passed | 0.00002 seconds |
|
|
43
|
+
./spec/send_chain_spec.rb[1:6] | passed | 0.00002 seconds |
|
|
44
|
+
./spec/send_chain_spec.rb[1:7] | passed | 0.00034 seconds |
|
|
45
|
+
./spec/send_spec.rb[1:1] | passed | 0.00011 seconds |
|
|
46
|
+
./spec/send_spec.rb[1:2] | passed | 0.00003 seconds |
|
|
47
|
+
./spec/sorted_lru_files_spec.rb[1:1] | passed | 0.00078 seconds |
|
|
48
|
+
./spec/sorted_lru_files_spec.rb[1:2] | passed | 0.00031 seconds |
|
|
49
|
+
./spec/sorted_lru_files_spec.rb[1:3] | passed | 0.00003 seconds |
|
|
50
|
+
./spec/sorted_lru_files_spec.rb[1:4] | passed | 0.00068 seconds |
|
|
51
|
+
./spec/testable_spec.rb[1:1] | passed | 0.00003 seconds |
|
|
52
|
+
./spec/testable_spec.rb[2:1] | passed | 0.00003 seconds |
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll_plugin_support
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1.
|
|
4
|
+
version: 3.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Slinn
|
|
@@ -145,6 +145,7 @@ files:
|
|
|
145
145
|
- spec/bsearch_spec.rb
|
|
146
146
|
- spec/custom_error_spec.rb
|
|
147
147
|
- spec/date_sort_spec.rb
|
|
148
|
+
- spec/expand_env_spec.rb
|
|
148
149
|
- spec/jekyll_plugin_helper_options_spec.rb
|
|
149
150
|
- spec/liquid_variable_parsing_spec.rb
|
|
150
151
|
- spec/mslinn_binary_search_spec.rb
|
|
@@ -174,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
174
175
|
requirements:
|
|
175
176
|
- - ">="
|
|
176
177
|
- !ruby/object:Gem::Version
|
|
177
|
-
version:
|
|
178
|
+
version: 3.4.0
|
|
178
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
180
|
requirements:
|
|
180
181
|
- - ">="
|
|
@@ -189,6 +190,7 @@ test_files:
|
|
|
189
190
|
- spec/bsearch_spec.rb
|
|
190
191
|
- spec/custom_error_spec.rb
|
|
191
192
|
- spec/date_sort_spec.rb
|
|
193
|
+
- spec/expand_env_spec.rb
|
|
192
194
|
- spec/jekyll_plugin_helper_options_spec.rb
|
|
193
195
|
- spec/liquid_variable_parsing_spec.rb
|
|
194
196
|
- spec/mslinn_binary_search_spec.rb
|