fsws 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: eb3adc7ce6bbb6903fb4e0721b82cddff4611077
4
- data.tar.gz: 7687c47f5d6d50fa84011596aa5e94dadbdf1dfb
3
+ metadata.gz: 75850ea7f77eae7cb285f24874fa907f29f182d9
4
+ data.tar.gz: e0a93a9172d10cc1ba4071d9180e9b328ff2f3ac
5
5
  SHA512:
6
- metadata.gz: 54a52a05cf7bca7c3662b72db44ed73310fcc6b3b1fff776e5979287d52e0cdb509c765cf3635263545816f70083285d25474633e788800c9d7fb7d803ecde52
7
- data.tar.gz: c15b1eda161fd3813e3244c4bb94ee6a7931a8d758fd040b341dc10f97d8eb6c2da8f429270d6538c66bd52f4b320397a0d9cfef660698a2135f9e9c36e064d0
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. Works on OSX, Windows, and Linux.
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 &copy; 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|--host <host>] [-p|--port <port>] [-B|--no-browser]', 'Start server.'
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: :host
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
@@ -1,3 +1,3 @@
1
1
  module Fsws
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
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.1
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-03 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack