directory_listing 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/directory_listing.rb +7 -7
- metadata +3 -3
data/lib/directory_listing.rb
CHANGED
@@ -2,7 +2,7 @@ require 'truncate'
|
|
2
2
|
require 'filesize'
|
3
3
|
require 'pathname'
|
4
4
|
|
5
|
-
# = Easy Apache-
|
5
|
+
# = Easy, CSS-styled, Apache-like directory listings for Sinatra.
|
6
6
|
#
|
7
7
|
# == Usage
|
8
8
|
#
|
@@ -10,7 +10,7 @@ require 'pathname'
|
|
10
10
|
# app that will provide a directory listing of whatever path you navigate to
|
11
11
|
# and let you view any file that is served directly:
|
12
12
|
#
|
13
|
-
# require 'directory_listing
|
13
|
+
# require 'directory_listing'
|
14
14
|
#
|
15
15
|
# get '*' do |path|
|
16
16
|
# if File.exist?(File.join(settings.public_folder, path))
|
@@ -37,16 +37,15 @@ require 'pathname'
|
|
37
37
|
#
|
38
38
|
# directory # the directory to list
|
39
39
|
# sinatra_public # sinatra's public folder - your public folder (and the default) is likely "settings.public_folder"
|
40
|
-
# stylesheet #
|
41
|
-
#
|
40
|
+
# stylesheet # a stylesheet that will be added to the <head> of the generated directory listing
|
41
|
+
# readme # an HTML string that will be appended at the footer of the generated directory listing
|
42
|
+
# should_list_invisibles # whether the directory listing should include invisibles (dotfiles) - "yes" or "no"
|
42
43
|
# last_modified_format # format for last modified date (http://www.ruby-doc.org/core-2.0/Time.html) - defaults to "%Y-%m-%d %H:%M:%S"
|
43
44
|
# filename_truncate_length # (integer) length to truncate file names to - defaults to 40
|
44
45
|
#
|
45
46
|
# == Styling
|
46
47
|
#
|
47
|
-
# It's pretty easy to figure out how to style directory_listing by looking at the source
|
48
|
-
#
|
49
|
-
# Some gotchas:
|
48
|
+
# It's pretty easy to figure out how to style directory_listing by looking at the source, but here are some gotchas:
|
50
49
|
#
|
51
50
|
# Every item listed is a <td> element in a table. Directories will have a class of "dir" and regular files will have a class of "file".
|
52
51
|
#
|
@@ -114,6 +113,7 @@ module Directory_listing
|
|
114
113
|
html << wrap(file, dir, pub)
|
115
114
|
end
|
116
115
|
html << "\n</table>\n"
|
116
|
+
html << "<br>\n#{options[:readme]}\n" if options[:readme]
|
117
117
|
html << "</body>\n</html>\n"
|
118
118
|
"#{html}"
|
119
119
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: directory_listing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Richard Myers
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
version: 0.0.4
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id002
|
37
|
-
description: A gem to use with Sinatra for generating Apache-
|
37
|
+
description: A gem to use with Sinatra for generating Apache-like directory listings.
|
38
38
|
email: rick.myers@me.com
|
39
39
|
executables: []
|
40
40
|
|
@@ -70,6 +70,6 @@ rubyforge_project:
|
|
70
70
|
rubygems_version: 1.8.23
|
71
71
|
signing_key:
|
72
72
|
specification_version: 3
|
73
|
-
summary: Easy Apache-
|
73
|
+
summary: Easy, CSS-styled, Apache-like directory listings for Sinatra.
|
74
74
|
test_files: []
|
75
75
|
|