jekyll_basename_dirname 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 455811bf056657fa622e9e13187a9cf8f7beaf7919375d1942dea1619bfa2e38
4
+ data.tar.gz: 68998518b65ea687220e21c30269f8c28acabeb0481944a9b690e3da0526260b
5
+ SHA512:
6
+ metadata.gz: 4c04f3873e3d7978074a816d2704683a01fe61b452dadb631058e8e3cb9a035c4e101d245018d35aafe2e9ce883bacf30d5427281753cc5e1faffab21d3e92ec
7
+ data.tar.gz: 3efff20f1cf8fa13fd1bfed4011301c18c2a78cb5782cec635ffc6c54053057beeee125a3c91c6a63a55b61a52bca5613279572de094b6727ec07e0e47eca2f5
data/.rubocop.yml ADDED
@@ -0,0 +1,31 @@
1
+ require: rubocop-jekyll
2
+ inherit_gem:
3
+ rubocop-jekyll: .rubocop.yml
4
+
5
+ AllCops:
6
+ Exclude:
7
+ - vendor/**/*
8
+ - Gemfile*
9
+ NewCops: enable
10
+ TargetRubyVersion: 2.6
11
+
12
+ Layout/LineLength:
13
+ Max: 150
14
+
15
+ Layout/MultilineMethodCallIndentation:
16
+ Enabled: false
17
+
18
+ Metrics/BlockLength:
19
+ Enabled: false
20
+
21
+ Style/PercentLiteralDelimiters:
22
+ Enabled: false
23
+
24
+ Style/RegexpLiteral:
25
+ Enabled: false
26
+
27
+ Style/StringLiterals:
28
+ Enabled: false
29
+
30
+ Style/StringLiteralsInInterpolation:
31
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ ## 1.0.1 / 2022-03-11
2
+ * Corrected dumb error
3
+ ## 1.0.0 / 2022-03-11
4
+ * Made into a Ruby gem and published on RubyGems.org as [jekyll_basename_dirname](https://rubygems.org/gems/jekyll_basename_dirname).
5
+ * `bin/attach` script added for debugging
6
+ * Rubocop standards added
7
+ * Proper versioning and CHANGELOG.md added
8
+
9
+ ## 0.1.0 / 2020-12-29
10
+ * Initial version published
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in jekyll_basename_dirname.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll_basename_dirname (1.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ coderay (1.1.3)
11
+ diff-lcs (1.5.0)
12
+ method_source (1.0.0)
13
+ parallel (1.21.0)
14
+ parser (3.1.1.0)
15
+ ast (~> 2.4.1)
16
+ pry (0.14.1)
17
+ coderay (~> 1.1)
18
+ method_source (~> 1.0)
19
+ rainbow (3.1.1)
20
+ rake (13.0.6)
21
+ regexp_parser (2.2.1)
22
+ rexml (3.2.5)
23
+ rspec (3.11.0)
24
+ rspec-core (~> 3.11.0)
25
+ rspec-expectations (~> 3.11.0)
26
+ rspec-mocks (~> 3.11.0)
27
+ rspec-core (3.11.0)
28
+ rspec-support (~> 3.11.0)
29
+ rspec-expectations (3.11.0)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.11.0)
32
+ rspec-mocks (3.11.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.11.0)
35
+ rspec-support (3.11.0)
36
+ rubocop (1.18.4)
37
+ parallel (~> 1.10)
38
+ parser (>= 3.0.0.0)
39
+ rainbow (>= 2.2.2, < 4.0)
40
+ regexp_parser (>= 1.8, < 3.0)
41
+ rexml
42
+ rubocop-ast (>= 1.8.0, < 2.0)
43
+ ruby-progressbar (~> 1.7)
44
+ unicode-display_width (>= 1.4.0, < 3.0)
45
+ rubocop-ast (1.16.0)
46
+ parser (>= 3.1.1.0)
47
+ rubocop-jekyll (0.12.0)
48
+ rubocop (~> 1.18.0)
49
+ rubocop-performance (~> 1.2)
50
+ rubocop-performance (1.13.3)
51
+ rubocop (>= 1.7.0, < 2.0)
52
+ rubocop-ast (>= 0.4.0)
53
+ ruby-progressbar (1.11.0)
54
+ unicode-display_width (2.1.0)
55
+
56
+ PLATFORMS
57
+ x86_64-linux
58
+
59
+ DEPENDENCIES
60
+ bundler
61
+ jekyll_basename_dirname!
62
+ pry
63
+ rake (~> 13.0)
64
+ rspec
65
+ rubocop
66
+ rubocop-jekyll
67
+
68
+ BUNDLED WITH
69
+ 2.3.7
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Mike Slinn
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # JekyllBasenameDirname
2
+
3
+ This is a Jekyll plugin that provides two Liquid filters: `basename` and `dirname`. They work like the similarly named bash commands.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your Jekyll website's `Gemfile`, within the `jekyll_plugins` group:
9
+
10
+ ```ruby
11
+ group :jekyll_plugins do
12
+ gem 'jekyll_basename_dirname'
13
+ end
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle install
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install jekyll_basename_dirname
23
+
24
+
25
+ ## Usage
26
+
27
+ ## Basename
28
+ Filters a string containing a path and returns the filename extracted from the path, including the filetype.
29
+
30
+ Example: Extracts "filename.ext" from the path:
31
+ ```
32
+ {{ "blah/blah/filename.ext" | basename }}
33
+ ```
34
+
35
+ ## Dirname
36
+
37
+ Filters a string containing a path and returns the portion of th path before the filename and extension.
38
+ Example: Extracts "blah/blah" from the path.
39
+ ```
40
+ {{ "blah/blah/filename.ext" | dirname }}
41
+ ```
42
+
43
+
44
+ ## Development
45
+
46
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
+
48
+ 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).
49
+
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mslinn/jekyll_basename_dirname.
54
+
55
+
56
+ ## License
57
+
58
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/jekyll_basename_dirname/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "jekyll_basename_dirname"
7
+ spec.version = JekyllBasenameDirname::VERSION
8
+ spec.authors = ["Mike Slinn"]
9
+ spec.email = ["mslinn@mslinn.com"]
10
+
11
+ spec.summary = "Jekyll plugin that provides two Liquid filters: basename and dirname."
12
+ spec.description = "Jekyll plugin that provides two Liquid filters: basename and dirname. They work like the similarly named bash commands."
13
+ spec.homepage = "https://github.com/mslinn/jekyll_basename_dirname"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/mslinn/jekyll_basename_dirname"
21
+ spec.metadata["changelog_uri"] = "https://github.com/mslinn/jekyll_basename_dirname/CHANGELOG.md"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_development_dependency 'bundler'
35
+ spec.add_development_dependency 'pry'
36
+ spec.add_development_dependency 'rake'
37
+ spec.add_development_dependency 'rspec'
38
+ spec.add_development_dependency 'rubocop'
39
+ spec.add_development_dependency 'rubocop-jekyll'
40
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module JekyllBasenameDirname
4
+ VERSION = "1.0.1"
5
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "jekyll_basename_dirname/version"
4
+
5
+ # @author Copyright 2020 Michael Slinn
6
+ # @license SPDX-License-Identifier: Apache-2.0
7
+ #
8
+ # Jekyll filters for working with paths.
9
+ module JekyllBasenameDirname
10
+ class Error < StandardError; end
11
+
12
+ # Filters a string containing a path.
13
+ # @return [String] the filename extracted from the path, including the filetype.
14
+ # @example Extracts "filename.ext" from the path
15
+ # {{ "blah/blah/filename.ext" | basename }}
16
+ def basename(filepath)
17
+ File.basename(filepath)
18
+ end
19
+
20
+ # Filters a string containing a path.
21
+ # @return [String] the portion of th path before the filename and extension.
22
+ # @example Extracts "blah/blah" from the path.
23
+ # {{ "blah/blah/filename.ext" | dirname }}
24
+ def dirname(filepath)
25
+ File.dirname(filepath)
26
+ end
27
+
28
+ # Filters a string containing a path.
29
+ # @return the filename without the extension.
30
+ # @example Extracts "filename" from the path.
31
+ # {{ "blah/blah/filename.ext" | basename_without_extension }}
32
+ def basename_without_extension(filepath)
33
+ File.basename(filepath).split('.')[0...-1].join('.')
34
+ end
35
+ end
36
+
37
+ Liquid::Template.register_filter(JekyllBasenameDirname)
@@ -0,0 +1,4 @@
1
+ module JekyllBasenameDirname
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll_basename_dirname
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mike Slinn
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-jekyll
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: 'Jekyll plugin that provides two Liquid filters: basename and dirname.
98
+ They work like the similarly named bash commands.'
99
+ email:
100
+ - mslinn@mslinn.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".rubocop.yml"
106
+ - CHANGELOG.md
107
+ - Gemfile
108
+ - Gemfile.lock
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - jekyll_basename_dirname.gemspec
113
+ - lib/jekyll_basename_dirname.rb
114
+ - lib/jekyll_basename_dirname/version.rb
115
+ - sig/jekyll_basename_dirname.rbs
116
+ homepage: https://github.com/mslinn/jekyll_basename_dirname
117
+ licenses:
118
+ - MIT
119
+ metadata:
120
+ allowed_push_host: https://rubygems.org/
121
+ homepage_uri: https://github.com/mslinn/jekyll_basename_dirname
122
+ source_code_uri: https://github.com/mslinn/jekyll_basename_dirname
123
+ changelog_uri: https://github.com/mslinn/jekyll_basename_dirname/CHANGELOG.md
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 2.6.0
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubygems_version: 3.2.5
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: 'Jekyll plugin that provides two Liquid filters: basename and dirname.'
143
+ test_files: []