adsf 1.4.6 → 1.4.7
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/NEWS.md +6 -0
- data/README.md +37 -39
- data/lib/adsf/rack/caching.rb +1 -1
- data/lib/adsf/rack/cors.rb +2 -2
- data/lib/adsf/rack/index_file_finder.rb +1 -1
- data/lib/adsf/server.rb +3 -3
- data/lib/adsf/version.rb +1 -1
- data/lib/adsf.rb +1 -0
- metadata +21 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd19b64a645ae62ffcc22dcf97cf5cb98d4ce756583755631646e03e369740a4
|
4
|
+
data.tar.gz: aa88b49a59830d4298cf5b634258010d6b1d0757a4192de2a1fae156c81bf0af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c82f31a29d08c8d30e349e2e37188343516ae8dfe924aa96f027f55bb22553a6c521d40335bc20668e1190abcc8e662aeb0f920e0eca247e6d9cf2b6f3ee8f45
|
7
|
+
data.tar.gz: 4ad549207aecfff4ac26468c63e5ec58a8971f8fd7b3db6179cf4c1783f266e16cfaaa4f2cc491bbe5b03e2f79c91befa251f07a224715aef8b2db3c2071e3a5
|
data/NEWS.md
CHANGED
data/README.md
CHANGED
@@ -2,24 +2,24 @@
|
|
2
2
|
[](http://rubygems.org/gems/adsf)
|
3
3
|
[](https://travis-ci.org/ddfreyne/adsf)
|
4
4
|
[](https://codeclimate.com/github/ddfreyne/adsf)
|
5
|
-
[](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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
|
@@ -41,26 +40,26 @@ run Rack::File.new('public')
|
|
41
40
|
|
42
41
|
It takes the following options:
|
43
42
|
|
44
|
-
|
43
|
+
- `root` (required): the path to the web root
|
45
44
|
|
46
|
-
|
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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
```ruby
|
48
|
+
use Adsf::Rack::IndexFileFinder,
|
49
|
+
root: 'public',
|
50
|
+
index_filenames: %w[index.html index.xhtml]
|
51
|
+
run Rack::File.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
|
-
|
56
|
+
- `Adsf::Rack::IndexFileFinder` does not serve files, unlike `Rack::Static`. `IndexFileFinder` only rewrites the incoming request and passes it on (usually to `Rack::File`).
|
58
57
|
|
59
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
- Ed Brannin
|
89
|
+
- Larissa Reis
|
90
|
+
- Mark Meves
|
91
|
+
- Vipul Amler
|
data/lib/adsf/rack/caching.rb
CHANGED
data/lib/adsf/rack/cors.rb
CHANGED
@@ -11,8 +11,8 @@ module Adsf::Rack
|
|
11
11
|
|
12
12
|
new_headers =
|
13
13
|
headers.merge(
|
14
|
-
'
|
15
|
-
'
|
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
|
-
{ '
|
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,7 +63,7 @@ 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
69
|
run ::Rack::File.new(root)
|
@@ -72,9 +72,9 @@ module Adsf
|
|
72
72
|
|
73
73
|
def build_handler
|
74
74
|
if @handler
|
75
|
-
::
|
75
|
+
::Rackup::Handler.get(@handler)
|
76
76
|
else
|
77
|
-
::
|
77
|
+
::Rackup::Handler.default
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
data/lib/adsf/version.rb
CHANGED
data/lib/adsf.rb
CHANGED
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.
|
4
|
+
version: 1.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-18 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:
|
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:
|
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.
|
84
|
+
rubygems_version: 3.4.8
|
70
85
|
signing_key:
|
71
86
|
specification_version: 4
|
72
87
|
summary: a tiny static file server
|