adsf 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +7 -1
- data/README.md +2 -0
- data/bin/adsf +6 -0
- data/lib/adsf.rb +2 -0
- data/lib/adsf/rack.rb +2 -0
- data/lib/adsf/rack/cors.rb +2 -0
- data/lib/adsf/rack/index_file_finder.rb +2 -0
- data/lib/adsf/server.rb +18 -1
- data/lib/adsf/version.rb +3 -1
- metadata +4 -8
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -61
- data/LICENSE +0 -19
- data/Rakefile +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d10dbc0c7655c4d10cfc4fd23f2c3dd4d80e6c39c2ea67f88e3ab85dcc38797
|
4
|
+
data.tar.gz: 428273f5866ac20c98e634d8a17fb4d2b79666e87620f5982205ebf062d59eb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c2f39e4e2e95d1a8e8800595b9e8efb50f1db75fca481f8f0c40a17b22fa138bac641c72edddcd9980c6a6c39f1a432afe9c1d8843c29f6ab88317b43bffd50
|
7
|
+
data.tar.gz: 03c8c274075be4b448c38dfa0a7d59c9790403d02f20693f9eaf52d858dfdd4d1d632b77e21d6edace1623eca076078bf82a37af074919fae02745c30fe518f1
|
data/NEWS.md
CHANGED
data/README.md
CHANGED
@@ -25,6 +25,8 @@ _adsf_ (**A** **D**ead **S**imple **F**ileserver) is a tiny static web server th
|
|
25
25
|
|
26
26
|
See `adsf --help` for details.
|
27
27
|
|
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-life` make it difficult to install under some circumstances.)
|
29
|
+
|
28
30
|
Using adsf programmatically
|
29
31
|
---------------------------
|
30
32
|
|
data/bin/adsf
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'optparse'
|
4
5
|
require 'adsf'
|
@@ -9,6 +10,7 @@ options = {
|
|
9
10
|
index_filenames: %w[index.html],
|
10
11
|
root: '.',
|
11
12
|
host: '0.0.0.0',
|
13
|
+
live: false,
|
12
14
|
}
|
13
15
|
|
14
16
|
OptionParser.new do |opts|
|
@@ -42,6 +44,10 @@ OptionParser.new do |opts|
|
|
42
44
|
opts.on('-a', '--listen-address [host]', 'Specify the address to listen to') do |o|
|
43
45
|
options[:host] = o
|
44
46
|
end
|
47
|
+
|
48
|
+
opts.on('-L', '--live-reload', 'Reload on changes (requires adsf-live)') do
|
49
|
+
options[:live] = true
|
50
|
+
end
|
45
51
|
end.parse!
|
46
52
|
|
47
53
|
server = Adsf::Server.new(options)
|
data/lib/adsf.rb
CHANGED
data/lib/adsf/rack.rb
CHANGED
data/lib/adsf/rack/cors.rb
CHANGED
data/lib/adsf/server.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Adsf
|
2
4
|
class Server
|
3
5
|
DEFAULT_HANDLER_NAME = :thin
|
4
6
|
|
5
|
-
def initialize(root:, index_filenames: ['index.html'], host: '127.0.0.1', port: 3000, handler: nil)
|
7
|
+
def initialize(root:, live: false, index_filenames: ['index.html'], host: '127.0.0.1', port: 3000, handler: nil)
|
6
8
|
@root = root
|
9
|
+
@live = live
|
7
10
|
@index_filenames = index_filenames
|
8
11
|
@host = host
|
9
12
|
@port = port
|
@@ -15,6 +18,7 @@ module Adsf
|
|
15
18
|
def run
|
16
19
|
handler = build_handler
|
17
20
|
app = build_app(root: @root, index_filenames: @index_filenames)
|
21
|
+
start_watcher if @live
|
18
22
|
|
19
23
|
url = "http://#{@host}:#{@port}/"
|
20
24
|
puts "View the site at #{url}"
|
@@ -30,6 +34,12 @@ module Adsf
|
|
30
34
|
|
31
35
|
private
|
32
36
|
|
37
|
+
def start_watcher
|
38
|
+
require 'adsf/live'
|
39
|
+
|
40
|
+
::Adsf::Live::Watcher.new(root_dir: File.absolute_path(@root)).tap(&:start)
|
41
|
+
end
|
42
|
+
|
33
43
|
def wait_for_stop_async(server)
|
34
44
|
Thread.new { wait_for_stop(server) }
|
35
45
|
end
|
@@ -40,6 +50,8 @@ module Adsf
|
|
40
50
|
end
|
41
51
|
|
42
52
|
def build_app(root:, index_filenames:)
|
53
|
+
is_live = @live
|
54
|
+
|
43
55
|
::Rack::Builder.new do
|
44
56
|
use ::Rack::CommonLogger
|
45
57
|
use ::Rack::ShowExceptions
|
@@ -50,6 +62,11 @@ module Adsf
|
|
50
62
|
root: root,
|
51
63
|
index_filenames: index_filenames
|
52
64
|
|
65
|
+
if is_live
|
66
|
+
require 'adsf/live'
|
67
|
+
use ::Rack::LiveReload, source: :vendored
|
68
|
+
end
|
69
|
+
|
53
70
|
run ::Rack::File.new(root)
|
54
71
|
end.to_app
|
55
72
|
end
|
data/lib/adsf/version.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
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -37,12 +37,8 @@ executables:
|
|
37
37
|
extensions: []
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
|
-
- Gemfile
|
41
|
-
- Gemfile.lock
|
42
|
-
- LICENSE
|
43
40
|
- NEWS.md
|
44
41
|
- README.md
|
45
|
-
- Rakefile
|
46
42
|
- bin/adsf
|
47
43
|
- lib/adsf.rb
|
48
44
|
- lib/adsf/rack.rb
|
@@ -60,9 +56,9 @@ require_paths:
|
|
60
56
|
- lib
|
61
57
|
required_ruby_version: !ruby/object:Gem::Requirement
|
62
58
|
requirements:
|
63
|
-
- - "
|
59
|
+
- - "~>"
|
64
60
|
- !ruby/object:Gem::Version
|
65
|
-
version: 2.
|
61
|
+
version: '2.3'
|
66
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
63
|
requirements:
|
68
64
|
- - ">="
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
adsf (1.3.1)
|
5
|
-
rack (>= 1.0.0, < 3.0.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
ast (2.3.0)
|
11
|
-
codecov (0.1.10)
|
12
|
-
json
|
13
|
-
simplecov
|
14
|
-
url
|
15
|
-
docile (1.1.5)
|
16
|
-
json (2.1.0)
|
17
|
-
m (1.5.1)
|
18
|
-
method_source (>= 0.6.7)
|
19
|
-
rake (>= 0.9.2.2)
|
20
|
-
method_source (0.9.0)
|
21
|
-
minitest (5.10.3)
|
22
|
-
parallel (1.12.0)
|
23
|
-
parser (2.4.0.2)
|
24
|
-
ast (~> 2.3)
|
25
|
-
powerpack (0.1.1)
|
26
|
-
rack (2.0.3)
|
27
|
-
rack-test (0.8.2)
|
28
|
-
rack (>= 1.0, < 3)
|
29
|
-
rainbow (2.2.2)
|
30
|
-
rake
|
31
|
-
rake (12.3.0)
|
32
|
-
rubocop (0.51.0)
|
33
|
-
parallel (~> 1.10)
|
34
|
-
parser (>= 2.3.3.1, < 3.0)
|
35
|
-
powerpack (~> 0.1)
|
36
|
-
rainbow (>= 2.2.2, < 3.0)
|
37
|
-
ruby-progressbar (~> 1.7)
|
38
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
39
|
-
ruby-progressbar (1.9.0)
|
40
|
-
simplecov (0.15.1)
|
41
|
-
docile (~> 1.1.0)
|
42
|
-
json (>= 1.8, < 3)
|
43
|
-
simplecov-html (~> 0.10.0)
|
44
|
-
simplecov-html (0.10.2)
|
45
|
-
unicode-display_width (1.3.0)
|
46
|
-
url (0.3.2)
|
47
|
-
|
48
|
-
PLATFORMS
|
49
|
-
ruby
|
50
|
-
|
51
|
-
DEPENDENCIES
|
52
|
-
adsf!
|
53
|
-
codecov
|
54
|
-
m
|
55
|
-
minitest
|
56
|
-
rack-test
|
57
|
-
rake
|
58
|
-
rubocop
|
59
|
-
|
60
|
-
BUNDLED WITH
|
61
|
-
1.16.0
|
data/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Copyright (c) 2009 Denis Defreyne
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
11
|
-
copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
-
SOFTWARE.
|
data/Rakefile
DELETED