lanyon 0.4.3 → 0.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2f2ed82be1b1a0e4a4ca74b9ef4bf855fd321fbfdab480711e19b506c29e79e
4
- data.tar.gz: e8713bd319fb150aa8763f9b977a6d3407cef1f2fe1edef01e712a8d0c5f09e4
3
+ metadata.gz: a67a8b03e023abd95e3914606603414b556fd998a5f31c68c9419eabe0ed59b5
4
+ data.tar.gz: 212051d57e0db7c251f65270fafa1a54ba35b5d2e680835f1dbbc86497e83c12
5
5
  SHA512:
6
- metadata.gz: b4acef77523d343f1dcf1b2c13037cf2ca3aafd9c34613daf52aaae6697811a2b571278e52c2b75db653881fe467ddcb54abdbc991aca7ab8fed87a7cbebf946
7
- data.tar.gz: 02b0eb0279f08fde9307f01c5190efc3d2197d5b7f6205aea87383811091582a9d85fd11cddd656f33a7ef5de850dd671e9770cb92a062c4af7530116321c7f4
6
+ metadata.gz: ab0ca32972eb02b8b01af596855325899f3e8a1b0c17ac4cd860a8640969e3f472316c18ee3d3b48c12e007a23ccc29d4e4b28225b66419793df9e2dfd285494
7
+ data.tar.gz: 35630bef910397e987d989c73113553e0b80d1d716121c447a72776881b41d0ea6bf8a53dab992a7fbd3ca347c34dc0ccb44510fb8fe15078bf5c6e34f5b4f20
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,14 @@
1
1
  Release History
2
2
  ===============
3
3
 
4
+ ## 0.4.4
5
+
6
+ * Improve code style
7
+ * Update README
8
+ * Add CI workflow
9
+ * Move development dependencies from gemspec to Gemfile
10
+ * Add WEBrick as development dependency (for Ruby 3.0)
11
+
4
12
  ## 0.4.3
5
13
 
6
14
  * Use Rack::ContentLength middleware to fix missing
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,26 @@ 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
+ Note that for Ruby 3.0 or newer, you _must_ explicitly add a
32
+ web server gem.
33
+ In older Ruby versions, WEBrick is already included and used as fallback.
34
+ For possible other choices see [Rack's README][rack].
35
+
36
+ 2. Add a `config.ru` file in your project's root directory,
16
37
  with the following content:
17
38
 
18
39
  ``` ruby
@@ -23,10 +44,10 @@ to a Rack application is very simple.
23
44
 
24
45
  You can specify additional Rack middleware in this file.
25
46
 
26
- 2. At the command prompt, build the site and start the web server with
47
+ 3. Build the site and start the web server with the following command:
27
48
 
28
49
  ``` sh
29
- rackup config.ru
50
+ bundle exec rackup config.ru
30
51
  ```
31
52
 
32
53
  You can find an example site in the `demo` directory.
@@ -35,17 +56,9 @@ Note that Lanyon does not watch for site changes.
35
56
  Auto-regeneration similar to Jekyll's `serve` command is
36
57
  not supported, and there are no plans to add this feature.
37
58
 
38
- Lanyon applications can be served with WEBrick, Thin, Unicorn and many
59
+ Lanyon applications can be served with WEBrick, Puma, Thin, and many
39
60
  other web servers, and they can be deployed to services like e.g. Heroku.
40
61
 
41
- ## Installation
42
-
43
- You can install the Lanyon gem from RubyGems.org with
44
-
45
- ``` sh
46
- gem install lanyon
47
- ```
48
-
49
62
  ## Configuration
50
63
 
51
64
  ### Options
@@ -115,6 +128,6 @@ See also the included `LICENSE` file for more information.
115
128
 
116
129
  [ruby]: http://www.ruby-lang.org/
117
130
  [jekyll]: http://jekyllrb.com/
118
- [rack]: http://rack.github.io/
131
+ [rack]: https://github.com/rack/rack
119
132
  [rack-jekyll]: https://github.com/adaoraul/rack-jekyll
120
133
  [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
@@ -24,12 +26,10 @@ Gem::Specification.new do |s|
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
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.4.4"
5
+ DATE = "2022-05-28"
6
6
  end
@@ -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.4.4
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: 2022-05-28 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
@@ -140,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
112
  - !ruby/object:Gem::Version
141
113
  version: '0'
142
114
  requirements: []
143
- rubygems_version: 3.3.3
115
+ rubygems_version: 3.3.7
144
116
  signing_key:
145
117
  specification_version: 4
146
118
  summary: Lanyon serves your Jekyll site as a Rack application.