servdir 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = servdir
2
2
 
3
- Quickly and easily serve a directory or file over HTTP.
3
+ Quickly serve a directory or file over HTTP.
4
4
 
5
5
  == Contributing to servdir
6
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/bin/servdir CHANGED
@@ -1,22 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Serves a directory over HTTP
4
- # The main purpose of this script is to temporarily serve videos
5
- # for streaming. Just hit <ctrl-c> to exit.
3
+ # Serves a directory or file over HTTP.
4
+ # Just hit <ctrl-c> to exit.
6
5
 
7
6
  require 'optparse'
8
7
  require 'servdir'
9
8
 
10
9
  options = {}
11
10
  cliopts = OptionParser.new do |opts|
12
- opts.banner = "\nUse Webrick to serve a directory or a file over HTTP \n
13
- Usage: servdir.rb [-d dir] [-p port]"
11
+ opts.banner = "\nServdir uses Thin to serve a directory over HTTP\n"
14
12
  opts.separator ""
15
13
  opts.separator "Options:"
16
14
 
17
15
  options[:dir] = Dir.pwd
18
- opts.on("-d [dir]", "--directory [dir]", String,
19
- "The directory you want to serve. You can also serve a single file.") do |d|
16
+ opts.on("-d [dir|file]", "--directory [dir|file]", String,
17
+ "The directory or file you want to serve.") do |d|
20
18
  options[:dir] = d
21
19
  end
22
20
 
data/lib/servdir.rb CHANGED
@@ -11,7 +11,11 @@ class Servdir
11
11
  def initialize(dir, port)
12
12
  Thin::Server.start("0.0.0.0", port) do
13
13
  #use Rack::CommonLogger
14
- run Rack::Directory.new(dir)
14
+ if File.directory?(dir)
15
+ run Rack::Directory.new(dir)
16
+ elsif File.file?(dir)
17
+ run Rack::File.new(dir)
18
+ end
15
19
  end
16
20
  end
17
21
  end
data/servdir.gemspec ADDED
@@ -0,0 +1,68 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "servdir"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Doug P."]
12
+ s.date = "2014-04-23"
13
+ s.description = "Quickly and easily serve a directory or file over HTTP."
14
+ s.email = "dougtko@gmail.com"
15
+ s.executables = ["servdir"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".rspec",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.rdoc",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "bin/servdir",
30
+ "lib/servdir.rb",
31
+ "servdir.gemspec",
32
+ "spec/servdir_spec.rb",
33
+ "spec/spec_helper.rb"
34
+ ]
35
+ s.homepage = "http://github.com/dougsko/servdir"
36
+ s.licenses = ["MIT"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = "1.8.23"
39
+ s.summary = "Quickly and easily serve a directory or file over HTTP."
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_runtime_dependency(%q<thin>, [">= 0"])
46
+ s.add_runtime_dependency(%q<rack>, [">= 0"])
47
+ s.add_development_dependency(%q<rspec>, [">= 0"])
48
+ s.add_development_dependency(%q<bundler>, [">= 0"])
49
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
50
+ s.add_development_dependency(%q<rake>, [">= 0"])
51
+ else
52
+ s.add_dependency(%q<thin>, [">= 0"])
53
+ s.add_dependency(%q<rack>, [">= 0"])
54
+ s.add_dependency(%q<rspec>, [">= 0"])
55
+ s.add_dependency(%q<bundler>, [">= 0"])
56
+ s.add_dependency(%q<jeweler>, [">= 0"])
57
+ s.add_dependency(%q<rake>, [">= 0"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<thin>, [">= 0"])
61
+ s.add_dependency(%q<rack>, [">= 0"])
62
+ s.add_dependency(%q<rspec>, [">= 0"])
63
+ s.add_dependency(%q<bundler>, [">= 0"])
64
+ s.add_dependency(%q<jeweler>, [">= 0"])
65
+ s.add_dependency(%q<rake>, [">= 0"])
66
+ end
67
+ end
68
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servdir
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-27 00:00:00.000000000 Z
12
+ date: 2014-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thin
@@ -126,6 +126,7 @@ files:
126
126
  - VERSION
127
127
  - bin/servdir
128
128
  - lib/servdir.rb
129
+ - servdir.gemspec
129
130
  - spec/servdir_spec.rb
130
131
  - spec/spec_helper.rb
131
132
  homepage: http://github.com/dougsko/servdir
@@ -143,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
144
  version: '0'
144
145
  segments:
145
146
  - 0
146
- hash: 3281873461375501607
147
+ hash: -685362197271554329
147
148
  required_rubygems_version: !ruby/object:Gem::Requirement
148
149
  none: false
149
150
  requirements: