directory_listing 0.0.1 → 0.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.
- data/lib/directory_listing.rb +8 -2
- metadata +2 -2
data/lib/directory_listing.rb
CHANGED
@@ -15,6 +15,7 @@ require 'filesize'
|
|
15
15
|
# "#{Directory_listing.list(
|
16
16
|
# :directory => path,
|
17
17
|
# :sinatra_public => settings.public_folder,
|
18
|
+
# :stylesheet => "stylesheets/styles.css",
|
18
19
|
# :should_list_invisibles => "no",
|
19
20
|
# :last_modified_format => "%Y-%m-%d %H:%M:%S",
|
20
21
|
# :dir_html_style => "bold",
|
@@ -35,6 +36,7 @@ require 'filesize'
|
|
35
36
|
#
|
36
37
|
# directory # the directory to list
|
37
38
|
# sinatra_public # sinatra's public folder - your public folder (and the default) is likely "settings.public_folder"
|
39
|
+
# stylesheet # pass a stylesheet to style the page with
|
38
40
|
# should_list_invisibles # should the directory listing include invisibles (dotfiles) - "yes" or "no"
|
39
41
|
# 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"
|
40
42
|
# dir_html_style # html style for directories - "bold", "italic", "underline", or "none" - defaults to "bold"
|
@@ -84,7 +86,11 @@ module Directory_listing
|
|
84
86
|
$filename_truncate_length = 40
|
85
87
|
end
|
86
88
|
|
87
|
-
html = "<html>\n<
|
89
|
+
html = "<html>\n<head>"
|
90
|
+
if options[:stylesheet]
|
91
|
+
html << "<link rel=\"stylesheet\" type=\"text/css\" href=\"/#{options[:stylesheet].sub(/^[\/]*/,"")}\">"
|
92
|
+
end
|
93
|
+
html << "</head>\n<body>"
|
88
94
|
html << "<h1>Index of #{options[:directory]}</h1>"
|
89
95
|
html << "<table>"
|
90
96
|
html << "<tr>\n<th>File</th>\n<th>Last modified</th>\n<th>Size</th>\n</tr>"
|
@@ -174,4 +180,4 @@ module Directory_listing
|
|
174
180
|
"#{wrapped}"
|
175
181
|
end
|
176
182
|
|
177
|
-
end
|
183
|
+
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.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Richard Myers
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2013-06-
|
13
|
+
date: 2013-06-25 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: filesize
|