jekyll_draft 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +94 -3
- data/CHANGELOG.md +3 -0
- data/Rakefile +3 -5
- data/lib/jekyll_draft/version.rb +1 -1
- data/lib/jekyll_draft.rb +8 -7
- data/spec/jekyll/draft_spec.rb +11 -0
- data/spec/status_persistence.txt +4 -3
- metadata +4 -4
- data/spec/jekyll_draft_spec.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 508d8293b65652e57262601a7de1aacebfe7b29e1eeb492b9fefaed87f377794
|
4
|
+
data.tar.gz: cf23341ecad96d666b5e5f14e44ca83b6cef430ae8c07321294539b096cc644a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b15902c8ed65cd8fd43434a5640ad6cce272cb797ef61c47a5f768a95c3dd86768f17f513ed97dcd82dd93917e09088432fbd1976f6a89490740ae4bb2abf25c
|
7
|
+
data.tar.gz: efeca601d5941f016d1ec0046e6e9001c32b3bf9ab518cd92872eea8647cccbf87804aa389ef98f3bb1d0b49e64317a6f2698a692768074b3c98373140ef3a24
|
data/.rubocop.yml
CHANGED
@@ -1,15 +1,106 @@
|
|
1
|
+
require:
|
2
|
+
# - rubocop-jekyll
|
3
|
+
- rubocop-md
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rake
|
6
|
+
- rubocop-rspec
|
7
|
+
|
8
|
+
# inherit_gem:
|
9
|
+
# rubocop-jekyll: .rubocop.yml
|
10
|
+
|
1
11
|
AllCops:
|
2
12
|
Exclude:
|
3
|
-
|
4
|
-
|
13
|
+
- demo/_site/**/*
|
14
|
+
- exe/**/*
|
15
|
+
- vendor/**/*
|
16
|
+
- Gemfile*
|
5
17
|
NewCops: enable
|
6
18
|
TargetRubyVersion: 2.6
|
7
19
|
|
8
|
-
|
20
|
+
Gemspec/DeprecatedAttributeAssignment:
|
9
21
|
Enabled: false
|
10
22
|
|
23
|
+
Gemspec/RequireMFA:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Layout/HashAlignment:
|
27
|
+
EnforcedColonStyle: table
|
28
|
+
Exclude:
|
29
|
+
- jekyll_draft.gemspec
|
30
|
+
|
31
|
+
Layout/InitialIndentation:
|
32
|
+
Exclude:
|
33
|
+
- README.md
|
34
|
+
|
11
35
|
Layout/LineLength:
|
12
36
|
Max: 150
|
13
37
|
|
38
|
+
Layout/MultilineMethodCallIndentation:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Lint/RedundantCopDisableDirective:
|
42
|
+
Exclude:
|
43
|
+
- jekyll_draft.gemspec
|
44
|
+
|
45
|
+
Metrics/AbcSize:
|
46
|
+
Max: 45
|
47
|
+
|
48
|
+
Metrics/BlockLength:
|
49
|
+
Exclude:
|
50
|
+
- jekyll_draft.gemspec
|
51
|
+
- spec/**/*
|
52
|
+
|
53
|
+
Metrics/ClassLength:
|
54
|
+
Exclude:
|
55
|
+
- spec/**/*
|
56
|
+
Max: 40
|
57
|
+
|
58
|
+
Metrics/CyclomaticComplexity:
|
59
|
+
Max: 20
|
60
|
+
|
61
|
+
Metrics/MethodLength:
|
62
|
+
Max: 40
|
63
|
+
|
64
|
+
Metrics/PerceivedComplexity:
|
65
|
+
Max: 15
|
66
|
+
|
67
|
+
Naming/FileName:
|
68
|
+
Exclude:
|
69
|
+
- Rakefile
|
70
|
+
|
71
|
+
RSpec/ExampleLength:
|
72
|
+
Max: 20
|
73
|
+
|
74
|
+
RSpec/MultipleExpectations:
|
75
|
+
Max: 15
|
76
|
+
|
77
|
+
Style/CommandLiteral:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
Style/CommentedKeyword:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
Style/Documentation:
|
84
|
+
Enabled: false
|
85
|
+
|
14
86
|
Style/FrozenStringLiteralComment:
|
15
87
|
Enabled: false
|
88
|
+
|
89
|
+
Style/PercentLiteralDelimiters:
|
90
|
+
Enabled: false
|
91
|
+
|
92
|
+
Style/RegexpLiteral:
|
93
|
+
Enabled: false
|
94
|
+
|
95
|
+
Style/StringConcatenation:
|
96
|
+
Exclude:
|
97
|
+
- spec/**/*
|
98
|
+
|
99
|
+
Style/StringLiterals:
|
100
|
+
Enabled: false
|
101
|
+
|
102
|
+
Style/StringLiteralsInInterpolation:
|
103
|
+
Enabled: false
|
104
|
+
|
105
|
+
Style/TrailingCommaInHashLiteral:
|
106
|
+
EnforcedStyleForMultiline: comma
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
data/lib/jekyll_draft/version.rb
CHANGED
data/lib/jekyll_draft.rb
CHANGED
@@ -16,7 +16,7 @@ module Jekyll
|
|
16
16
|
return is_unpublished(doc) if published_was_specified(doc)
|
17
17
|
|
18
18
|
# Try Jekyll's naming convention to determine draft status
|
19
|
-
return doc.data['draft'] if doc.respond_to?(
|
19
|
+
return doc.data['draft'] if doc.respond_to?(:data) && doc.data.key?('draft')
|
20
20
|
return doc.draft if doc.respond_to?(:draft)
|
21
21
|
|
22
22
|
false
|
@@ -44,23 +44,24 @@ module Jekyll
|
|
44
44
|
# Non-standard name used so this method could be invoked from Liquid
|
45
45
|
# @return true if published was specified in a document's front matter, and the value is false
|
46
46
|
def published_was_specified(doc)
|
47
|
-
return true if doc.respond_to?(
|
47
|
+
return true if doc.respond_to?(:published)
|
48
48
|
|
49
|
-
return false unless doc.respond_to?(
|
49
|
+
return false unless doc.respond_to?(:data)
|
50
50
|
|
51
51
|
return true if doc.data.key?('published')
|
52
52
|
|
53
53
|
false
|
54
54
|
end
|
55
55
|
|
56
|
-
# Non-standard name used so this method could be invoked from Liquid
|
56
|
+
# Non-standard name used so this method could be invoked from Liquid.
|
57
|
+
# Looks in data before checking for property.
|
57
58
|
# @return true if published was specified in a document's front matter, and the value is false
|
58
59
|
def is_unpublished(doc) # rubocop:disable Naming/PredicateName
|
59
|
-
return !doc.published if doc.respond_to?('published')
|
60
|
+
return !doc.data['published'] if doc.respond_to?(:data) && doc.data.key?('published')
|
60
61
|
|
61
|
-
return !doc
|
62
|
+
return !doc.published if doc.respond_to?(:published)
|
62
63
|
|
63
|
-
return !doc
|
64
|
+
return !doc['published'] if doc.key?('published')
|
64
65
|
|
65
66
|
false
|
66
67
|
end
|
data/spec/status_persistence.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
example_id
|
2
|
-
|
3
|
-
./spec/
|
1
|
+
example_id | status | run_time |
|
2
|
+
------------------------------------ | ------ | --------------- |
|
3
|
+
./spec/basename_dirname_spec.rb[1:1] | passed | 0.00214 seconds |
|
4
|
+
./spec/basename_dirname_spec.rb[1:2] | passed | 0.0002 seconds |
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_draft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.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: 2023-02-
|
11
|
+
date: 2023-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -55,7 +55,7 @@ files:
|
|
55
55
|
- jekyll_draft.gemspec
|
56
56
|
- lib/jekyll_draft.rb
|
57
57
|
- lib/jekyll_draft/version.rb
|
58
|
-
- spec/
|
58
|
+
- spec/jekyll/draft_spec.rb
|
59
59
|
- spec/spec_helper.rb
|
60
60
|
- spec/status_persistence.txt
|
61
61
|
homepage: https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#basename
|
@@ -90,7 +90,7 @@ signing_key:
|
|
90
90
|
specification_version: 4
|
91
91
|
summary: This Jekyll filter detects draft documents.
|
92
92
|
test_files:
|
93
|
-
- spec/
|
93
|
+
- spec/jekyll/draft_spec.rb
|
94
94
|
- spec/spec_helper.rb
|
95
95
|
- spec/status_persistence.txt
|
96
96
|
...
|
data/spec/jekyll_draft_spec.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'jekyll'
|
2
|
-
require 'jekyll_plugin_logger'
|
3
|
-
require_relative '../lib/jekyll_draft'
|
4
|
-
|
5
|
-
RSpec.describe(Jekyll::Draft) do # rubocop:disable Metrics/BlockLength
|
6
|
-
include Jekyll::Draft
|
7
|
-
|
8
|
-
let(:page_draft) do
|
9
|
-
page_ = double('Jekyll::Page')
|
10
|
-
allow(page_).to receive(:draft) { true }
|
11
|
-
page_
|
12
|
-
end
|
13
|
-
let(:page_not_draft) do
|
14
|
-
page_ = double('Jekyll::Page')
|
15
|
-
allow(page_).to receive(:draft) { false }
|
16
|
-
page_
|
17
|
-
end
|
18
|
-
let(:page_published) do
|
19
|
-
page_ = double('Jekyll::Page')
|
20
|
-
allow(page_).to receive(:published) { true }
|
21
|
-
page_
|
22
|
-
end
|
23
|
-
let(:page_not_published) do
|
24
|
-
page_ = double('Jekyll::Page')
|
25
|
-
allow(page_).to receive(:published) { false }
|
26
|
-
page_
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'detects drafts' do
|
30
|
-
expect(draft?(page_draft)).to be_truthy
|
31
|
-
expect(draft?(page_not_draft)).to be_falsey
|
32
|
-
expect(draft?(page_published)).to be_falsey
|
33
|
-
expect(draft?(page_not_published)).to be_truthy
|
34
|
-
end
|
35
|
-
end
|