madman 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/madman/commands/readme.rb +1 -1
- data/lib/madman/dir_server.rb +16 -2
- data/lib/madman/directory.rb +2 -2
- data/lib/madman/renderers/default.rb +1 -1
- data/lib/madman/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60c061af738d6d3b7230deb983106d9f7048a7e37f8eaf0c26d5aac99c41af9e
|
4
|
+
data.tar.gz: 9080e9b62319d7038f5847e49aa0bc799f7da36aa665e345e962b6e528449b36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c0144818df47c80e9e8758fb932cd1238eccea30615a68413e434d9b49da1d7b64e9ed02ab763c4214aa478e1d4a3d1f49a0e3634e83f83d30586c7914b121c
|
7
|
+
data.tar.gz: 934dbe15c427f51d1638b3aff0c9e653001f8eef3407133a62947232ab4305b57aafe82b9f8b50ad4314abf2512f1e8f213a01930377349396d3f95950156250
|
data/lib/madman/dir_server.rb
CHANGED
@@ -8,14 +8,28 @@ module Madman
|
|
8
8
|
@renderer = settings.respond_to?(:renderer) ? settings.renderer : :default
|
9
9
|
end
|
10
10
|
|
11
|
+
not_found do
|
12
|
+
content_type :text
|
13
|
+
"4O4 Not Found"
|
14
|
+
end
|
15
|
+
|
16
|
+
get '/favicon.ico' do
|
17
|
+
content_type :text
|
18
|
+
'(oOo)'
|
19
|
+
end
|
20
|
+
|
11
21
|
get '/*' do
|
12
22
|
path = params[:splat].first
|
13
23
|
|
14
24
|
type, file = find_file(path)
|
15
25
|
redirect "#{path}/" if type == :dir and path[-1] != '/'
|
16
26
|
|
17
|
-
|
18
|
-
|
27
|
+
if File.exist? file
|
28
|
+
@doc = Document.from_file file
|
29
|
+
slim :template
|
30
|
+
else
|
31
|
+
halt 404
|
32
|
+
end
|
19
33
|
end
|
20
34
|
|
21
35
|
private
|
data/lib/madman/directory.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Madman
|
2
|
-
# Represents a directory with markdown
|
2
|
+
# Represents a directory with markdown files and subflders.
|
3
3
|
class Directory
|
4
4
|
attr_reader :dir, :basedir
|
5
5
|
|
6
|
-
def initialize(dir, basedir=nil)
|
6
|
+
def initialize(dir, basedir = nil)
|
7
7
|
@dir = dir
|
8
8
|
@basedir = basedir || dir
|
9
9
|
end
|
data/lib/madman/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: madman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|