jekyll_begin_end 1.0.0 → 1.0.1
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/CHANGELOG.md +3 -0
- data/jekyll_begin_end.gemspec +1 -1
- data/lib/jekyll_begin_end/version.rb +2 -2
- data/lib/jekyll_begin_end.rb +10 -12
- data/spec/jekyll_begin_end_spec.rb +82 -0
- data/spec/spec_helper.rb +4 -2
- data/spec/status_persistence.txt +7 -0
- metadata +6 -4
- data/spec/jekyll_begin_end.rb +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e161bdb83f945ce319d052d4309f50037442b6a7ede007c1ce43dee084193376
|
4
|
+
data.tar.gz: 524bbda15d6af9d989db060e9af5d3b15d99ac803996ad495cdf85a4d2ff4232
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9501739faa512fa2997a0f6920892a1aad5ec7c751a8a734f9a34df931beeca332e32d8a4feb0c4a4227d441b193e08eaf05baebf914fae11596bd0ca247d2fe
|
7
|
+
data.tar.gz: 7287741f0141be7754be31fec9e67b719d8c0d53cdef2c82b246f1e008dc73cfce3e0f74e7ff0eff08ffcd4b4e42ae6d90d50b0d4d7b7f48d9e17cb4f46c40e2
|
data/CHANGELOG.md
CHANGED
data/jekyll_begin_end.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.summary = "This Jekyll plugin provides 5 filters that return portions of a string: begins_with, " \
|
33
33
|
"does_not_begin_with, ends_with, does_not_end_with and append_suffix_if_does_not_start_with."
|
34
34
|
spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
|
35
|
-
spec.version =
|
35
|
+
spec.version = JekyllBeginEndVersion::VERSION
|
36
36
|
|
37
37
|
spec.add_dependency "jekyll", ">= 3.5.0"
|
38
38
|
spec.add_dependency "jekyll_plugin_logger"
|
data/lib/jekyll_begin_end.rb
CHANGED
@@ -1,22 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "jekyll"
|
3
4
|
require "jekyll_plugin_logger"
|
4
5
|
require_relative "jekyll_begin_end/version"
|
5
6
|
|
6
7
|
# Jekyll filters for working with strings.
|
7
8
|
|
8
|
-
module
|
9
|
-
|
10
|
-
|
11
|
-
def does_not_begin_with(text, query)
|
12
|
-
!text.start_with? query
|
9
|
+
module JekyllBeginEnd
|
10
|
+
def append_suffix_if_does_not_start_with(text, query, suffix)
|
11
|
+
text.start_with?(query) ? text : "#{text}#{suffix}"
|
13
12
|
end
|
14
13
|
|
15
14
|
def begins_with(text, query)
|
16
|
-
@logger.debug { "text=#{text} query=#{query} result: #{text.start_with? query}" }
|
17
15
|
text.start_with? query
|
18
16
|
end
|
19
17
|
|
18
|
+
def does_not_begin_with(text, query)
|
19
|
+
!text.start_with? query
|
20
|
+
end
|
21
|
+
|
20
22
|
def does_not_end_with(text, query)
|
21
23
|
!text.end_with? query
|
22
24
|
end
|
@@ -24,11 +26,7 @@ module StringFilter
|
|
24
26
|
def ends_with(text, query)
|
25
27
|
text.end_with? query
|
26
28
|
end
|
27
|
-
|
28
|
-
def append_suffix_if_does_not_start_with(text, query, suffix)
|
29
|
-
text.start_with? query ? text : "#{text}#{suffix}"
|
30
|
-
end
|
31
29
|
end
|
32
30
|
|
33
|
-
PluginMetaLogger.instance.info { "Loaded jekyll_begin_end v#{
|
34
|
-
Liquid::Template.register_filter(
|
31
|
+
PluginMetaLogger.instance.info { "Loaded jekyll_begin_end v#{JekyllBeginEndVersion::VERSION} plugin." }
|
32
|
+
Liquid::Template.register_filter(JekyllBeginEnd)
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'liquid'
|
4
|
+
require 'fileutils'
|
5
|
+
require_relative '../lib/jekyll_begin_end'
|
6
|
+
|
7
|
+
RSpec.describe(JekyllBeginEnd) do
|
8
|
+
include JekyllBeginEnd
|
9
|
+
|
10
|
+
let(:gitignore) do
|
11
|
+
<<~END_OF_LINES
|
12
|
+
.bsp/
|
13
|
+
project/
|
14
|
+
target/
|
15
|
+
*.gz
|
16
|
+
*.sublime*
|
17
|
+
*.swp
|
18
|
+
*.out
|
19
|
+
*.Identifier
|
20
|
+
*.log
|
21
|
+
.idea*
|
22
|
+
*.iml
|
23
|
+
*.tmp
|
24
|
+
*~
|
25
|
+
~*
|
26
|
+
.DS_Store
|
27
|
+
.idea
|
28
|
+
.jekyll-cache/
|
29
|
+
.jekyll-metadata
|
30
|
+
.makeAwsBucketAndDistribution.log
|
31
|
+
.sass-cache/
|
32
|
+
.yardoc/
|
33
|
+
__pycache__/
|
34
|
+
__MACOSX
|
35
|
+
_build/
|
36
|
+
_package/
|
37
|
+
_site/
|
38
|
+
bin/*.class
|
39
|
+
doc/
|
40
|
+
jekyll/doc/
|
41
|
+
node_modules/
|
42
|
+
Notepad++/
|
43
|
+
out/
|
44
|
+
package/
|
45
|
+
instances.json
|
46
|
+
rescue_ubuntu2010
|
47
|
+
rescue_ubuntu2010.b64
|
48
|
+
landingPageShortName.md
|
49
|
+
test.html
|
50
|
+
RUNNING_PID
|
51
|
+
mslinn_jekyll_plugins.zip
|
52
|
+
cloud9.tar
|
53
|
+
cloud9.zip
|
54
|
+
mslinn_aws.tar
|
55
|
+
END_OF_LINES
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'verifies begins_with' do
|
59
|
+
expect(begins_with("321", '3')).to be true
|
60
|
+
expect(begins_with("321", '1')).to be false
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'verifies ends_with' do
|
64
|
+
expect(ends_with("321", '1')).to be true
|
65
|
+
expect(ends_with("321", '3')).to be false
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'verifies does_not_begin_with' do
|
69
|
+
expect(does_not_begin_with("321", '1')).to be true
|
70
|
+
expect(does_not_begin_with("321", '3')).to be false
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'verifies does_not_end_with' do
|
74
|
+
expect(does_not_end_with("321", '3')).to be true
|
75
|
+
expect(does_not_end_with("321", '1')).to be false
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'verifies append_suffix_if_does_not_start_with' do
|
79
|
+
expect(append_suffix_if_does_not_start_with("321", '3', "x")).to eq("321")
|
80
|
+
expect(append_suffix_if_does_not_start_with("321", '1', "x")).to eq("321x")
|
81
|
+
end
|
82
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,9 @@ require 'fileutils'
|
|
5
5
|
require_relative '../lib/jekyll_begin_end'
|
6
6
|
|
7
7
|
RSpec.configure do |config|
|
8
|
-
config.run_all_when_everything_filtered = true
|
9
8
|
config.filter_run :focus
|
10
9
|
config.order = 'random'
|
11
|
-
|
10
|
+
config.run_all_when_everything_filtered = true
|
11
|
+
|
12
|
+
# See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
|
13
|
+
config.example_status_persistence_file_path = "spec/status_persistence.txt"end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
------------------------------------ | ------ | --------------- |
|
3
|
+
./spec/jekyll_begin_end_spec.rb[1:1] | passed | 0.00173 seconds |
|
4
|
+
./spec/jekyll_begin_end_spec.rb[1:2] | passed | 0.00008 seconds |
|
5
|
+
./spec/jekyll_begin_end_spec.rb[1:3] | passed | 0.00008 seconds |
|
6
|
+
./spec/jekyll_begin_end_spec.rb[1:4] | passed | 0.00011 seconds |
|
7
|
+
./spec/jekyll_begin_end_spec.rb[1:5] | passed | 0.00152 seconds |
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_begin_end
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
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
|
+
date: 2022-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -87,8 +87,9 @@ files:
|
|
87
87
|
- jekyll_begin_end.gemspec
|
88
88
|
- lib/jekyll_begin_end.rb
|
89
89
|
- lib/jekyll_begin_end/version.rb
|
90
|
-
- spec/
|
90
|
+
- spec/jekyll_begin_end_spec.rb
|
91
91
|
- spec/spec_helper.rb
|
92
|
+
- spec/status_persistence.txt
|
92
93
|
homepage: https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#begin_end
|
93
94
|
licenses:
|
94
95
|
- MIT
|
@@ -119,5 +120,6 @@ specification_version: 4
|
|
119
120
|
summary: 'This Jekyll plugin provides 5 filters that return portions of a string:
|
120
121
|
begins_with, does_not_begin_with, ends_with, does_not_end_with and append_suffix_if_does_not_start_with.'
|
121
122
|
test_files:
|
122
|
-
- spec/
|
123
|
+
- spec/jekyll_begin_end_spec.rb
|
123
124
|
- spec/spec_helper.rb
|
125
|
+
- spec/status_persistence.txt
|
data/spec/jekyll_begin_end.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'liquid'
|
4
|
-
require 'fileutils'
|
5
|
-
require "jekyll_plugin_logger"
|
6
|
-
require_relative '../lib/jekyll_begin_end'
|
7
|
-
|
8
|
-
RSpec.describe(JekyllFromToUntil) do
|
9
|
-
include JekyllFromToUntil
|
10
|
-
|
11
|
-
_logger = PluginMetaLogger.new_logger(self)
|
12
|
-
|
13
|
-
let(:lines) do
|
14
|
-
<<~END_OF_LINES
|
15
|
-
line 1
|
16
|
-
line 2
|
17
|
-
line 3
|
18
|
-
line 4
|
19
|
-
line 5
|
20
|
-
END_OF_LINES
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:gitignore) do
|
24
|
-
<<~END_OF_LINES
|
25
|
-
.bsp/
|
26
|
-
project/
|
27
|
-
target/
|
28
|
-
*.gz
|
29
|
-
*.sublime*
|
30
|
-
*.swp
|
31
|
-
*.out
|
32
|
-
*.Identifier
|
33
|
-
*.log
|
34
|
-
.idea*
|
35
|
-
*.iml
|
36
|
-
*.tmp
|
37
|
-
*~
|
38
|
-
~*
|
39
|
-
.DS_Store
|
40
|
-
.idea
|
41
|
-
.jekyll-cache/
|
42
|
-
.jekyll-metadata
|
43
|
-
.makeAwsBucketAndDistribution.log
|
44
|
-
.sass-cache/
|
45
|
-
.yardoc/
|
46
|
-
__pycache__/
|
47
|
-
__MACOSX
|
48
|
-
_build/
|
49
|
-
_package/
|
50
|
-
_site/
|
51
|
-
bin/*.class
|
52
|
-
doc/
|
53
|
-
jekyll/doc/
|
54
|
-
node_modules/
|
55
|
-
Notepad++/
|
56
|
-
out/
|
57
|
-
package/
|
58
|
-
instances.json
|
59
|
-
rescue_ubuntu2010
|
60
|
-
rescue_ubuntu2010.b64
|
61
|
-
landingPageShortName.md
|
62
|
-
test.html
|
63
|
-
RUNNING_PID
|
64
|
-
mslinn_jekyll_plugins.zip
|
65
|
-
cloud9.tar
|
66
|
-
cloud9.zip
|
67
|
-
mslinn_aws.tar
|
68
|
-
END_OF_LINES
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'verifies from' do
|
72
|
-
expect(from(lines, '3')).to eq("line 3\nline 4\nline 5\n")
|
73
|
-
expect(from(gitignore, 'PID')).to eq("RUNNING_PID\nmslinn_jekyll_plugins.zip\ncloud9.tar\ncloud9.zip\nmslinn_aws.tar\n")
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'verifies to' do
|
77
|
-
expect(to(lines, '3')).to eq("line 1\nline 2\nline 3\n")
|
78
|
-
expect(to(gitignore, 'idea')).to eq(".bsp/\nproject/\ntarget/\n*.gz\n*.sublime*\n*.swp\n*.out\n*.Identifier\n*.log\n.idea*\n")
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'verifies until' do
|
82
|
-
# until is a Ruby keyword
|
83
|
-
expect(method(:until).call(lines, '3')).to eq("line 1\nline 2\n")
|
84
|
-
expect(method(:until).call(gitignore, 'idea')).to eq(".bsp/\nproject/\ntarget/\n*.gz\n*.sublime*\n*.swp\n*.out\n*.Identifier\n*.log\n")
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'verifies from regex' do
|
88
|
-
expect(from(gitignore, '^(cloud|sun)')).to eq("cloud9.tar\ncloud9.zip\nmslinn_aws.tar\n")
|
89
|
-
end
|
90
|
-
end
|