jekyll-pre-commit 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/jekyll-pre-commit.rb +1 -0
- data/lib/jekyll-pre-commit/checks/no_todos.rb +18 -0
- data/lib/jekyll-pre-commit/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f4f3db30d40cd9cf23c3bbc314def54359f3e87
|
4
|
+
data.tar.gz: e5415dd6ac9e548ccb2aad6ddd66d21f9c27b8c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecd3cd9d201390b564056828afd1095ed5dd102b3c30e5e0823dce375bb4ca9bd3dad914eabb90811b17756bf6caede1d954aba993e9d4edf447552f0cacc21a
|
7
|
+
data.tar.gz: 731583822f3ca9883617c9a3136ca05f88f26870579e98f3594991e305da8444ea82eefd6d54c2d01c5d468add747c83f603bb66339f7d0d2ae21a89df142fad
|
data/README.md
CHANGED
@@ -39,6 +39,8 @@ pre-commit:
|
|
39
39
|
- check: NoDuplicateTags
|
40
40
|
```
|
41
41
|
|
42
|
+
**NOTE:** Depending on your configuration, you may need use `bundle exec git commit` to ensure Ruby libraries are properly loaded to run the pre-commit checks.
|
43
|
+
|
42
44
|
## Available Checks
|
43
45
|
|
44
46
|
#### FrontMatterVariableExists
|
@@ -81,6 +83,10 @@ In the above, there would be a maximum length of 50 characters for the title (ra
|
|
81
83
|
|
82
84
|
Checks that you have not accidentally introduced a duplicate tag. For example, if you have posts that are already using "MySQL" as a tag and you attempt to commit a post with the tag "mysql" (notice the difference in case-sensitivity) you will not be allowed to commit.
|
83
85
|
|
86
|
+
#### NoTodos
|
87
|
+
|
88
|
+
This check ensures that you haven't left and "todos" in your post. It does so by doing a case-insensitive check against the entire post content for the string "todo".
|
89
|
+
|
84
90
|
## Roll Your Own
|
85
91
|
|
86
92
|
You can also add your own checks. To do so, create a class in the `Jekyll::PreCommit::Checks` module and and define a `check` method. Your class should extend the `Jekyll::PreCommit::Checks::Check` class and return the `@result` instance variable.
|
data/lib/jekyll-pre-commit.rb
CHANGED
@@ -11,3 +11,4 @@ require 'jekyll-pre-commit/checks/front_matter_variable_exists.rb'
|
|
11
11
|
require 'jekyll-pre-commit/checks/front_matter_variable_is_not_duplicate.rb'
|
12
12
|
require 'jekyll-pre-commit/checks/front_matter_variable_meets_length_requirements.rb'
|
13
13
|
require 'jekyll-pre-commit/checks/no_duplicate_tags.rb'
|
14
|
+
require 'jekyll-pre-commit/checks/no_todos.rb'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module PreCommit
|
3
|
+
module Checks
|
4
|
+
class NoTodos < Check
|
5
|
+
def check(staged, not_staged, site, args)
|
6
|
+
staged.each do |post|
|
7
|
+
if post.to_s.downcase.include? 'todo'
|
8
|
+
@result[:ok] = false
|
9
|
+
@result[:message] += "A todo was found in #{post.data["title"]}. "
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
@result
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-pre-commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Chadwick
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/jekyll-pre-commit/checks/front_matter_variable_is_not_duplicate.rb
|
90
90
|
- lib/jekyll-pre-commit/checks/front_matter_variable_meets_length_requirements.rb
|
91
91
|
- lib/jekyll-pre-commit/checks/no_duplicate_tags.rb
|
92
|
+
- lib/jekyll-pre-commit/checks/no_todos.rb
|
92
93
|
- lib/jekyll-pre-commit/checks/spell_check.rb
|
93
94
|
- lib/jekyll-pre-commit/commands.rb
|
94
95
|
- lib/jekyll-pre-commit/pre-commit
|
@@ -115,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
116
|
version: '0'
|
116
117
|
requirements: []
|
117
118
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
119
|
+
rubygems_version: 2.5.2.3
|
119
120
|
signing_key:
|
120
121
|
specification_version: 4
|
121
122
|
summary: A Jekyll plugin to make sure your post is _really_ ready for publishing
|