adsf 1.4.6 → 1.4.8

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: c682683f791919dc76e3763428199f54d17b4fc11a70ff8c6f19199ec944e07d
4
- data.tar.gz: 955985f08cc3c6ec48886a7ac829c569c28c2d45e8c89e9e17b111396eb935a8
3
+ metadata.gz: d47c094094044d3f804bfb77bfd56b43fb6705bbccafb7e33085a4d3bd8fdcf1
4
+ data.tar.gz: 5b5a8708d1cf40b11975c668c2caef9635148eb3b3622479e3564ecc4a757871
5
5
  SHA512:
6
- metadata.gz: 167f3f2295cb22acd8686924e394789ddb76e1c13c60c38c781a746d79444085d26f63d46dee2970ed1e52f34493b800a62485264ba0631318f6d5457530f544
7
- data.tar.gz: 3ebf46f79170bacb198d4eeb82d0925491c231c51d8dd34397a435f997531d7026d1d6c8f7fc0e488791ab8c0e80cb21b4d95fc60fd636a2dd7177aaff3fea80
6
+ metadata.gz: b95fd1886ed101dc6b1a7ebce8fd8b5251849b261553a0f196462e9e2d372de673144c45683c180bbe279c00cc711ebab9480d8da038ca6c618b1fd5d96f2b11
7
+ data.tar.gz: 0422a6745355809dd5b37018447175905fd2c8fca5495d0c5c92a284a09033d46ed580cc585830823435ef2af65faa0c665934186add0bec42a00d39a5a03923
data/NEWS.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release notes for adsf
2
2
 
3
+ ## 1.4.8 (2023-10-14)
4
+
5
+ Fixes:
6
+
7
+ * Fixed deprecation warning for `Rack::File` (#30, #32)
8
+
9
+ ## 1.4.7 (2023-03-18)
10
+
11
+ Fixes:
12
+
13
+ * Added Rack 3.0 compatibility
14
+
3
15
  ## 1.4.6 (2021-05-16)
4
16
 
5
17
  Fixes:
data/README.md CHANGED
@@ -2,24 +2,24 @@
2
2
  [![Gem downloads](https://img.shields.io/gem/dt/adsf.svg)](http://rubygems.org/gems/adsf)
3
3
  [![Build status](https://img.shields.io/travis/ddfreyne/adsf.svg)](https://travis-ci.org/ddfreyne/adsf)
4
4
  [![Code Climate](https://img.shields.io/codeclimate/github/ddfreyne/adsf.svg)](https://codeclimate.com/github/ddfreyne/adsf)
5
- [![Code Coverage](https://img.shields.io/codecov/c/github/ddfreyne/adsf.svg)](https://codecov.io/gh/ddfreyne/adsf)
6
5
 
7
- adsf
8
- ====
6
+ # adsf
9
7
 
10
8
  _adsf_ (**A** **D**ead **S**imple **F**ileserver) is a tiny static web server that you can launch instantly in any directory, like this:
11
9
 
12
- ▸ ls -l
13
- total 0
14
- drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 about
15
- drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 contact
16
- -rw-r--r-- 1 ddfreyne staff 0 May 29 10:04 index.html
17
- drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 projects
18
-
19
- ▸ adsf
20
- [2017-11-19 11:49:20] INFO WEBrick 1.3.1
21
- [2017-11-19 11:49:20] INFO ruby 2.4.2 (2017-09-14) [x86_64-darwin17]
22
- [2017-11-19 11:49:20] INFO WEBrick::HTTPServer#start: pid=95218 port=3000
10
+ ```
11
+ ls -l
12
+ total 0
13
+ drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 about
14
+ drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 contact
15
+ -rw-r--r-- 1 ddfreyne staff 0 May 29 10:04 index.html
16
+ drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 projects
17
+
18
+ adsf
19
+ [2017-11-19 11:49:20] INFO WEBrick 1.3.1
20
+ [2017-11-19 11:49:20] INFO ruby 2.4.2 (2017-09-14) [x86_64-darwin17]
21
+ [2017-11-19 11:49:20] INFO WEBrick::HTTPServer#start: pid=95218 port=3000
22
+ ```
23
23
 
24
24
  … and now you can go to http://localhost:3000/ and start browsing.
25
25
 
@@ -27,8 +27,7 @@ See `adsf --help` for details.
27
27
 
28
28
  To use `adsf --live-reload`, please install the separate `adsf-live` gem. (The live-reload support is not part of adsf itself, because the dependencies of `adsf-live` make it difficult to install under some circumstances.)
29
29
 
30
- Using adsf programmatically
31
- ---------------------------
30
+ ## Using adsf programmatically
32
31
 
33
32
  ### IndexFileFinder
34
33
 
@@ -36,31 +35,31 @@ The `Adsf::Rack::IndexFileFinder` middleware makes Rack load an index file (e.g.
36
35
 
37
36
  ```ruby
38
37
  use Adsf::Rack::IndexFileFinder, root: 'public'
39
- run Rack::File.new('public')
38
+ run Rack::Files.new('public')
40
39
  ```
41
40
 
42
41
  It takes the following options:
43
42
 
44
- * `root` (required): the path to the web root
43
+ - `root` (required): the path to the web root
45
44
 
46
- * `index_filenames` (optional; defaults to `['index.html']`): contains the names of the index filenames that will be served when a directory containing an index file is requested. Usually, this will simply be `['index.html']`, but under different circumstances (when using IIS, for example), the array may have to be modified to include index filenames such as `default.html` or `index.xml`. Here’s an example middleware/application stack that uses custom index filenames:
45
+ - `index_filenames` (optional; defaults to `['index.html']`): contains the names of the index filenames that will be served when a directory containing an index file is requested. Usually, this will simply be `['index.html']`, but under different circumstances (when using IIS, for example), the array may have to be modified to include index filenames such as `default.html` or `index.xml`. Here’s an example middleware/application stack that uses custom index filenames:
47
46
 
48
- ```ruby
49
- use Adsf::Rack::IndexFileFinder,
50
- root: 'public',
51
- index_filenames: %w[index.html index.xhtml]
52
- run Rack::File.new('public')
53
- ```
47
+ ```ruby
48
+ use Adsf::Rack::IndexFileFinder,
49
+ root: 'public',
50
+ index_filenames: %w[index.html index.xhtml]
51
+ run Rack::Files.new('public')
52
+ ```
54
53
 
55
54
  **Why not use `Rack::Static`?** Rack comes with `Rack::Static`, whose purpose is similar to, but not the same as, `Adsf::Rack::IndexFileFinder`. In particular:
56
55
 
57
- * `Adsf::Rack::IndexFileFinder` does not serve files, unlike `Rack::Static`. `IndexFileFinder` only rewrites the incoming request and passes it on (usually to `Rack::File`).
56
+ - `Adsf::Rack::IndexFileFinder` does not serve files, unlike `Rack::Static`. `IndexFileFinder` only rewrites the incoming request and passes it on (usually to `Rack::Files`).
58
57
 
59
- * `Adsf::Rack::IndexFileFinder` supports multiple index files, while `Rack::Static` only supports one (you could have multiple `Rack::Static` middlewares, one for each index filenames, though).
58
+ - `Adsf::Rack::IndexFileFinder` supports multiple index files, while `Rack::Static` only supports one (you could have multiple `Rack::Static` middlewares, one for each index filenames, though).
60
59
 
61
- * `Rack::Static` will report the wrong filename on 404 pages: when requesting a directory without an index file, it will e.g. report “File not found: /index.html” rather than “File not found: /”.
60
+ - `Rack::Static` will report the wrong filename on 404 pages: when requesting a directory without an index file, it will e.g. report “File not found: /index.html” rather than “File not found: /”.
62
61
 
63
- * When requesting a directory without specifying the trailing slash, `Adsf::Rack::IndexFileFinder` will redirect to the URL with a trailing slash, unlike `Rack::Static`. This mimics the behavior of typical HTTP servers. For example, when requesting `/foo`, when a `foo` directory exists and it contains `index.html`, `IndexFileFinder` will redirect to `/foo/`.
62
+ - When requesting a directory without specifying the trailing slash, `Adsf::Rack::IndexFileFinder` will redirect to the URL with a trailing slash, unlike `Rack::Static`. This mimics the behavior of typical HTTP servers. For example, when requesting `/foo`, when a `foo` directory exists and it contains `index.html`, `IndexFileFinder` will redirect to `/foo/`.
64
63
 
65
64
  ### Server
66
65
 
@@ -78,16 +77,15 @@ server.run
78
77
 
79
78
  It takes the following options:
80
79
 
81
- * `root` (required): the path to the web root
82
- * `index_filenames` (optional; defaults to `['index.html']`): (see above)
83
- * `host` (optional; defaults to `'127.0.0.1'`): the address of the network interface to listen on
84
- * `port` (optional; defaults to `3000`): the port ot listen on
85
- * `handler` (optional): the Rack handler to use
80
+ - `root` (required): the path to the web root
81
+ - `index_filenames` (optional; defaults to `['index.html']`): (see above)
82
+ - `host` (optional; defaults to `'127.0.0.1'`): the address of the network interface to listen on
83
+ - `port` (optional; defaults to `3000`): the port ot listen on
84
+ - `handler` (optional): the Rack handler to use
86
85
 
87
- Contributors
88
- ------------
86
+ ## Contributors
89
87
 
90
- * Ed Brannin
91
- * Larissa Reis
92
- * Mark Meves
93
- * Vipul Amler
88
+ - Ed Brannin
89
+ - Larissa Reis
90
+ - Mark Meves
91
+ - Vipul Amler
@@ -11,7 +11,7 @@ module Adsf::Rack
11
11
 
12
12
  new_headers =
13
13
  headers.merge(
14
- 'Cache-Control' => 'max-age=0, stale-if-error=0',
14
+ 'cache-control' => 'max-age=0, stale-if-error=0',
15
15
  )
16
16
 
17
17
  [status, new_headers, body]
@@ -11,8 +11,8 @@ module Adsf::Rack
11
11
 
12
12
  new_headers =
13
13
  headers.merge(
14
- 'Access-Control-Allow-Origin' => '*',
15
- 'Access-Control-Allow-Headers' => 'Origin, X-Requested-With, Content-Type, Accept, Range',
14
+ 'access-control-allow-origin' => '*',
15
+ 'access-control-allow-headers' => 'Origin, X-Requested-With, Content-Type, Accept, Range',
16
16
  )
17
17
 
18
18
  [status, new_headers, body]
@@ -18,7 +18,7 @@ module Adsf::Rack
18
18
  new_path_info = env['PATH_INFO'] + '/'
19
19
  return [
20
20
  302,
21
- { 'Location' => new_path_info, 'Content-Type' => 'text/html' },
21
+ { 'location' => new_path_info, 'content-type' => 'text/html' },
22
22
  ["Redirecting you to #{new_path_info}…"],
23
23
  ]
24
24
  end
data/lib/adsf/server.rb CHANGED
@@ -63,18 +63,18 @@ module Adsf
63
63
 
64
64
  if is_live
65
65
  require 'adsf/live'
66
- use ::Rack::LiveReload, source: :vendored
66
+ use ::Rack::LiveReload, no_swf: true, source: :vendored
67
67
  end
68
68
 
69
- run ::Rack::File.new(root)
69
+ run ::Rack::Files.new(root)
70
70
  end.to_app
71
71
  end
72
72
 
73
73
  def build_handler
74
74
  if @handler
75
- ::Rack::Handler.get(@handler)
75
+ ::Rackup::Handler.get(@handler)
76
76
  else
77
- ::Rack::Handler.default
77
+ ::Rackup::Handler.default
78
78
  end
79
79
  end
80
80
  end
data/lib/adsf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Adsf
4
- VERSION = '1.4.6'
4
+ VERSION = '1.4.8'
5
5
  end
data/lib/adsf.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rack'
4
+ require 'rackup'
4
5
 
5
6
  module Adsf
6
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adsf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-16 00:00:00.000000000 Z
11
+ date: 2023-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 1.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 3.0.0
22
+ version: 4.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,21 @@ dependencies:
29
29
  version: 1.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 3.0.0
32
+ version: 4.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: rackup
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.1'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.1'
33
47
  description: A web server that can be spawned in any directory
34
48
  email: denis.defreyne@stoneship.org
35
49
  executables:
@@ -50,7 +64,8 @@ files:
50
64
  homepage: http://github.com/ddfreyne/adsf/
51
65
  licenses:
52
66
  - MIT
53
- metadata: {}
67
+ metadata:
68
+ rubygems_mfa_required: 'true'
54
69
  post_install_message:
55
70
  rdoc_options: []
56
71
  require_paths:
@@ -66,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
81
  - !ruby/object:Gem::Version
67
82
  version: '0'
68
83
  requirements: []
69
- rubygems_version: 3.2.17
84
+ rubygems_version: 3.4.20
70
85
  signing_key:
71
86
  specification_version: 4
72
87
  summary: a tiny static file server