bridgetown-sitemap 1.1.1 → 1.2.0

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: f7fdbaa3c96e9fc71d97de9a13f7828a2d3aa6cc45c1a396b8157cc3281b3231
4
+ data.tar.gz: ee8c8d4adc46245e9ed35ab05b4450c319c0fc0c0a9d475a0114c5ef02557296
5
5
  SHA512:
6
- metadata.gz: 2cf2fcc93b4f2ed10d6ee42d5fb2f3aa0f238116678563a0be1923ba3588d9f09502cc486684a314fb9305ef566f1b56e5c52589340b1067f877181ed28a3d33
7
- data.tar.gz: 161b5344a25c2dc540652da65bae69d285cdda829570213408461926f17d876aad6e50fae9d6e9173c3222bc23a7336e3f9302f4acebd99d2b23cc6bc9aac5eb
6
+ metadata.gz: f3667fc1df4b0e1d8f6e7ddfd404272c56ae996cc7d638a5d2390e9a233849e2a342aae11f7724691b81f3843e9afda18c32c04e5d9ee80c276b1d2529fe2e79
7
+ data.tar.gz: f4bf13d4337464aa9455b645971e277d4952c5c4554b8dbf7b9aced457b504842299c79af5ec70d063205192d378ce5f16f3e0ba9f804953f657b1b95eb9c59a
@@ -0,0 +1,32 @@
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.7.7, 3.0.5, 3.1.3, 3.2.0]
17
+ bridgetown_version: [1.0.0, 1.1.0]
18
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
19
+ # Has to be top level to cache properly
20
+ env:
21
+ BUNDLE_JOBS: 3
22
+ BUNDLE_PATH: "vendor/bundle"
23
+ BRIDGETOWN_VERSION: ${{ matrix.bridgetown_version }}
24
+ steps:
25
+ - uses: actions/checkout@master
26
+ - name: Setup Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby_version }}
30
+ bundler-cache: true
31
+ - name: Test with Rake
32
+ run: script/cibuild
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # main
2
2
 
3
+ # 1.2.0 / 23-01-2023
4
+
5
+ * Require Bridgetown 1.0 or newer.
6
+ * Require Ruby 2.7 or newer.
7
+
8
+ # 1.1.2 / 18-02-2022
9
+
10
+ * Handle cases where the site is not in a git repo
11
+ * Fix an error when the resource has a modified date but not a time
12
+
3
13
  # 1.1.1 / 11-06-2021
4
14
 
5
15
  * 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)
@@ -16,11 +16,11 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.required_ruby_version = ">= 2.5.0"
19
+ spec.required_ruby_version = ">= 2.7.0"
20
20
 
21
- spec.add_dependency "bridgetown", ">= 0.20", "< 2.0"
21
+ spec.add_dependency "bridgetown", ">= 1.0", "< 2.0"
22
22
 
23
23
  spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rubocop-bridgetown", "~> 0.2"
25
+ spec.add_development_dependency "rubocop-bridgetown"
26
26
  end
@@ -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.2.0"
5
5
  end
@@ -1,4 +1,4 @@
1
- class GeneratedPagesBuilder < SiteBuilder
1
+ class Builders::GeneratedPages < SiteBuilder
2
2
  def build
3
3
  generator do
4
4
  generated_page = Bridgetown::GeneratedPage.new(site, site.source, "/", "generated_page.erb")
@@ -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,11 @@ 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
+
50
+ # This doesn't work on CI because it runs a git command which isn't allowed I guess
51
+ unless ENV["GITHUB_ACTIONS"]
52
+ assert_match %r!<lastmod>2019-07-14T18:22:00\+00:00</lastmod>!, @sitemap
53
+ end
50
54
  end
51
55
 
52
56
  should "puts all the static HTML files in the sitemap.xml file" do
@@ -93,7 +97,7 @@ class TestSitemap < BridgetownSitemap::Test
93
97
  end
94
98
 
95
99
  should "include the correct number of items" do
96
- assert_equal 17, @sitemap.scan(%r!(?=<url>)!).count
100
+ assert_equal 18, @sitemap.scan(%r!(?=<url>)!).count
97
101
  end
98
102
 
99
103
  should "include generated pages" do
@@ -116,7 +120,7 @@ class TestSitemap < BridgetownSitemap::Test
116
120
 
117
121
  context "rendering the site with a baseurl" do
118
122
  setup do
119
- config.baseurl = "/baseurl"
123
+ config.base_path = "/baseurl"
120
124
  build_site
121
125
  end
122
126
 
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.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ayush Newatia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-11 00:00:00.000000000 Z
11
+ date: 2023-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.20'
19
+ version: '1.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2.0'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '0.20'
29
+ version: '1.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2.0'
@@ -62,22 +62,23 @@ dependencies:
62
62
  name: rubocop-bridgetown
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - "~>"
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: '0.2'
67
+ version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "~>"
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: '0.2'
75
- description:
74
+ version: '0'
75
+ description:
76
76
  email: ayush@hey.com
77
77
  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
@@ -97,7 +98,7 @@ files:
97
98
  - script/release
98
99
  - script/test
99
100
  - test/fixtures/bridgetown.config.yml
100
- - test/fixtures/plugins/builders/generated_pages_builder.rb
101
+ - test/fixtures/plugins/builders/generated_pages.rb
101
102
  - test/fixtures/plugins/site_builder.rb
102
103
  - test/fixtures/src/_data/.keep
103
104
  - test/fixtures/src/_layouts/default.html
@@ -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
@@ -131,7 +133,7 @@ homepage: https://github.com/ayushn21/bridgetown-sitemap
131
133
  licenses:
132
134
  - MIT
133
135
  metadata: {}
134
- post_install_message:
136
+ post_install_message:
135
137
  rdoc_options: []
136
138
  require_paths:
137
139
  - lib
@@ -139,20 +141,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
141
  requirements:
140
142
  - - ">="
141
143
  - !ruby/object:Gem::Version
142
- version: 2.5.0
144
+ version: 2.7.0
143
145
  required_rubygems_version: !ruby/object:Gem::Requirement
144
146
  requirements:
145
147
  - - ">="
146
148
  - !ruby/object:Gem::Version
147
149
  version: '0'
148
150
  requirements: []
149
- rubygems_version: 3.1.4
150
- signing_key:
151
+ rubygems_version: 3.2.32
152
+ signing_key:
151
153
  specification_version: 4
152
154
  summary: Automatically generate a sitemap.xml for your Bridgetown site.
153
155
  test_files:
154
156
  - test/fixtures/bridgetown.config.yml
155
- - test/fixtures/plugins/builders/generated_pages_builder.rb
157
+ - test/fixtures/plugins/builders/generated_pages.rb
156
158
  - test/fixtures/plugins/site_builder.rb
157
159
  - test/fixtures/src/_data/.keep
158
160
  - test/fixtures/src/_layouts/default.html
@@ -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