sinfile 0.1.1

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.
Files changed (3) hide show
  1. data/README.txt +12 -0
  2. data/bin/sinfile +24 -0
  3. metadata +65 -0
@@ -0,0 +1,12 @@
1
+ = SinFile
2
+
3
+ Sinatra File Server.
4
+
5
+ Just run "sinfile" in the current directory and you're done. Point
6
+ your browser at http://localhost:4567 to see your files.
7
+
8
+ Choose a different port with -p, e.g. "sinfile -p 80".
9
+
10
+ = Installation
11
+
12
+ sudo gem install dbrady-sinfile
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if defined?(Gem)
4
+ gem 'sinatra'
5
+ end
6
+ require 'sinatra'
7
+
8
+
9
+ configure do
10
+ set :public, File.expand_path('.')
11
+ end
12
+
13
+ get '*' do
14
+ dir = File.expand_path(File.join('.', params["splat"]))
15
+ if File.directory?(dir)
16
+ str = ''
17
+ str += "<h2>Index of '#{params['splat']}'</h2>"
18
+ str += "<ul>"
19
+ str += "<li><a href=\"#{File.split(params['splat'][0])[0]}\">..</a</li>\n" unless params['splat'] == ['/']
20
+ str += (Dir[File.join(dir, '*')].map{|p| p + ('/' if File.directory?(p)).to_s}.map{|p| p.sub(%r{^#{dir}/}, '')}.map {|p| "<li><a href=\"#{File.join(params['splat'],p)}\">#{p}</a>"} * "\n") + "</ul>"
21
+ else
22
+ "<h1>Path #{dir} does not exist</h1>"
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinfile
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - David Brady
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-25 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: SinFile - Simple file server using Sinatra
26
+ email: github@shinybit.com
27
+ executables:
28
+ - sinfile
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.txt
33
+ files:
34
+ - bin/sinfile
35
+ - README.txt
36
+ has_rdoc: true
37
+ homepage: http://github.com/dbrady/sinfile
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.3.5
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Simple file server using Sinatra
64
+ test_files: []
65
+