jekyll-truthyfalsy 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/Gemfile +10 -0
- data/LICENSE +22 -0
- data/README.md +8 -2
- data/Rakefile +4 -0
- data/jekyll-truthyfalsy.gemspec +37 -0
- data/lib/jekyll-truthyfalsy/version.rb +5 -0
- data/lib/{jekyll/filters/truthyfalsy.rb → jekyll-truthyfalsy.rb} +4 -2
- data/spec/jekyll-truthyfalsy_spec.rb +54 -0
- metadata +53 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18c8a4f46fc5fb38b342d4397c15f69fcbffda7c93e07510ceedd398b297ffd4
|
4
|
+
data.tar.gz: 6d358291c9f05de551756ec8a2aaecd4f5839bcef21fe0b479bb9b3b07a80d1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 422f80f7cadd2e72343de2eb1db3d3c9b8412ab2fa44f83eb929558b96fbef81d8b623df8ae547a9902c681692ab9cb65e7a97a97023c552fe6ae3a7f513f27c
|
7
|
+
data.tar.gz: d7131b7e0704ce8094f192527804c2d3cb80af7a3517571d8ee0877d9d9cf12930f59198f1269e7711cf0610b965e3ae19e35d83a9944376d86ae10f8488d640
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 ITW Creative Works
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
CHANGED
@@ -44,12 +44,12 @@ Because life is too short for ambiguity, embrace the certainty that comes with `
|
|
44
44
|
|
45
45
|
Install the gem and add to the application's Gemfile by executing:
|
46
46
|
```shell
|
47
|
-
|
47
|
+
bundle add jekyll-truthyfalsy
|
48
48
|
```
|
49
49
|
|
50
50
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
51
51
|
```shell
|
52
|
-
|
52
|
+
gem install jekyll-truthyfalsy
|
53
53
|
```
|
54
54
|
|
55
55
|
## Usage
|
@@ -79,6 +79,12 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
|
|
79
79
|
|
80
80
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
81
81
|
|
82
|
+
### Building and pushing
|
83
|
+
```shell
|
84
|
+
gem build jekyll-truthyfalsy.gemspec
|
85
|
+
gem push jekyll-istruthyfalsy-1.0.0.gem
|
86
|
+
```
|
87
|
+
|
82
88
|
## Contributing
|
83
89
|
|
84
90
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-truthyfalsy.
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll-truthyfalsy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
# Gem info
|
8
|
+
spec.name = "jekyll-truthyfalsy"
|
9
|
+
spec.version = Jekyll::TruthyFalsy::VERSION
|
10
|
+
|
11
|
+
# Author info
|
12
|
+
spec.authors = ["ITW Creative Works"]
|
13
|
+
spec.email = ["hello@itwcreativeworks.com"]
|
14
|
+
|
15
|
+
# Gem details
|
16
|
+
spec.summary = "A Jekyll plugin that adds JavaScript-like truthy and falsy checks"
|
17
|
+
spec.description = "A simple Jekyll plugin that adds JavaScript-like istruthy and isfalsy filters to Liquid"
|
18
|
+
spec.homepage = "https://github.com/itw-creative-works/jekyll-truthyfalsy"
|
19
|
+
spec.license = "MIT"
|
20
|
+
|
21
|
+
# Files
|
22
|
+
spec.files = Dir["CODE_OF_CONDUCT.md", "README*.md", "LICENSE", "Rakefile", "*.gemspec", "Gemfile", "lib/**/*", "spec/**/*"]
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
# Gem requires Jekyll to work
|
28
|
+
spec.add_runtime_dependency "jekyll", ">= 3.0", "< 5.0"
|
29
|
+
|
30
|
+
# Development requires more
|
31
|
+
spec.add_development_dependency "bundler"
|
32
|
+
spec.add_development_dependency "rake"
|
33
|
+
spec.add_development_dependency "rspec"
|
34
|
+
|
35
|
+
# Ruby version
|
36
|
+
spec.required_ruby_version = ">= 2.0.0"
|
37
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
require "jekyll"
|
2
|
+
|
1
3
|
module Jekyll
|
2
|
-
module
|
4
|
+
module TruthyFalsy
|
3
5
|
def istruthy(input)
|
4
6
|
!(input.nil? || input == '' || input == false)
|
5
7
|
end
|
@@ -10,4 +12,4 @@ module Jekyll
|
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
13
|
-
Liquid::Template.register_filter(Jekyll::
|
15
|
+
Liquid::Template.register_filter(Jekyll::TruthyFalsy)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'jekyll-truthyfalsy'
|
2
|
+
|
3
|
+
RSpec.describe Jekyll::TruthyFalsy do
|
4
|
+
# Dummy class to include the filter methods
|
5
|
+
class DummyClass
|
6
|
+
include Jekyll::TruthyFalsy
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:dummy) { DummyClass.new }
|
10
|
+
|
11
|
+
describe '.istruthy' do
|
12
|
+
it 'returns true for non-empty string' do
|
13
|
+
expect(dummy.istruthy('hello')).to be(true)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns false for empty string' do
|
17
|
+
expect(dummy.istruthy('')).to be(false)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'returns true for true boolean' do
|
21
|
+
expect(dummy.istruthy(true)).to be(true)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns false for false boolean' do
|
25
|
+
expect(dummy.istruthy(false)).to be(false)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'returns false for nil' do
|
29
|
+
expect(dummy.istruthy(nil)).to be(false)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.isfalsy' do
|
34
|
+
it 'returns false for non-empty string' do
|
35
|
+
expect(dummy.isfalsy('hello')).to be(false)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'returns true for empty string' do
|
39
|
+
expect(dummy.isfalsy('')).to be(true)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns false for true boolean' do
|
43
|
+
expect(dummy.isfalsy(true)).to be(false)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns true for false boolean' do
|
47
|
+
expect(dummy.isfalsy(false)).to be(true)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'returns true for nil' do
|
51
|
+
expect(dummy.isfalsy(nil)).to be(true)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-truthyfalsy
|
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
|
- ITW Creative Works
|
@@ -30,6 +30,48 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '5.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
33
75
|
description: A simple Jekyll plugin that adds JavaScript-like istruthy and isfalsy
|
34
76
|
filters to Liquid
|
35
77
|
email:
|
@@ -38,8 +80,14 @@ executables: []
|
|
38
80
|
extensions: []
|
39
81
|
extra_rdoc_files: []
|
40
82
|
files:
|
83
|
+
- Gemfile
|
84
|
+
- LICENSE
|
41
85
|
- README.md
|
42
|
-
-
|
86
|
+
- Rakefile
|
87
|
+
- jekyll-truthyfalsy.gemspec
|
88
|
+
- lib/jekyll-truthyfalsy.rb
|
89
|
+
- lib/jekyll-truthyfalsy/version.rb
|
90
|
+
- spec/jekyll-truthyfalsy_spec.rb
|
43
91
|
homepage: https://github.com/itw-creative-works/jekyll-truthyfalsy
|
44
92
|
licenses:
|
45
93
|
- MIT
|
@@ -52,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
100
|
requirements:
|
53
101
|
- - ">="
|
54
102
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.
|
103
|
+
version: 2.0.0
|
56
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
105
|
requirements:
|
58
106
|
- - ">="
|
@@ -63,4 +111,5 @@ rubygems_version: 3.2.3
|
|
63
111
|
signing_key:
|
64
112
|
specification_version: 4
|
65
113
|
summary: A Jekyll plugin that adds JavaScript-like truthy and falsy checks
|
66
|
-
test_files:
|
114
|
+
test_files:
|
115
|
+
- spec/jekyll-truthyfalsy_spec.rb
|