bridgetown-sitemap 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4d18b78fd58f13369c0d31a8724d4f21c75e808633ce7d6b57e33096c01bc84
4
- data.tar.gz: 4d36151297d1fcd9f6e346fba34429e980fc679bb7bf6b9f9238f23a6d361d3c
3
+ metadata.gz: a214c1c4828f21552166aaf52882263e89c2fc60ff77eddb0dbf68de80cc0ef2
4
+ data.tar.gz: fd9ec9a4678f59564a8955e0a06307b7722d744bdab00dd570094bd93cf4b82f
5
5
  SHA512:
6
- metadata.gz: 2cf2fcc93b4f2ed10d6ee42d5fb2f3aa0f238116678563a0be1923ba3588d9f09502cc486684a314fb9305ef566f1b56e5c52589340b1067f877181ed28a3d33
7
- data.tar.gz: 161b5344a25c2dc540652da65bae69d285cdda829570213408461926f17d876aad6e50fae9d6e9173c3222bc23a7336e3f9302f4acebd99d2b23cc6bc9aac5eb
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
@@ -1,5 +1,10 @@
1
1
  # main
2
2
 
3
+ # 1.1.2 / 18-02-2022
4
+
5
+ * Handle cases where the site is not in a git repo
6
+ * Fix an error when the resource has a modified date but not a time
7
+
3
8
  # 1.1.1 / 11-06-2021
4
9
 
5
10
  * Fix an error when building a site with uncommitted files.
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Bridgetown Sitemap Generator Plugin
2
2
 
3
- **_Bridgetown plugin to silently generate a sitemaps.org compliant sitemap for your Bridgetown site_**
3
+ [![Tests](https://github.com/ayushn21/bridgetown-sitemap/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/ayushn21/bridgetown-sitemap/actions/workflows/tests.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/bridgetown-sitemap.svg)](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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgetownSitemap
4
- VERSION = "1.1.1"
4
+ VERSION = "1.1.2"
5
5
  end
@@ -0,0 +1,5 @@
1
+ ---
2
+ date: 2022-02-18
3
+ ---
4
+
5
+ The 18th of February!
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>2019-07-14T18:22:00\+00:00</lastmod>!, @sitemap
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 17, @sitemap.scan(%r!(?=<url>)!).count
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.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: 2021-06-11 00:00:00.000000000 Z
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.4
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