jekyll-pre-commit 0.2.1 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dce7e91d65ca281e50108205b57b036bea686231
4
- data.tar.gz: b043f4fa3a65ee9e742fbcfc810de61cdd06c8d7
3
+ metadata.gz: 4f4f3db30d40cd9cf23c3bbc314def54359f3e87
4
+ data.tar.gz: e5415dd6ac9e548ccb2aad6ddd66d21f9c27b8c0
5
5
  SHA512:
6
- metadata.gz: 2de2a293d7cca27ab1f382581c190eb85c881b3f936122bb374b7a5f466f696020916d8ffe9a0f5ab6fe775f08eac06626d69f3b3992c579d8574d4085ce53bd
7
- data.tar.gz: 5f13d172dac25c2195237761cb520d0576b7f3441d56cd594ac9ab06a7e120092c19d17022418c4a693f186906afa6a0cf96a14657077acb7d7439cec443c4b4
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.
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module PreCommit
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  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.2.1
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: 2017-07-25 00:00:00.000000000 Z
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.4.5.1
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