static-rails 0.0.12 → 0.0.13
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/.circleci/config.yml +26 -43
- data/.gitignore +2 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +3 -3
- data/lib/static-rails/static_middleware.rb +14 -6
- data/lib/static-rails/version.rb +1 -1
- data/script/setup +28 -0
- data/script/test +11 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03ce2ba0869984457f2559cbb246e1c5c4e7335ff2050fcde5d40b8bb7206d8d
|
4
|
+
data.tar.gz: d77d6cc728e3b107d142ec2f8c72532a1d34e6bd26d44e1b7d6fbf6f4cde525d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8edb6f4136b02e64b01e9ca46fb5322eb963a7ec3769b98aa93c71d8c22adb6f6232ef4660c16c049eb8f1ee58d702368918e6aeb5956202ff84605c3c690eb9
|
7
|
+
data.tar.gz: 0452ae2dd5985d8cd7f741a637888262da0d08126edaafa0bafafd0de2bfcbf27b79d033ee41e017a65753a1556df20d37ff25faccbad8e94b71bc60b16f0ace
|
data/.circleci/config.yml
CHANGED
@@ -13,31 +13,17 @@ jobs:
|
|
13
13
|
# One of the apps needs hugo
|
14
14
|
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends hugo
|
15
15
|
|
16
|
+
# Make sure we use the right Bundler
|
17
|
+
- run: gem install bundler --version `tail -1 Gemfile.lock`
|
18
|
+
|
16
19
|
# Bundle install dependencies
|
17
20
|
- type: cache-restore
|
18
21
|
key: v1-main-{{ checksum "Gemfile.lock" }}
|
19
22
|
|
20
|
-
- run: gem install bundler --version `tail -1 Gemfile.lock`
|
21
|
-
- run: bundle install --path vendor/bundle
|
22
|
-
|
23
|
-
- type: cache-save
|
24
|
-
key: v1-main-{{ checksum "Gemfile.lock" }}
|
25
|
-
paths:
|
26
|
-
- vendor/bundle
|
27
|
-
|
28
23
|
# Bundle install dependencies for example app
|
29
24
|
- type: cache-restore
|
30
25
|
key: v1-example-{{ checksum "example/Gemfile.lock" }}
|
31
26
|
|
32
|
-
- run: |
|
33
|
-
cd example
|
34
|
-
bundle install --path vendor/bundle
|
35
|
-
|
36
|
-
- type: cache-save
|
37
|
-
key: v1-example-{{ checksum "example/Gemfile.lock" }}
|
38
|
-
paths:
|
39
|
-
- example/vendor/bundle
|
40
|
-
|
41
27
|
# Yarn dependencies
|
42
28
|
- restore_cache:
|
43
29
|
keys:
|
@@ -45,29 +31,10 @@ jobs:
|
|
45
31
|
# fallback to using the latest cache if no exact match is found
|
46
32
|
- v2-yarn-
|
47
33
|
|
48
|
-
- run: |
|
49
|
-
cd example
|
50
|
-
yarn install
|
51
|
-
|
52
|
-
- save_cache:
|
53
|
-
paths:
|
54
|
-
- example/node_modules
|
55
|
-
- ~/.cache
|
56
|
-
key: v2-yarn-{{ checksum "example/yarn.lock" }}
|
57
|
-
|
58
34
|
# Bundle install dependencies for jekyll app
|
59
35
|
- type: cache-restore
|
60
36
|
key: v1-jekyll-{{ checksum "example/static/docs/Gemfile.lock" }}
|
61
37
|
|
62
|
-
- run: |
|
63
|
-
cd example/static/docs
|
64
|
-
bundle install --path vendor/bundle
|
65
|
-
|
66
|
-
- type: cache-save
|
67
|
-
key: v1-jekyll-{{ checksum "example/static/docs/Gemfile.lock" }}
|
68
|
-
paths:
|
69
|
-
- example/static/docs/vendor/bundle
|
70
|
-
|
71
38
|
# Npm install for Eleventy app
|
72
39
|
- restore_cache:
|
73
40
|
keys:
|
@@ -75,16 +42,32 @@ jobs:
|
|
75
42
|
# fallback to using the latest cache if no exact match is found
|
76
43
|
- v1-eleventy-
|
77
44
|
|
78
|
-
- run:
|
79
|
-
|
80
|
-
|
45
|
+
- run: ./script/setup
|
46
|
+
|
47
|
+
- type: cache-save
|
48
|
+
key: v1-main-{{ checksum "Gemfile.lock" }}
|
49
|
+
paths:
|
50
|
+
- vendor/bundle
|
51
|
+
|
52
|
+
- type: cache-save
|
53
|
+
key: v1-example-{{ checksum "example/Gemfile.lock" }}
|
54
|
+
paths:
|
55
|
+
- example/vendor/bundle
|
56
|
+
|
57
|
+
- save_cache:
|
58
|
+
paths:
|
59
|
+
- example/node_modules
|
60
|
+
- ~/.cache
|
61
|
+
key: v2-yarn-{{ checksum "example/yarn.lock" }}
|
62
|
+
|
63
|
+
- type: cache-save
|
64
|
+
key: v1-jekyll-{{ checksum "example/static/docs/Gemfile.lock" }}
|
65
|
+
paths:
|
66
|
+
- example/static/docs/vendor/bundle
|
81
67
|
|
82
68
|
- save_cache:
|
83
69
|
paths:
|
84
70
|
- example/static/blog-docs/node_modules
|
85
71
|
key: v1-eleventy-{{ checksum "example/static/blog-docs/package-lock.json" }}
|
86
72
|
|
87
|
-
- run:
|
88
|
-
- run: |
|
89
|
-
cd example
|
90
|
-
./script/test
|
73
|
+
- run: ./script/test
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
static-rails (0.0.
|
4
|
+
static-rails (0.0.13)
|
5
5
|
rack-proxy (~> 0.6)
|
6
6
|
railties (>= 5.0.0)
|
7
7
|
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
method_source (1.0.0)
|
41
41
|
mini_portile2 (2.4.0)
|
42
42
|
minitest (5.14.1)
|
43
|
-
nokogiri (1.10.
|
43
|
+
nokogiri (1.10.10)
|
44
44
|
mini_portile2 (~> 2.4.0)
|
45
45
|
parallel (1.19.1)
|
46
46
|
parser (2.7.1.3)
|
@@ -87,7 +87,7 @@ GEM
|
|
87
87
|
tzinfo (1.2.7)
|
88
88
|
thread_safe (~> 0.1)
|
89
89
|
unicode-display_width (1.7.0)
|
90
|
-
zeitwerk (2.
|
90
|
+
zeitwerk (2.4.0)
|
91
91
|
|
92
92
|
PLATFORMS
|
93
93
|
ruby
|
@@ -18,8 +18,8 @@ module StaticRails
|
|
18
18
|
if (req.get? || req.head?) && (site = @matches_request_to_static_site.call(req))
|
19
19
|
file_handler = file_handler_for(site)
|
20
20
|
path = req.path_info.gsub(/^#{site.url_root_path}/, "").chomp("/")
|
21
|
-
if (
|
22
|
-
return
|
21
|
+
if (result = serve_file_for(file_handler, site, path, req))
|
22
|
+
return result
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -40,11 +40,19 @@ module StaticRails
|
|
40
40
|
)
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
if (found = file_handler.find_file(path, accept_encoding: accept_encoding))
|
45
|
-
found
|
43
|
+
def serve_file_for(file_handler, site, path, req)
|
44
|
+
if (found = file_handler.find_file(path, accept_encoding: req.accept_encoding))
|
45
|
+
serve_file(file_handler, found, req)
|
46
46
|
elsif site.compile_404_file_path.present?
|
47
|
-
file_handler.find_file(site.compile_404_file_path, accept_encoding: accept_encoding)
|
47
|
+
found = file_handler.find_file(site.compile_404_file_path, accept_encoding: req.accept_encoding)
|
48
|
+
serve_file(file_handler, found, req, 404)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def serve_file(file_handler, file, req, status_override = nil)
|
53
|
+
return unless file
|
54
|
+
file_handler.serve(req, *file).tap do |result|
|
55
|
+
result[0] = status_override unless status_override.nil?
|
48
56
|
end
|
49
57
|
end
|
50
58
|
end
|
data/lib/static-rails/version.rb
CHANGED
data/script/setup
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
echo "--> Installing static-rails' Ruby deps"
|
6
|
+
bundle install --path vendor/bundle
|
7
|
+
|
8
|
+
echo "--> Installing example app's Ruby deps"
|
9
|
+
cd example
|
10
|
+
bundle install --path vendor/bundle
|
11
|
+
cd ..
|
12
|
+
|
13
|
+
echo "--> Installing example app's JS deps"
|
14
|
+
cd example
|
15
|
+
yarn install
|
16
|
+
cd ..
|
17
|
+
|
18
|
+
echo "--> Installing example app's Jekyll site's Ruby deps"
|
19
|
+
cd example/static/docs
|
20
|
+
bundle install --path vendor/bundle
|
21
|
+
cd ../../..
|
22
|
+
|
23
|
+
echo "--> Installing example app's Eleventy site's JS deps"
|
24
|
+
cd example/static/blog-docs
|
25
|
+
npm install
|
26
|
+
cd ../../..
|
27
|
+
|
28
|
+
|
data/script/test
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: static-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.6'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- searls@gmail.com
|
44
44
|
executables: []
|
@@ -81,13 +81,15 @@ files:
|
|
81
81
|
- lib/static-rails/version.rb
|
82
82
|
- lib/static-rails/waits_for_connection.rb
|
83
83
|
- lib/tasks/static-rails.rake
|
84
|
+
- script/setup
|
85
|
+
- script/test
|
84
86
|
- static-rails.gemspec
|
85
87
|
homepage: https://github.com/testdouble/static-rails
|
86
88
|
licenses:
|
87
89
|
- MIT
|
88
90
|
metadata:
|
89
91
|
homepage_uri: https://github.com/testdouble/static-rails
|
90
|
-
post_install_message:
|
92
|
+
post_install_message:
|
91
93
|
rdoc_options: []
|
92
94
|
require_paths:
|
93
95
|
- lib
|
@@ -103,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
105
|
version: '0'
|
104
106
|
requirements: []
|
105
107
|
rubygems_version: 3.1.2
|
106
|
-
signing_key:
|
108
|
+
signing_key:
|
107
109
|
specification_version: 4
|
108
110
|
summary: Build & serve static sites (e.g. Jekyll, Hugo) from your Rails app
|
109
111
|
test_files: []
|