static-rails 0.0.12 → 0.0.13

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: 3c9c3f77b3746fd75f797c4c33815e5c699af9e4c1c9a88f56234117406d1b7f
4
- data.tar.gz: bf8d899c95891497e8a17492d58315993af2d189f7a3ea3e848937f04e252a81
3
+ metadata.gz: 03ce2ba0869984457f2559cbb246e1c5c4e7335ff2050fcde5d40b8bb7206d8d
4
+ data.tar.gz: d77d6cc728e3b107d142ec2f8c72532a1d34e6bd26d44e1b7d6fbf6f4cde525d
5
5
  SHA512:
6
- metadata.gz: 8ae97c0207f5fcfe0516d78e43738ec6c8def425312dd0af03070c488927ee812824b1ec3742ee21e874e3d8e47568f44e1bd577757aa0054f8a3dcadce7c943
7
- data.tar.gz: f840d03e50b3017ecccc9a259d9f89e0ce92dc76b735f47bc6a8873c17efb6f87ece051eb6167f6a11f603e88c5e5c5ca2afac9b9f2d886bf098e63fc0491133
6
+ metadata.gz: 8edb6f4136b02e64b01e9ca46fb5322eb963a7ec3769b98aa93c71d8c22adb6f6232ef4660c16c049eb8f1ee58d702368918e6aeb5956202ff84605c3c690eb9
7
+ data.tar.gz: 0452ae2dd5985d8cd7f741a637888262da0d08126edaafa0bafafd0de2bfcbf27b79d033ee41e017a65753a1556df20d37ff25faccbad8e94b71bc60b16f0ace
@@ -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
- cd example/static/blog-docs
80
- npm install
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: bundle exec rake standard:fix
88
- - run: |
89
- cd example
90
- ./script/test
73
+ - run: ./script/test
data/.gitignore CHANGED
@@ -6,3 +6,5 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /vendor/bundle
10
+ /example/vendor/bundle
@@ -1,3 +1,8 @@
1
+ ## 0.0.13
2
+
3
+ * 404 pages served in production via a site's `compile_404_file_path` setting
4
+ will now also send the HTTP status code of 404 instead of 200
5
+
1
6
  ## 0.0.12
2
7
 
3
8
  * Fix an issue in which enabling force_ssl would result in redirects to the
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- static-rails (0.0.12)
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.9)
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.3.0)
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 (found = find_file_for(file_handler, site, path, req.accept_encoding))
22
- return file_handler.serve(req, *found)
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 find_file_for(file_handler, site, path, accept_encoding)
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
@@ -1,3 +1,3 @@
1
1
  module StaticRails
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -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
+
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo "--> Running standard:fix"
6
+ bundle exec rake standard:fix
7
+
8
+ echo "--> Running example app's tests"
9
+ cd example
10
+ ./script/test
11
+ cd ..
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.12
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-06-23 00:00:00.000000000 Z
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: []