jekyll-netlify-redirects 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 50df178ecc7f98bf0b7a4a78bdf89b90b1c2b56ad7450ac4f5bb09e55fa6416d
4
+ data.tar.gz: 4e7a4130c56a512966bfb9565613fc8dd9aa1971e12abab55c0d363254e9f9a4
5
+ SHA512:
6
+ metadata.gz: 9a224a4e4142cc0175af1c20b30395b17a0a53c76fe00637971b0ee9d5c1e67a7ccf8b75f1e749ffb667a432faab124a50d67607f02375e40d2d6bcae582385e
7
+ data.tar.gz: 6f6333c35cb1ac090d441f05df5fa9d851641cce336c257612eaa463cb2e5c0311551daedacef417b1cb8226999a739c060baaf356f6a5b41b7ad06fae5dd2c4
@@ -0,0 +1,14 @@
1
+ # EditorConfig is awesome: http://EditorConfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+ indent_size = 2
9
+ indent_style = space
10
+ trim_trailing_whitespace = true
11
+
12
+ [*.md]
13
+ indent_size = 4
14
+ indent_style = tab
@@ -0,0 +1,28 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Documentation cache and generated files:
14
+ /.yardoc/
15
+ /_yardoc/
16
+ /doc/
17
+ /rdoc/
18
+
19
+ # Environment normalization:
20
+ /.bundle/
21
+ /vendor/bundle
22
+ /lib/bundler/man/
23
+
24
+ # for a library or gem, you might want to ignore these files since the code is
25
+ # intended to run in multiple environments; otherwise, check them in:
26
+ Gemfile.lock
27
+ # .ruby-version
28
+ # .ruby-gemset
@@ -0,0 +1,3 @@
1
+ --display-style-guide
2
+ --extra-details
3
+ --parallel
@@ -0,0 +1,8 @@
1
+ Metrics/LineLength:
2
+ Enabled: false
3
+
4
+ Style/Documentation:
5
+ Enabled: false
6
+
7
+ Style/FrozenStringLiteralComment:
8
+ Enabled: false
@@ -0,0 +1 @@
1
+ 2.5.1
@@ -0,0 +1,50 @@
1
+ # Contributing to jekyll-netlify-redirects
2
+
3
+ I'd love to have your help improving jekyll-netlify-redirects! If you'd like to pitch in, you can do so in a number of ways:
4
+
5
+ 1. Look through open [Issues](https://github.com/jgarber623/jekyll-netlify-redirects/issues).
6
+ 1. Review any open [Pull Requests](https://github.com/jgarber623/jekyll-netlify-redirects/pulls).
7
+ 1. [Fork jekyll-netlify-redirects](#get-set-up-to-contribute) and fix an open Issue or add your own feature.
8
+ 1. File new Issues if you have a good idea or see a bug and don't know how to fix it yourself. _Only do this after you've made sure the behavior or problem you're seeing isn't already documented in an open Issue._
9
+
10
+ I definitely appreciate your interest in (and help improving) jekyll-netlify-redirects. Thanks!
11
+
12
+ ## Installation
13
+
14
+ jekyll-netlify-redirects is written in [Ruby](https://www.ruby-lang.org) (version 2.5.1) and development dependencies are managed using the [Bundler](https://bundler.io) gem.
15
+
16
+ I manage Ruby versions with [rbenv](https://github.com/rbenv/rbenv). I'd recommend you do the same or use a similar Ruby version manager ([chruby](https://github.com/postmodern/chruby) or [RVM](https://rvm.io) come to mind). Once you've installed Ruby 2.5.1 using your method of choice, install the project's gems by running:
17
+
18
+ ```sh
19
+ bundle install
20
+ ```
21
+
22
+ …from the root of the project.
23
+
24
+ ## Get set up to contribute
25
+
26
+ Contributing to jekyll-netlify-redirects is pretty straightforward:
27
+
28
+ 1. Fork the jekyll-netlify-redirects repo and clone it.
29
+ 1. Install development dependencies as outlined [above](#installation).
30
+ 1. Create a feature branch for the issue or new feature you're looking to tackle: `git checkout -b your-descriptive-branch-name`.
31
+ 1. _Write some code!_
32
+ 1. Build (`bin/rake build`) and install (`bin/rake install`) your updated code.
33
+ 1. Commit your changes: `git commit -am 'Add some new feature or fix some issue'`.
34
+ 1. Push the branch to your fork of jekyll-netlify-redirects: `git push origin your-descriptive-branch-name`.
35
+ 1. Create a new Pull Request and I'll give it a look!
36
+
37
+ ## Code Style
38
+
39
+ Code styles are like opinions: Everyone's got one and yours is better than mine. Here's how jekyll-netlify-redirects should be written:
40
+
41
+ - Use two-space indentation in Ruby.
42
+ - No trailing whitespace and blank lines should have whitespace removed.
43
+ - Prefer single quotes over double quotes unless interpolating.
44
+ - Follow the conventions you see in the existing source code as best as you can.
45
+
46
+ jekyll-netlify-redirects's formatting guidelines are defined in the `.editorconfig` file which uses the [EditorConfig](http://editorconfig.org) syntax. There are [a number of great plugins for a variety of editors](http://editorconfig.org/#download) that utilize the settings in the `.editorconfig` file. EditorConfig takes the hassle out of syntax-specific formatting.
47
+
48
+ Additionally, [Rubocop](https://github.com/bbatsov/rubocop) can be used to help identify possible trouble areas in your code. Run `bin/rubocop` to generate Rubocop's static code analysis report.
49
+
50
+ Your bug fix or feature addition won't be rejected if it runs afoul of any (or all) of these guidelines, but following the guidelines will definitely make everyone's lives a little easier.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jekyll-netlify-redirects.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Jason Garber
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.
@@ -0,0 +1,66 @@
1
+ # jekyll-netlify-redirects
2
+
3
+ **A Ruby gem for generating a Netlify redirects configuration from a Jekyll configuration.**
4
+
5
+ [![Gem](https://img.shields.io/gem/v/jekyll-netlify-redirects.svg?style=for-the-badge)](https://rubygems.org/gems/jekyll-netlify-redirects)
6
+ [![Downloads](https://img.shields.io/gem/dt/jekyll-netlify-redirects.svg?style=for-the-badge)](https://rubygems.org/gems/jekyll-netlify-redirects)
7
+
8
+ ## Getting Started
9
+
10
+ Before installing and using jekyll-netlify-redirects, you'll want to familiarize yourself with [Jekyll](https://jekyllrb.com) (a fabulous static site generator written in [Ruby](https://www.ruby-lang.org)) and [Netlify](https://www.netlify.com) (a fabulous website hosting service). In particular, you'll want to read up on Netlify's [Redirect & Rewrite Rules documentation](https://www.netlify.com/docs/redirects/).
11
+
12
+ ## Installation
13
+
14
+ If you're using [Bundler](https://bundler.io), add jekyll-netlify-redirects to your project's `Gemfile`:
15
+
16
+ ```rb
17
+ source 'https://rubygems.org'
18
+
19
+ group :jekyll_plugins do
20
+ gem 'jekyll-netlify-redirects'
21
+ end
22
+ ```
23
+
24
+ …and hop over to your command prompt and run…
25
+
26
+ ```sh
27
+ $ bundle install
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ With jekyll-netlify-redirects added to your project's `Gemfile` and installed, add the following to your [Jekyll configuration file](https://jekyllrb.com/docs/configuration/) (typically `_config.yml`):
33
+
34
+ ```yaml
35
+ netlify:
36
+ redirects:
37
+ - /home /
38
+ - /blog/my-post.php /blog/my-post
39
+ - /news /blog
40
+ - /google https://www.google.com
41
+ ```
42
+
43
+ **Note:** Netlify supports a variety of redirection and rewrite rules, so comb through their [Redirect & Rewrite Rules documentation](https://www.netlify.com/docs/redirects/) for more on the syntax. You may also want to test your redirect and rewrite rules at [Netlify's Playground](https://play.netlify.com/redirects).
44
+
45
+ With this configuration added to `_config.yml` (or to your custom Jekyll configuration file), Jekyll will generate a properly-formatted `_redirects` file in the destination directory when building your project.
46
+
47
+ ## Improving jekyll-netlify-redirects
48
+
49
+ Want to help make jekyll-netlify-redirects better? Hell yeah! I like your enthusiasm. For more on how you can help, check out [CONTRIBUTING.md](https://github.com/jgarber623/jekyll-netlify-redirects/blob/master/CONTRIBUTING.md).
50
+
51
+ ### Donations
52
+
53
+ If diving into Ruby isn't your thing, but you'd still like to support jekyll-netlify-redirects, consider making a donation! Any amount—large or small—is greatly appreciated. As a token of my gratitude, I'll add your name to the [Acknowledgments](#acknowledgments) below.
54
+
55
+ [![Donate via Square Cash](https://img.shields.io/badge/square%20cash-$jgarber-28c101.svg?style=for-the-badge)](https://cash.me/$jgarber)
56
+ [![Donate via Paypal](https://img.shields.io/badge/paypal-jgarber-009cde.svg?style=for-the-badge)](https://www.paypal.me/jgarber)
57
+
58
+ ## Acknowledgments
59
+
60
+ jekyll-netlify-redirects wouldn't exist without the hard work of all the folks involved in designing, building, and maintaining Jekyll and Netlify. High fives, y'all. 🙌🏻
61
+
62
+ jekyll-netlify-redirects is written and maintained by [Jason Garber](https://sixtwothree.org).
63
+
64
+ ## License
65
+
66
+ jekyll-netlify-redirects is freely available under the [MIT License](https://opensource.org/licenses/MIT). Use it, learn from it, fork it, improve it, change it, tailor it to your needs.
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,28 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'jekyll/netlify/redirects/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.required_ruby_version = ['>= 2.4.0', '< 2.6']
8
+
9
+ spec.name = 'jekyll-netlify-redirects'
10
+ spec.version = Jekyll::Netlify::Redirects::VERSION
11
+ spec.authors = ['Jason Garber']
12
+ spec.email = ['jason@sixtwothree.org']
13
+
14
+ spec.summary = 'Generate a Netlify redirects configuration from a Jekyll configuration.'
15
+ spec.description = spec.summary
16
+ spec.homepage = 'https://github.com/jgarber623/jekyll-netlify-redirects'
17
+ spec.license = 'MIT'
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|spec)/}) }
20
+
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.16', '>= 1.16.2'
24
+ spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.1'
25
+ spec.add_development_dependency 'rubocop', '~> 0.57.2'
26
+
27
+ spec.add_runtime_dependency 'jekyll', '~> 3.8', '>= 3.8.3'
28
+ end
@@ -0,0 +1,2 @@
1
+ require 'jekyll/netlify/redirects/version'
2
+ require 'jekyll/netlify/redirects/generator'
@@ -0,0 +1,23 @@
1
+ require 'jekyll'
2
+
3
+ module Jekyll
4
+ module Netlify
5
+ module Redirects
6
+ class Generator < Jekyll::Generator
7
+ safe true
8
+ priority :low
9
+
10
+ def generate(site)
11
+ redirects = site.config['netlify'] && site.config['netlify']['redirects']
12
+
13
+ raise 'No Netlify redirects found in Jekyll configuration file(s)!' unless redirects
14
+
15
+ page = PageWithoutAFile.new(site, __dir__, '', '_redirects')
16
+ page.content = redirects.join("\n")
17
+
18
+ site.pages << page
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ module Jekyll
2
+ module Netlify
3
+ module Redirects
4
+ VERSION = '0.1.0'.freeze
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-netlify-redirects
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jason Garber
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-06-20 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: '1.16'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.16.2
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.16'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.16.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '12.3'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 12.3.1
43
+ type: :development
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '12.3'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 12.3.1
53
+ - !ruby/object:Gem::Dependency
54
+ name: rubocop
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 0.57.2
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: 0.57.2
67
+ - !ruby/object:Gem::Dependency
68
+ name: jekyll
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '3.8'
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 3.8.3
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.8'
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 3.8.3
87
+ description: Generate a Netlify redirects configuration from a Jekyll configuration.
88
+ email:
89
+ - jason@sixtwothree.org
90
+ executables: []
91
+ extensions: []
92
+ extra_rdoc_files: []
93
+ files:
94
+ - ".editorconfig"
95
+ - ".gitignore"
96
+ - ".rubocop"
97
+ - ".rubocop.yml"
98
+ - ".ruby-version"
99
+ - CONTRIBUTING.md
100
+ - Gemfile
101
+ - LICENSE
102
+ - README.md
103
+ - Rakefile
104
+ - jekyll-netlify-redirects.gemspec
105
+ - lib/jekyll/netlify/redirects.rb
106
+ - lib/jekyll/netlify/redirects/generator.rb
107
+ - lib/jekyll/netlify/redirects/version.rb
108
+ homepage: https://github.com/jgarber623/jekyll-netlify-redirects
109
+ licenses:
110
+ - MIT
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 2.4.0
121
+ - - "<"
122
+ - !ruby/object:Gem::Version
123
+ version: '2.6'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ requirements: []
130
+ rubyforge_project:
131
+ rubygems_version: 2.7.6
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: Generate a Netlify redirects configuration from a Jekyll configuration.
135
+ test_files: []