lanyon 0.4.3 → 0.5.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: a2f2ed82be1b1a0e4a4ca74b9ef4bf855fd321fbfdab480711e19b506c29e79e
4
- data.tar.gz: e8713bd319fb150aa8763f9b977a6d3407cef1f2fe1edef01e712a8d0c5f09e4
3
+ metadata.gz: e0b1429cc8982232e238fdd2331a1884e68e4009e89991eb78a156cca4e28918
4
+ data.tar.gz: 0556faa2fe29209605bcba01f7e56da0a35baf531c3fbee26bfb63e90417d25a
5
5
  SHA512:
6
- metadata.gz: b4acef77523d343f1dcf1b2c13037cf2ca3aafd9c34613daf52aaae6697811a2b571278e52c2b75db653881fe467ddcb54abdbc991aca7ab8fed87a7cbebf946
7
- data.tar.gz: 02b0eb0279f08fde9307f01c5190efc3d2197d5b7f6205aea87383811091582a9d85fd11cddd656f33a7ef5de850dd671e9770cb92a062c4af7530116321c7f4
6
+ metadata.gz: 18d45c5d01d49187f0d5b1ba1a47baa8da3ab8dba9fafc349a10c8acfc08f6e603e6cc1332ef0012e1e3b513c1ba065ca562f71fe06f1834bce866ec26eb12ed
7
+ data.tar.gz: afbcc69d870a1a32d7fa9e8bc7071caa739924051844bbce681cbe948ade437b2b15c1ad1c6900c12f08294ddba8f3849d2bb7801e12cc00966aa6d09bdc1377
data/Gemfile CHANGED
@@ -1,2 +1,12 @@
1
1
  source "https://rubygems.org"
2
+
2
3
  gemspec
4
+
5
+ gem "minitest", ">= 5.8"
6
+ gem "rake", ">= 13.0"
7
+
8
+ gem "webrick"
9
+
10
+ group :linter do
11
+ gem "rubocop"
12
+ end
data/History.md CHANGED
@@ -1,6 +1,20 @@
1
1
  Release History
2
2
  ===============
3
3
 
4
+ ## 0.5.0
5
+
6
+ * Require Ruby 3.1 or newer
7
+ * Improve code style
8
+ * Update README
9
+
10
+ ## 0.4.4
11
+
12
+ * Improve code style
13
+ * Update README
14
+ * Add CI workflow
15
+ * Move development dependencies from gemspec to Gemfile
16
+ * Add WEBrick as development dependency (for Ruby 3.0)
17
+
4
18
  ## 0.4.3
5
19
 
6
20
  * Use Rack::ContentLength middleware to fix missing
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2022 Marcus Stollsteimer
3
+ Copyright (c) 2015-2024 Marcus Stollsteimer
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  Lanyon
2
2
  ======
3
3
 
4
+ ![CI](https://github.com/stomar/lanyon/actions/workflows/ci.yml/badge.svg)
5
+
4
6
  Lanyon serves your Jekyll site as a Rack application.
5
7
 
6
8
  Lanyon is a good friend of [Jekyll][jekyll], the static site generator,
@@ -12,7 +14,23 @@ Assuming you already have a Jekyll project that can be built and
12
14
  served using the `jekyll` command line tool, then converting it
13
15
  to a Rack application is very simple.
14
16
 
15
- 1. Add a `config.ru` file in your project's root directory,
17
+ 1. Add the Lanyon gem and one of the web servers supported by Rack
18
+ (e.g. Puma) to your project's `Gemfile`:
19
+
20
+ ~~~ ruby
21
+ gem "lanyon"
22
+ gem "puma"
23
+ ~~~
24
+
25
+ Then install the gems by running the following in the terminal:
26
+
27
+ ~~~ sh
28
+ bundle install
29
+ ~~~
30
+
31
+ For possible other choices for web servers see [Rack's README][rack].
32
+
33
+ 2. Add a `config.ru` file in your project's root directory,
16
34
  with the following content:
17
35
 
18
36
  ``` ruby
@@ -23,10 +41,10 @@ to a Rack application is very simple.
23
41
 
24
42
  You can specify additional Rack middleware in this file.
25
43
 
26
- 2. At the command prompt, build the site and start the web server with
44
+ 3. Build the site and start the web server with the following command:
27
45
 
28
46
  ``` sh
29
- rackup config.ru
47
+ bundle exec rackup config.ru
30
48
  ```
31
49
 
32
50
  You can find an example site in the `demo` directory.
@@ -35,17 +53,9 @@ Note that Lanyon does not watch for site changes.
35
53
  Auto-regeneration similar to Jekyll's `serve` command is
36
54
  not supported, and there are no plans to add this feature.
37
55
 
38
- Lanyon applications can be served with WEBrick, Thin, Unicorn and many
56
+ Lanyon applications can be served with WEBrick, Puma, Thin, and many
39
57
  other web servers, and they can be deployed to services like e.g. Heroku.
40
58
 
41
- ## Installation
42
-
43
- You can install the Lanyon gem from RubyGems.org with
44
-
45
- ``` sh
46
- gem install lanyon
47
- ```
48
-
49
59
  ## Configuration
50
60
 
51
61
  ### Options
@@ -79,7 +89,7 @@ This can also be a file generated by Jekyll from e.g. Markdown sources.
79
89
 
80
90
  ## Requirements
81
91
 
82
- - [Ruby][ruby] 2.0.0 or higher
92
+ - [Ruby][ruby] 3.1 or higher
83
93
 
84
94
  - Gem dependencies (runtime): `jekyll`, `rack`
85
95
 
@@ -107,7 +117,7 @@ Lanyon was inspired by [rack-jekyll][rack-jekyll] and written as a replacement.
107
117
 
108
118
  ## License
109
119
 
110
- Copyright © 2015-2022 Marcus Stollsteimer
120
+ Copyright © 2015-2024 Marcus Stollsteimer
111
121
 
112
122
  Lanyon is licensed under the [MIT License][MIT].
113
123
  See also the included `LICENSE` file for more information.
@@ -115,6 +125,6 @@ See also the included `LICENSE` file for more information.
115
125
 
116
126
  [ruby]: http://www.ruby-lang.org/
117
127
  [jekyll]: http://jekyllrb.com/
118
- [rack]: http://rack.github.io/
128
+ [rack]: https://github.com/rack/rack
119
129
  [rack-jekyll]: https://github.com/adaoraul/rack-jekyll
120
130
  [MIT]: http://www.opensource.org/licenses/MIT
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rake/testtask"
2
4
  require "fileutils"
3
5
 
data/lanyon.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "lib/lanyon/version"
2
4
 
3
5
  version = Lanyon::VERSION
@@ -19,17 +21,15 @@ Gem::Specification.new do |s|
19
21
 
20
22
  s.license = "MIT"
21
23
 
22
- s.required_ruby_version = ">= 2.0.0"
24
+ s.required_ruby_version = ">= 3.1.0"
23
25
 
24
26
  s.add_dependency "jekyll", ">= 2.0"
25
27
  s.add_dependency "rack", ">= 1.6", "< 3.0"
26
28
 
27
- s.add_development_dependency "minitest", "~> 5.8"
28
- s.add_development_dependency "rake", "~> 13.0"
29
-
30
29
  s.require_paths = ["lib"]
31
30
 
32
- s.files = %w[
31
+ s.files =
32
+ %w[
33
33
  README.md
34
34
  LICENSE
35
35
  History.md
@@ -63,16 +63,16 @@ module Lanyon
63
63
  end
64
64
 
65
65
  def html_wrap(title, content) # :nodoc:
66
- <<-DOCUMENT.gsub(/^ {6}/, "")
67
- <!DOCTYPE html>
68
- <html lang="en">
69
- <head>
70
- <meta charset="utf-8">
71
- <title>#{title}</title></head>
72
- <body>
73
- #{content}
74
- </body>
75
- </html>
66
+ <<~DOCUMENT
67
+ <!DOCTYPE html>
68
+ <html lang="en">
69
+ <head>
70
+ <meta charset="utf-8">
71
+ <title>#{title}</title></head>
72
+ <body>
73
+ #{content}
74
+ </body>
75
+ </html>
76
76
  DOCUMENT
77
77
  end
78
78
 
data/lib/lanyon/router.rb CHANGED
@@ -31,19 +31,17 @@ module Lanyon
31
31
  # can be found, +path.html+ is tried.
32
32
  def endpoint(path)
33
33
  normalized = normalize_path_info(path)
34
-
35
34
  fullpath = File.join(@root, normalized)
36
- endpoint = if FileTest.file?(fullpath)
37
- fullpath
38
- elsif needs_redirect_to_dir?(fullpath)
39
- :must_redirect
40
- elsif FileTest.file?(fullpath_html = "#{fullpath}.html")
41
- fullpath_html
42
- else
43
- :not_found
44
- end
45
-
46
- endpoint
35
+
36
+ if FileTest.file?(fullpath)
37
+ fullpath
38
+ elsif needs_redirect_to_dir?(fullpath)
39
+ :must_redirect
40
+ elsif FileTest.file?(fullpath_html = "#{fullpath}.html")
41
+ fullpath_html
42
+ else
43
+ :not_found
44
+ end
47
45
  end
48
46
 
49
47
  # Returns the body of the custom 404 page or +nil+ if none exists.
@@ -56,7 +54,7 @@ module Lanyon
56
54
  private
57
55
 
58
56
  def needs_redirect_to_dir?(fullpath) # :nodoc:
59
- !fullpath.end_with?("/") && FileTest.file?(fullpath + "/index.html")
57
+ !fullpath.end_with?("/") && FileTest.file?("#{fullpath}/index.html")
60
58
  end
61
59
 
62
60
  def unescape_path(path) # :nodoc:
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lanyon
4
- VERSION = "0.4.3"
5
- DATE = "2022-01-06"
4
+ VERSION = "0.5.0"
5
+ DATE = "2024-01-05"
6
6
  end
data/test/helper.rb CHANGED
@@ -23,7 +23,7 @@ def setup_tempdir
23
23
  end
24
24
 
25
25
  def teardown_tempdir
26
- FileUtils.rm_rf(TEMP_DIR) if File.exist?(TEMP_DIR)
26
+ FileUtils.rm_rf(TEMP_DIR)
27
27
  end
28
28
 
29
29
  def chdir_tempdir
@@ -31,7 +31,7 @@ def chdir_tempdir
31
31
  end
32
32
 
33
33
  def teardown_cachedir
34
- FileUtils.rm_rf(CACHE_DIR) if File.exist?(CACHE_DIR)
34
+ FileUtils.rm_rf(CACHE_DIR)
35
35
  end
36
36
 
37
37
  def sourcedir
data/test/test_build.rb CHANGED
@@ -17,7 +17,7 @@ describe "when creating a Lanyon application" do
17
17
 
18
18
  FileUtils.mkdir_p(destdir)
19
19
  FileUtils.touch(@no_page)
20
- assert File.exist?(@no_page)
20
+ assert File.exist?(@no_page)
21
21
  assert !File.exist?(@page)
22
22
  end
23
23
 
@@ -84,8 +84,8 @@ describe "when handling requests" do
84
84
  describe "when asked for a nonexistent path and a custom 404 exists" do
85
85
 
86
86
  before do
87
- @custom_404 = File.join(sourcedir, "404.html")
88
- File.open(@custom_404, "w") {|f| f.print "Custom 404" }
87
+ @custom_404_file = File.join(sourcedir, "404.html")
88
+ File.open(@custom_404_file, "w") {|f| f.print "Custom 404" }
89
89
 
90
90
  app = get_app(source: sourcedir, destination: @destdir)
91
91
  request = Rack::MockRequest.new(app)
@@ -93,7 +93,7 @@ describe "when handling requests" do
93
93
  end
94
94
 
95
95
  after do
96
- FileUtils.rm(@custom_404)
96
+ FileUtils.rm(@custom_404_file)
97
97
  end
98
98
 
99
99
  it "returns correct Content-Length header" do
data/test/test_router.rb CHANGED
@@ -160,12 +160,12 @@ describe Lanyon::Router do
160
160
  describe "when 404.html does exist" do
161
161
 
162
162
  before do
163
- @custom_404 = File.join(@sitedir, "404.html")
164
- File.open(@custom_404, "w") {|f| f.print "Custom 404" }
163
+ @custom_404_file = File.join(@sitedir, "404.html")
164
+ File.open(@custom_404_file, "w") {|f| f.print "Custom 404" }
165
165
  end
166
166
 
167
167
  after do
168
- FileUtils.rm(@custom_404)
168
+ FileUtils.rm(@custom_404_file)
169
169
  end
170
170
 
171
171
  it "returns correct body" do
@@ -178,7 +178,7 @@ describe Lanyon::Router do
178
178
  describe "when initialized" do
179
179
 
180
180
  it "strips trailing slash from root" do
181
- router = Lanyon::Router.new(@sitedir + "/")
181
+ router = Lanyon::Router.new("#{@sitedir}/")
182
182
  _(router.root).must_equal @sitedir
183
183
  end
184
184
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lanyon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Stollsteimer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-06 00:00:00.000000000 Z
11
+ date: 2024-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -44,34 +44,6 @@ dependencies:
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '3.0'
47
- - !ruby/object:Gem::Dependency
48
- name: minitest
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '5.8'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '5.8'
61
- - !ruby/object:Gem::Dependency
62
- name: rake
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '13.0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '13.0'
75
47
  description: Lanyon is a good friend of Jekyll, the static site generator, and transforms
76
48
  your website into a Rack application.
77
49
  email: sto.mar@web.de
@@ -133,14 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
105
  requirements:
134
106
  - - ">="
135
107
  - !ruby/object:Gem::Version
136
- version: 2.0.0
108
+ version: 3.1.0
137
109
  required_rubygems_version: !ruby/object:Gem::Requirement
138
110
  requirements:
139
111
  - - ">="
140
112
  - !ruby/object:Gem::Version
141
113
  version: '0'
142
114
  requirements: []
143
- rubygems_version: 3.3.3
115
+ rubygems_version: 3.5.3
144
116
  signing_key:
145
117
  specification_version: 4
146
118
  summary: Lanyon serves your Jekyll site as a Rack application.