jekyll_all_collections 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e34cd7f0b53f1aaed58a4ca679749c7f994d39674e5d28b93670de7eb1dfdc18
4
+ data.tar.gz: 165017e7f22556651106c18526155b5ac36efbc23e18d1c12c9af47b57a9a3b7
5
+ SHA512:
6
+ metadata.gz: 795682f6119d6ccba25ad2d11e92ddfed6f54bfcdcb9cf95fd48bf9240a44db18af334e79650c0220ce5e40d5790bb98b0c33f78102259a1d43ff2bd232d4483
7
+ data.tar.gz: 5ed14e1c82ea41769abb3192704db70aa842aac6d171a910b883309fcebe6f1b45324a0a98e4832c7fa4fd9fe751d1fa9baff2976788b42f0cc7ead77167cf8a
data/.rubocop.yml ADDED
@@ -0,0 +1,35 @@
1
+ # require: rubocop-jekyll
2
+ # inherit_gem:
3
+ # rubocop-jekyll: .rubocop.yml
4
+
5
+ AllCops:
6
+ Exclude:
7
+ - vendor/**/*
8
+ - Gemfile*
9
+ - '*.gemspec' # This does nothing. Why?
10
+ NewCops: enable
11
+ TargetRubyVersion: 2.6
12
+
13
+ # Gemspec/RequireMFA:
14
+ # Enabled: false
15
+
16
+ # Jekyll/NoPutsAllowed:
17
+ # Enabled: false
18
+
19
+ Layout/HashAlignment:
20
+ EnforcedHashRocketStyle: table
21
+
22
+ Layout/LineLength:
23
+ Max: 150
24
+
25
+ Metrics/BlockLength:
26
+ Max: 50
27
+
28
+ Metrics/MethodLength:
29
+ Max: 40
30
+
31
+ Metrics/ModuleLength:
32
+ Enabled: false
33
+
34
+ Style/StringLiterals:
35
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## 0.1.1 / 2022-04-27
2
+ * Changed invocation from a `:site` hook to an idempotent method invocation.
3
+
4
+ ## 0.1.0 / 2022-04-26
5
+ * Initial version published
data/LICENSE.txt ADDED
@@ -0,0 +1,121 @@
1
+ Creative Commons Legal Code
2
+
3
+ CC0 1.0 Universal
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
+ HEREUNDER.
13
+
14
+ Statement of Purpose
15
+
16
+ The laws of most jurisdictions throughout the world automatically confer
17
+ exclusive Copyright and Related Rights (defined below) upon the creator
18
+ and subsequent owner(s) (each and all, an "owner") of an original work of
19
+ authorship and/or a database (each, a "Work").
20
+
21
+ Certain owners wish to permanently relinquish those rights to a Work for
22
+ the purpose of contributing to a commons of creative, cultural and
23
+ scientific works ("Commons") that the public can reliably and without fear
24
+ of later claims of infringement build upon, modify, incorporate in other
25
+ works, reuse and redistribute as freely as possible in any form whatsoever
26
+ and for any purposes, including without limitation commercial purposes.
27
+ These owners may contribute to the Commons to promote the ideal of a free
28
+ culture and the further production of creative, cultural and scientific
29
+ works, or to gain reputation or greater distribution for their Work in
30
+ part through the use and efforts of others.
31
+
32
+ For these and/or other purposes and motivations, and without any
33
+ expectation of additional consideration or compensation, the person
34
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
+ is an owner of Copyright and Related Rights in the Work, voluntarily
36
+ elects to apply CC0 to the Work and publicly distribute the Work under its
37
+ terms, with knowledge of his or her Copyright and Related Rights in the
38
+ Work and the meaning and intended legal effect of CC0 on those rights.
39
+
40
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
41
+ protected by copyright and related or neighboring rights ("Copyright and
42
+ Related Rights"). Copyright and Related Rights include, but are not
43
+ limited to, the following:
44
+
45
+ i. the right to reproduce, adapt, distribute, perform, display,
46
+ communicate, and translate a Work;
47
+ ii. moral rights retained by the original author(s) and/or performer(s);
48
+ iii. publicity and privacy rights pertaining to a person's image or
49
+ likeness depicted in a Work;
50
+ iv. rights protecting against unfair competition in regards to a Work,
51
+ subject to the limitations in paragraph 4(a), below;
52
+ v. rights protecting the extraction, dissemination, use and reuse of data
53
+ in a Work;
54
+ vi. database rights (such as those arising under Directive 96/9/EC of the
55
+ European Parliament and of the Council of 11 March 1996 on the legal
56
+ protection of databases, and under any national implementation
57
+ thereof, including any amended or successor version of such
58
+ directive); and
59
+ vii. other similar, equivalent or corresponding rights throughout the
60
+ world based on applicable law or treaty, and any national
61
+ implementations thereof.
62
+
63
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
64
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
65
+ irrevocably and unconditionally waives, abandons, and surrenders all of
66
+ Affirmer's Copyright and Related Rights and associated claims and causes
67
+ of action, whether now known or unknown (including existing as well as
68
+ future claims and causes of action), in the Work (i) in all territories
69
+ worldwide, (ii) for the maximum duration provided by applicable law or
70
+ treaty (including future time extensions), (iii) in any current or future
71
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
72
+ including without limitation commercial, advertising or promotional
73
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
+ member of the public at large and to the detriment of Affirmer's heirs and
75
+ successors, fully intending that such Waiver shall not be subject to
76
+ revocation, rescission, cancellation, termination, or any other legal or
77
+ equitable action to disrupt the quiet enjoyment of the Work by the public
78
+ as contemplated by Affirmer's express Statement of Purpose.
79
+
80
+ 3. Public License Fallback. Should any part of the Waiver for any reason
81
+ be judged legally invalid or ineffective under applicable law, then the
82
+ Waiver shall be preserved to the maximum extent permitted taking into
83
+ account Affirmer's express Statement of Purpose. In addition, to the
84
+ extent the Waiver is so judged Affirmer hereby grants to each affected
85
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
86
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
87
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
+ maximum duration provided by applicable law or treaty (including future
89
+ time extensions), (iii) in any current or future medium and for any number
90
+ of copies, and (iv) for any purpose whatsoever, including without
91
+ limitation commercial, advertising or promotional purposes (the
92
+ "License"). The License shall be deemed effective as of the date CC0 was
93
+ applied by Affirmer to the Work. Should any part of the License for any
94
+ reason be judged legally invalid or ineffective under applicable law, such
95
+ partial invalidity or ineffectiveness shall not invalidate the remainder
96
+ of the License, and in such case Affirmer hereby affirms that he or she
97
+ will not (i) exercise any of his or her remaining Copyright and Related
98
+ Rights in the Work or (ii) assert any associated claims and causes of
99
+ action with respect to the Work, in either case contrary to Affirmer's
100
+ express Statement of Purpose.
101
+
102
+ 4. Limitations and Disclaimers.
103
+
104
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
+ surrendered, licensed or otherwise affected by this document.
106
+ b. Affirmer offers the Work as-is and makes no representations or
107
+ warranties of any kind concerning the Work, express, implied,
108
+ statutory or otherwise, including without limitation warranties of
109
+ title, merchantability, fitness for a particular purpose, non
110
+ infringement, or the absence of latent or other defects, accuracy, or
111
+ the present or absence of errors, whether or not discoverable, all to
112
+ the greatest extent permissible under applicable law.
113
+ c. Affirmer disclaims responsibility for clearing rights of other persons
114
+ that may apply to the Work or any use thereof, including without
115
+ limitation any person's Copyright and Related Rights in the Work.
116
+ Further, Affirmer disclaims responsibility for obtaining any necessary
117
+ consents, permissions or other rights required for any use of the
118
+ Work.
119
+ d. Affirmer understands and acknowledges that Creative Commons is not a
120
+ party to this document and has no duty or obligation with respect to
121
+ this CC0 or use of the Work.
data/README.md ADDED
@@ -0,0 +1,106 @@
1
+ `jekyll_all_collections`
2
+ [![Gem Version](https://badge.fury.io/rb/jekyll_all_collections.svg)](https://badge.fury.io/rb/jekyll_all_collections)
3
+ ===========
4
+
5
+ `jekyll_all_collections` is a Jekyll plugin that add a new property called `all_collections` to `site`.
6
+
7
+
8
+
9
+ ## Debugging
10
+ Run `bin/attach` and pass it the directory name of a Jekyll website that has a suitable script called `_bin/debug`.
11
+ The `demo` subdirectory fits this description.
12
+ ```script
13
+ $ bin/attach demo
14
+ Successfully uninstalled jekyll_all_collections-0.1.2
15
+ jekyll_all_collections 0.1.2 built to pkg/jekyll_all_collections-0.1.2.gem.
16
+ jekyll_all_collections (0.1.2) installed.
17
+ Fast Debugger (ruby-debug-ide 0.7.3, debase 0.2.4.1, file filtering is supported) listens on 0.0.0.0:1234
18
+ ```
19
+ Now attach to the debugger process.
20
+ This git repo includes a Visual Studio Code launcher for this purpose labeled `Attach rdebug-ide`.
21
+
22
+
23
+ ## Additional Information
24
+ More information is available on Mike Slinn's web site about
25
+ [Jekyll plugins](https://www.mslinn.com/blog/index.html#Jekyll).
26
+
27
+
28
+ ## Installation
29
+ This has already been done for the demo; these instructions are for incorporating the plugin(s) into other Jekyll websites.
30
+ Add this line to your application's Gemfile:
31
+
32
+ ```ruby
33
+ group :jekyll_plugins do
34
+ gem 'jekyll_all_collections'
35
+ end
36
+ ```
37
+
38
+ And then execute:
39
+
40
+ $ bundle install
41
+
42
+ Or install it yourself as:
43
+
44
+ $ gem install jekyll_all_collections
45
+
46
+
47
+ ## Development
48
+
49
+ After checking out the repo, run `bin/setup` to install dependencies.
50
+
51
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
52
+
53
+
54
+ ### Build and Install Locally
55
+ To build and install this gem onto your local machine, run:
56
+ ```shell
57
+ $ rake install:local
58
+ ```
59
+
60
+ The following also does the same thing:
61
+ ```shell
62
+ $ bundle exec rake install
63
+ jekyll_all_collections 0.1.0 built to pkg/jekyll_all_collections-0.1.0.gem.
64
+ jekyll_all_collections (0.1.0) installed.
65
+ ```
66
+
67
+ Examine the newly built gem:
68
+ ```shell
69
+ $ gem info jekyll_all_collections
70
+
71
+ *** LOCAL GEMS ***
72
+
73
+ jekyll_all_collections (0.1.0)
74
+ Author: Firstname Lastname
75
+ Homepage:
76
+ https://github.com/username/jekyll_all_collections
77
+ License: MIT
78
+ Installed at: /home/mslinn/.gems
79
+
80
+ Write a short summary; RubyGems requires one.
81
+ ```
82
+
83
+
84
+ ### Build and Push to RubyGems
85
+ To release a new version,
86
+ 1. Update the version number in `version.rb`.
87
+ 2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
88
+ 3. Run the following:
89
+ ```shell
90
+ $ bundle exec rake release
91
+ ```
92
+ The above creates a git tag for the version, commits the created tag,
93
+ and pushes the new `.gem` file to [RubyGems.org](https://rubygems.org).
94
+
95
+
96
+ ## Contributing
97
+
98
+ 1. Fork the project
99
+ 2. Create a descriptively named feature branch
100
+ 3. Add your feature
101
+ 4. Submit a pull request
102
+
103
+
104
+ ## License
105
+
106
+ 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,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task :default => :spec
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/jekyll_all_collections/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ github = "https://github.com/mslinn/jekyll_all_collections"
7
+
8
+ spec.authors = ["Mike Slinn"]
9
+ spec.bindir = "bin"
10
+ spec.description = <<~END_OF_DESC
11
+ Provides a collection of all collections in site.all_collections.
12
+ END_OF_DESC
13
+ spec.email = ["email@email.com"]
14
+ spec.executables = []
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ spec.files = Dir[".rubocop.yml", "LICENSE.*", "Rakefile", "{lib,spec}/**/*", "*.gemspec", "*.md"]
18
+
19
+ spec.homepage = "https://www.mslinn.com/blog/2020/12/30/jekyll-plugin-template-collection.html"
20
+ spec.license = "MIT"
21
+ spec.metadata = {
22
+ "allowed_push_host" => "https://rubygems.org",
23
+ "bug_tracker_uri" => "#{github}/issues",
24
+ "changelog_uri" => "#{github}/CHANGELOG.md",
25
+ "homepage_uri" => spec.homepage,
26
+ "source_code_uri" => github,
27
+ }
28
+ spec.name = "jekyll_all_collections"
29
+ spec.require_paths = ["lib"]
30
+ spec.required_ruby_version = ">= 2.6.0"
31
+ spec.summary = "Provides a collection of all collections in site.all_collections."
32
+ spec.version = JekyllAllCollectionsVersion::VERSION
33
+
34
+ spec.add_dependency "jekyll", ">= 3.5.0"
35
+ spec.add_dependency "jekyll_plugin_logger"
36
+
37
+ spec.add_development_dependency "debase"
38
+ spec.add_development_dependency "ruby-debug-ide"
39
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module JekyllAllCollectionsVersion
4
+ VERSION = "0.1.1"
5
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require "jekyll_plugin_logger"
5
+ require_relative "jekyll_all_collections/version"
6
+
7
+ # Creates a property called site.all_collections if it does not already exist
8
+ module JekyllAllCollections
9
+ @logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
10
+
11
+ def maybe_compute_all_collections(site)
12
+ @logger.debug { "JekyllAllCollections.maybe_compute_all_collections invoked" }
13
+ return if site.class.method_defined? :all_collections
14
+
15
+ @logger.debug { "JekyllAllCollections.maybe_compute_all_collections creating site.all_collections" }
16
+
17
+ site.class.module_eval { attr_accessor :all_collections }
18
+ site.all_collections =
19
+ site.collections
20
+ .values
21
+ .map { |x| x.class.method_defined?(:docs) ? x.docs : x }
22
+ .flatten
23
+ end
24
+
25
+ module_function :maybe_compute_all_collections
26
+
27
+ PluginMetaLogger.instance.logger.info { "Loaded JekyllAllCollections v#{JekyllAllCollectionsVersion::VERSION} plugin." }
28
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require_relative "../lib/jekyll_all_collections"
5
+
6
+ RSpec.describe(JekyllAllCollections) do
7
+ it "does nothing" do
8
+ # expect(remainder_of_line).to eq("remainder of line")
9
+ end
10
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require "fileutils"
5
+ require "key_value_parser"
6
+ require "shellwords"
7
+
8
+ require_relative "../lib/jekyll_all_collections"
9
+
10
+ Jekyll.logger.log_level = :info
11
+
12
+ RSpec.configure do |config|
13
+ config.filter_run :focus
14
+ config.order = "random"
15
+ config.run_all_when_everything_filtered = true
16
+
17
+ # See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
18
+ config.example_status_persistence_file_path = "spec/status_persistence.txt"
19
+ end
@@ -0,0 +1,5 @@
1
+ example_id | status | run_time |
2
+ ------------------------------------------ | ------ | --------------- |
3
+ ./spec/jekyll_all_collections_spec.rb[1:1] | passed | 0.02165 seconds |
4
+ ./spec/run_this_first_spec.rb[1:1] | failed | 0.00134 seconds |
5
+ ./spec/run_this_first_spec.rb[1:2] | failed | 2.84 seconds |
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll_all_collections
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Mike Slinn
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.5.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: jekyll_plugin_logger
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: debase
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: ruby-debug-ide
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
+ description: 'Provides a collection of all collections in site.all_collections.
70
+
71
+ '
72
+ email:
73
+ - email@email.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".rubocop.yml"
79
+ - CHANGELOG.md
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - jekyll_all_collections.gemspec
84
+ - lib/jekyll_all_collections.rb
85
+ - lib/jekyll_all_collections/version.rb
86
+ - spec/jekyll_all_collections_spec.rb
87
+ - spec/spec_helper.rb
88
+ - spec/status_persistence.txt
89
+ homepage: https://www.mslinn.com/blog/2020/12/30/jekyll-plugin-template-collection.html
90
+ licenses:
91
+ - MIT
92
+ metadata:
93
+ allowed_push_host: https://rubygems.org
94
+ bug_tracker_uri: https://github.com/mslinn/jekyll_all_collections/issues
95
+ changelog_uri: https://github.com/mslinn/jekyll_all_collections/CHANGELOG.md
96
+ homepage_uri: https://www.mslinn.com/blog/2020/12/30/jekyll-plugin-template-collection.html
97
+ source_code_uri: https://github.com/mslinn/jekyll_all_collections
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 2.6.0
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubygems_version: 3.1.4
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Provides a collection of all collections in site.all_collections.
117
+ test_files: []