fsws 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/lib/fsws/cli.rb +17 -2
- data/lib/fsws/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75850ea7f77eae7cb285f24874fa907f29f182d9
|
4
|
+
data.tar.gz: e0a93a9172d10cc1ba4071d9180e9b328ff2f3ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6d81c2a95bc2bfc4dcf2cfa9a96fcb179145fad7fc49fbbb7478c97bab408e36ba3723ac6f573358b030e58f82953e28ed8a16806b6a7bfe3ddb2a43427b9c8
|
7
|
+
data.tar.gz: 4d8257b3b014d2db55f5f3e4ea3141f95f80386c75d7b1a817f1d94b66af71afc3b2d61d9064235e318cfd962e93a17c4264d7467c143c4df20b3432fa240227
|
data/README.md
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
# fsws
|
2
2
|
|
3
|
-
A simple Ruby-based file system web server for serving static files from a directory
|
3
|
+
A simple Ruby-based file system web server for serving static files from a directory on OSX, Windows, or Linux.
|
4
4
|
|
5
|
+
It is intended for use in development for viewing statically-generated sites such as documentation (YARD), blogs (Jekyll), code coverage reports (SimpleCov), profiling reports, etc.
|
6
|
+
|
7
|
+
<br>
|
5
8
|
<div style="text-align:center" align="center">
|
6
9
|
<img src="https://github.com/schmich/fsws/raw/master/assets/demo.gif" />
|
7
10
|
</div>
|
11
|
+
<br>
|
12
|
+
|
13
|
+
Alternatives include `python -m SimpleHTTPServer`, nginx, and Apache.
|
8
14
|
|
9
15
|
## Usage
|
10
16
|
|
@@ -27,6 +33,12 @@ Allow external connections:
|
|
27
33
|
$ fsws -h 0.0.0.0
|
28
34
|
```
|
29
35
|
|
36
|
+
Serve files from another directory:
|
37
|
+
|
38
|
+
```
|
39
|
+
$ fsws -d ../foo
|
40
|
+
```
|
41
|
+
|
30
42
|
## License
|
31
43
|
|
32
44
|
Copyright © 2014 Chris Schmich
|
data/lib/fsws/cli.rb
CHANGED
@@ -5,9 +5,13 @@ require 'launchy'
|
|
5
5
|
|
6
6
|
module Fsws
|
7
7
|
class CommandLine < Thor
|
8
|
-
desc '[-h
|
8
|
+
desc '[-d <directory>] [-h <host>] [-p <port>] [-B]', 'Start server.'
|
9
|
+
long_desc <<-DESC
|
10
|
+
[-d|--dir <directory>] [-h|--host <host>] [-p|--port <port>] [-B|--no-browser]
|
11
|
+
DESC
|
9
12
|
option :port, type: :numeric, aliases: :p
|
10
|
-
option :host, type: :string, aliases: :
|
13
|
+
option :host, type: :string, aliases: :h
|
14
|
+
option :dir, type: :string, aliases: :d
|
11
15
|
option :'no-browser', type: :boolean, aliases: :B
|
12
16
|
option :version, type: :boolean, aliases: :v
|
13
17
|
def start
|
@@ -16,10 +20,21 @@ module Fsws
|
|
16
20
|
return
|
17
21
|
end
|
18
22
|
|
23
|
+
dir = options[:dir]
|
19
24
|
browser = !options[:'no-browser']
|
20
25
|
port = options[:port] || 9001
|
21
26
|
interface = options[:host] || '127.0.0.1'
|
22
27
|
|
28
|
+
if dir
|
29
|
+
path = File.absolute_path(dir)
|
30
|
+
if Dir.exist?(path)
|
31
|
+
Dir.chdir(path)
|
32
|
+
else
|
33
|
+
$stderr.puts "Directory does not exist: #{normalize(path)}."
|
34
|
+
exit 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
23
38
|
if Signal.list.key? 'QUIT'
|
24
39
|
Signal.trap('QUIT') do
|
25
40
|
puts 'Stopping...'
|
data/lib/fsws/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fsws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schmich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|