static-rails 0.0.2 → 0.0.3

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: 59b735436f8beadbe02b488f6d9ba385beb4527cc3b1da082e4e07f2a4645dc9
4
- data.tar.gz: 5c40b3b20ea44e52dabef6d8660aaf59784f198759baac9e909ba9283916a9f8
3
+ metadata.gz: 04cd8c43f2a9d6ff2da0768d8daa7024ca470acb94a2444540d26411dad45675
4
+ data.tar.gz: 55246dbc95a32e8517db8bc8b21136f9a3cac60ba18b3cd9bee27ef2501ae774
5
5
  SHA512:
6
- metadata.gz: 2d222bec9bcc9c02e3c52adadcd8426290dccbd18aaff465723ed4b152147d42c4980bf34284669cbd58ec2b9794aaf02b3e719bb1b76324ffceb24547b6afbc
7
- data.tar.gz: c42139bb13e835326dd49c37f569c816689eff8a490befba9f6b37491e0113992dcaf4f5395fb24aaea20143c7abeacd5db8b0276932748ae7fc1476566263e3
6
+ metadata.gz: e59dd52fb103bc1add1ad27a05ac83eff4b04b09ecc7bb08b73d2fd071279a87e8ae05e73c2f43a64eda4e2c1c77281d0fd8650a5c4aea2d04c2088980606127
7
+ data.tar.gz: 548aa50ee427be8b0a3842b4000a07dbac7b0513cf9a712ab46dcd8903a829a58f395345549b921b154d5acdfa235fdc482e7e357ffcbdffec6a07aaf0d34319
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ ## 0.0.3
2
+
3
+ * Add `url_skip_paths_starting_with` array of strings option to site
4
+ configuration. Will fall through to the next matching site or all the way to
5
+ the Rails app.
6
+
7
+ ## 0.0.2
8
+
9
+ * Add `env` hash option to site configuration
10
+
11
+ ## 0.0.1
12
+
13
+ * Initial release
data/Gemfile.lock CHANGED
@@ -1,32 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- static-rails (0.0.2)
4
+ static-rails (0.0.3)
5
5
  rack-proxy (~> 0.6)
6
6
  railties (>= 5.0.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (6.0.2.2)
12
- actionview (= 6.0.2.2)
13
- activesupport (= 6.0.2.2)
11
+ actionpack (6.0.3)
12
+ actionview (= 6.0.3)
13
+ activesupport (= 6.0.3)
14
14
  rack (~> 2.0, >= 2.0.8)
15
15
  rack-test (>= 0.6.3)
16
16
  rails-dom-testing (~> 2.0)
17
17
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
- actionview (6.0.2.2)
19
- activesupport (= 6.0.2.2)
18
+ actionview (6.0.3)
19
+ activesupport (= 6.0.3)
20
20
  builder (~> 3.1)
21
21
  erubi (~> 1.4)
22
22
  rails-dom-testing (~> 2.0)
23
23
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
- activesupport (6.0.2.2)
24
+ activesupport (6.0.3)
25
25
  concurrent-ruby (~> 1.0, >= 1.0.2)
26
26
  i18n (>= 0.7, < 2)
27
27
  minitest (~> 5.1)
28
28
  tzinfo (~> 1.1)
29
- zeitwerk (~> 2.2)
29
+ zeitwerk (~> 2.2, >= 2.2.2)
30
30
  ast (2.4.0)
31
31
  builder (3.2.4)
32
32
  concurrent-ruby (1.1.6)
@@ -56,9 +56,9 @@ GEM
56
56
  nokogiri (>= 1.6)
57
57
  rails-html-sanitizer (1.3.0)
58
58
  loofah (~> 2.3)
59
- railties (6.0.2.2)
60
- actionpack (= 6.0.2.2)
61
- activesupport (= 6.0.2.2)
59
+ railties (6.0.3)
60
+ actionpack (= 6.0.3)
61
+ activesupport (= 6.0.3)
62
62
  method_source
63
63
  rake (>= 0.8.7)
64
64
  thor (>= 0.20.3, < 2.0)
@@ -28,6 +28,9 @@ StaticRails.config do |config|
28
28
  # # Mount the static site web hosting to a certain sub-path (e.g. "/docs")
29
29
  # url_root_path: "/",
30
30
  #
31
+ # # Don't serve/redirect routes whose paths start with these strings
32
+ # url_skip_paths_starting_with: ["/api"]
33
+ #
31
34
  # # Whether to run the local development/test server or not
32
35
  # start_server: !Rails.env.production?,
33
36
  #
@@ -2,7 +2,7 @@ module StaticRails
2
2
  class MatchesRequestToStaticSite
3
3
  def call(request)
4
4
  StaticRails.config.sites.find { |site|
5
- subdomain_match?(site, request) && path_match?(site, request)
5
+ subdomain_match?(site, request) && path_match?(site, request) && !skip_path?(site, request)
6
6
  }
7
7
  end
8
8
 
@@ -20,5 +20,11 @@ module StaticRails
20
20
  def path_match?(site, request)
21
21
  request.path_info.start_with?(site.url_root_path)
22
22
  end
23
+
24
+ def skip_path?(site, request)
25
+ site.url_skip_paths_starting_with.any? { |path_start|
26
+ request.path_info.start_with?(path_start)
27
+ }
28
+ end
23
29
  end
24
30
  end
@@ -3,6 +3,7 @@ module StaticRails
3
3
  :name,
4
4
  :url_subdomain,
5
5
  :url_root_path,
6
+ :url_skip_paths_starting_with,
6
7
  :source_dir,
7
8
  :start_server,
8
9
  :ping_server,
@@ -18,6 +19,7 @@ module StaticRails
18
19
 
19
20
  def initialize(
20
21
  url_root_path: "/",
22
+ url_skip_paths_starting_with: [],
21
23
  start_server: !Rails.env.production?,
22
24
  ping_server: true,
23
25
  env: {},
@@ -25,11 +27,13 @@ module StaticRails
25
27
  server_path: "/",
26
28
  **other_kwargs
27
29
  )
30
+ @url_root_path = url_root_path
31
+ @url_skip_paths_starting_with = url_skip_paths_starting_with
28
32
  @start_server = start_server
33
+ @ping_server = ping_server
29
34
  @env = env
30
35
  @server_host = server_host
31
36
  @server_path = server_path
32
- @ping_server = ping_server
33
37
  super
34
38
  end
35
39
  end
@@ -1,3 +1,3 @@
1
1
  module StaticRails
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-06 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -49,6 +49,7 @@ files:
49
49
  - ".gitignore"
50
50
  - ".standard.yml"
51
51
  - ".travis.yml"
52
+ - CHANGELOG.md
52
53
  - Gemfile
53
54
  - Gemfile.lock
54
55
  - LICENSE.txt