bridgetown-sitemap 1.1.1 → 1.1.2
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/.github/workflows/tests.yml +30 -0
- data/CHANGELOG.md +5 -0
- data/README.md +11 -2
- data/lib/bridgetown/resource/base.rb +7 -1
- data/lib/bridgetown-sitemap/version.rb +1 -1
- data/test/fixtures/src/_posts/2022-02-18-feb-the-eighteenth.md +5 -0
- data/test/helper.rb +1 -1
- data/test/test_sitemap.rb +7 -2
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a214c1c4828f21552166aaf52882263e89c2fc60ff77eddb0dbf68de80cc0ef2
|
|
4
|
+
data.tar.gz: fd9ec9a4678f59564a8955e0a06307b7722d744bdab00dd570094bd93cf4b82f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f90353391f700cd3568967b84939aca4ba481dd61c876247bc1f506d987f22f2213d9d6192f7bee56b43f02500218cc9783feb7ca6d9cc38b434b7e3994e99f4
|
|
7
|
+
data.tar.gz: a701b188efd9fa488c75f54218cd4d8307cfbbce3d42aebad518d2dceaea6523fd61375b9e2606ffac4062fbfdf9058b60dfe24e49e03c5694cf8de585a4eba9
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- "*"
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
ruby_version: [2.6.6, 2.7.3, 3.0.1]
|
|
17
|
+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
|
18
|
+
# Has to be top level to cache properly
|
|
19
|
+
env:
|
|
20
|
+
BUNDLE_JOBS: 3
|
|
21
|
+
BUNDLE_PATH: "vendor/bundle"
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@master
|
|
24
|
+
- name: Setup Ruby
|
|
25
|
+
uses: ruby/setup-ruby@v1
|
|
26
|
+
with:
|
|
27
|
+
ruby-version: ${{ matrix.ruby_version }}
|
|
28
|
+
bundler-cache: true
|
|
29
|
+
- name: Test with Rake
|
|
30
|
+
run: script/cibuild
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Bridgetown Sitemap Generator Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/ayushn21/bridgetown-sitemap/actions/workflows/tests.yml)
|
|
4
|
+
[](https://badge.fury.io/rb/bridgetown-sitemap)
|
|
5
|
+
|
|
6
|
+
Bridgetown plugin to silently generate a sitemaps.org compliant sitemap for your Bridgetown site
|
|
4
7
|
|
|
5
8
|
## Usage
|
|
6
9
|
|
|
@@ -66,4 +69,10 @@ defaults:
|
|
|
66
69
|
3. Create your feature branch (`git checkout -b my-new-feature`)
|
|
67
70
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
|
68
71
|
5. Push to the branch (`git push origin my-new-feature`)
|
|
69
|
-
6. Create a new Pull Request
|
|
72
|
+
6. Create a new Pull Request
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
Bridgetown Sitemap is released under the [MIT License](https://opensource.org/licenses/MIT).
|
|
77
|
+
|
|
78
|
+
Copyright © 2021 [Ayush Newatia](https://twitter.com/ayushn21)
|
|
@@ -4,15 +4,21 @@ module Bridgetown
|
|
|
4
4
|
module Resource
|
|
5
5
|
class Base
|
|
6
6
|
def sitemap_last_modified_at
|
|
7
|
-
data.last_modified_at || latest_git_commit_date || date
|
|
7
|
+
(data.last_modified_at || latest_git_commit_date || date)&.to_time
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
private
|
|
11
11
|
|
|
12
12
|
def latest_git_commit_date
|
|
13
|
+
return nil unless git_repo?
|
|
14
|
+
|
|
13
15
|
date = `git log -1 --pretty="format:%cI" "#{path}"`
|
|
14
16
|
Time.parse(date) if date.present?
|
|
15
17
|
end
|
|
18
|
+
|
|
19
|
+
def git_repo?
|
|
20
|
+
system "git status", out: File::NULL, err: File::NULL
|
|
21
|
+
end
|
|
16
22
|
end
|
|
17
23
|
end
|
|
18
24
|
end
|
data/test/helper.rb
CHANGED
|
@@ -14,7 +14,7 @@ Minitest::Reporters.use! [
|
|
|
14
14
|
]
|
|
15
15
|
|
|
16
16
|
class BridgetownSitemap::Test < Minitest::Test
|
|
17
|
-
ROOT_DIR = File.expand_path("fixtures", __dir__)
|
|
17
|
+
ROOT_DIR = File.expand_path("fixtures", __dir__)
|
|
18
18
|
SOURCE_DIR = File.join(ROOT_DIR, "src")
|
|
19
19
|
DEST_DIR = File.expand_path("dest", __dir__)
|
|
20
20
|
|
data/test/test_sitemap.rb
CHANGED
|
@@ -46,7 +46,12 @@ class TestSitemap < BridgetownSitemap::Test
|
|
|
46
46
|
assert_match %r!<lastmod>2021-05-06T00:00:00(-|\+)\d+:\d+</lastmod>!, @sitemap
|
|
47
47
|
assert_match %r!<lastmod>2021-03-04T00:00:00(-|\+)\d+:\d+</lastmod>!, @sitemap
|
|
48
48
|
assert_match %r!<lastmod>2021-03-02T00:00:00(-|\+)\d+:\d+</lastmod>!, @sitemap
|
|
49
|
-
assert_match %r!<lastmod>
|
|
49
|
+
assert_match %r!<lastmod>2022-02-18T00:00:00(-|\+)\d+:\d+</lastmod>!, @sitemap
|
|
50
|
+
|
|
51
|
+
# This doesn't work on CI because it runs a git command which isn't allowed I guess
|
|
52
|
+
unless ENV["GITHUB_ACTIONS"]
|
|
53
|
+
assert_match %r!<lastmod>2019-07-14T18:22:00\+00:00</lastmod>!, @sitemap
|
|
54
|
+
end
|
|
50
55
|
end
|
|
51
56
|
|
|
52
57
|
should "puts all the static HTML files in the sitemap.xml file" do
|
|
@@ -93,7 +98,7 @@ class TestSitemap < BridgetownSitemap::Test
|
|
|
93
98
|
end
|
|
94
99
|
|
|
95
100
|
should "include the correct number of items" do
|
|
96
|
-
assert_equal
|
|
101
|
+
assert_equal 18, @sitemap.scan(%r!(?=<url>)!).count
|
|
97
102
|
end
|
|
98
103
|
|
|
99
104
|
should "include generated pages" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bridgetown-sitemap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ayush Newatia
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-02-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bridgetown
|
|
@@ -78,6 +78,7 @@ executables: []
|
|
|
78
78
|
extensions: []
|
|
79
79
|
extra_rdoc_files: []
|
|
80
80
|
files:
|
|
81
|
+
- ".github/workflows/tests.yml"
|
|
81
82
|
- ".gitignore"
|
|
82
83
|
- ".rubocop.yml"
|
|
83
84
|
- CHANGELOG.md
|
|
@@ -110,6 +111,7 @@ files:
|
|
|
110
111
|
- test/fixtures/src/_posts/2021-03-02-march-the-second.md
|
|
111
112
|
- test/fixtures/src/_posts/2021-03-04-march-the-fourth.md
|
|
112
113
|
- test/fixtures/src/_posts/2021-05-06-may-the-sixth.md
|
|
114
|
+
- test/fixtures/src/_posts/2022-02-18-feb-the-eighteenth.md
|
|
113
115
|
- test/fixtures/src/about.html
|
|
114
116
|
- test/fixtures/src/assets/sample_image.jpg
|
|
115
117
|
- test/fixtures/src/assets/sample_pdf.pdf
|
|
@@ -146,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
146
148
|
- !ruby/object:Gem::Version
|
|
147
149
|
version: '0'
|
|
148
150
|
requirements: []
|
|
149
|
-
rubygems_version: 3.1.
|
|
151
|
+
rubygems_version: 3.1.6
|
|
150
152
|
signing_key:
|
|
151
153
|
specification_version: 4
|
|
152
154
|
summary: Automatically generate a sitemap.xml for your Bridgetown site.
|
|
@@ -165,6 +167,7 @@ test_files:
|
|
|
165
167
|
- test/fixtures/src/_posts/2021-03-02-march-the-second.md
|
|
166
168
|
- test/fixtures/src/_posts/2021-03-04-march-the-fourth.md
|
|
167
169
|
- test/fixtures/src/_posts/2021-05-06-may-the-sixth.md
|
|
170
|
+
- test/fixtures/src/_posts/2022-02-18-feb-the-eighteenth.md
|
|
168
171
|
- test/fixtures/src/about.html
|
|
169
172
|
- test/fixtures/src/assets/sample_image.jpg
|
|
170
173
|
- test/fixtures/src/assets/sample_pdf.pdf
|