madman 0.2.4 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8761538fd56beb2a8676fef5c492b833617a425932ede9b6c3e3faf151a7e0ba
4
- data.tar.gz: 5a2bb08578bd917cf42b3175b7198fd0c2e70c71911a412c884311cddeac51f7
3
+ metadata.gz: fea5fb59af24dad5a8f2da62bff33cc73b077fe35d48f06b0a2895bccf9884de
4
+ data.tar.gz: a696944e3f4a5daf6ab1f1d10ec0b330af01320267e8876125a152d739aa2dea
5
5
  SHA512:
6
- metadata.gz: 0a3d0275fc0d5306c4c31a7a35dc89cef6902e3ba42fdc7c464b5f6d3579918eab2b5724f21e8e13fe870f79fa81826aeb5bcc2c458ebb295189cba0c49e2fd3
7
- data.tar.gz: a8fa0793810b599585856faf5580faefd09388e4a9f1f0a33718dd32dbe4650f51442886ee64926d9455637b3dd2563393aa39e3b5f51d8ccfe779b666382f51
6
+ metadata.gz: ca89b4634cc7f5c8bc0df8e7868afcc73f4aeb878a4df3ff80b8627a7e572119ea17c1587f6813cee33d1a650c5ed23be87ff3b22fd87fd861933e0469ec944c
7
+ data.tar.gz: 4966565ceff228bdfbf57af9f89aef554a1a3a9d58170066139a17c9be560d80a04262a876b5218a5f3d1087a3e4406ce455b56f4415f417fdf8a70b5333c080
data/README.md CHANGED
@@ -2,9 +2,8 @@ Madman
2
2
  ==================================================
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/madman.svg)](https://badge.fury.io/rb/madman)
5
- [![Build Status](https://travis-ci.com/DannyBen/madman.svg?branch=master)](https://travis-ci.com/DannyBen/madman)
5
+ [![Build Status](https://github.com/DannyBen/madman/workflows/Test/badge.svg)](https://github.com/DannyBen/madman/actions?query=workflow%3ATest)
6
6
  [![Maintainability](https://api.codeclimate.com/v1/badges/506449ea988f5518425d/maintainability)](https://codeclimate.com/github/DannyBen/madman/maintainability)
7
- [![Test Coverage](https://api.codeclimate.com/v1/badges/506449ea988f5518425d/test_coverage)](https://codeclimate.com/github/DannyBen/madman/test_coverage)
8
7
 
9
8
 
10
9
  ---
@@ -4,7 +4,7 @@ require 'mister_bin'
4
4
  require 'octokit'
5
5
  require 'requires'
6
6
  require 'sinatra/base'
7
- require 'sinatra/reloader'
7
+ # require 'sinatra/reloader'
8
8
  require 'slim'
9
9
  require 'string-direction'
10
10
  require 'yaml'
@@ -19,7 +19,7 @@ module Madman
19
19
 
20
20
  def run
21
21
  dir = args['DIR']
22
- basedir = Madman::Directory.new dir, dir
22
+ basedir = Madman::Directory.new dir
23
23
 
24
24
  dirs = basedir.deep_list.select { |i| i.dir? }.map { |i| i.path }
25
25
  dirs.each do |dir|
@@ -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
- @doc = Document.from_file file
18
- slim :template
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
@@ -1,9 +1,9 @@
1
1
  module Madman
2
- # Represents a directory with markdown file sand subflders.
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
@@ -1,3 +1,5 @@
1
+ require 'addressable'
2
+
1
3
  module Madman
2
4
  class Item
3
5
  attr_reader :path, :type, :basedir
@@ -11,7 +13,7 @@ module Madman
11
13
  end
12
14
 
13
15
  def href
14
- URI.escape(path_without_extension.sub(/^#{basedir}\//, ''))
16
+ Addressable::URI.escape(path_without_extension.sub(/^#{basedir}\//, ''))
15
17
  end
16
18
 
17
19
  def dir?
@@ -0,0 +1,11 @@
1
+ module ArrayRefinements
2
+ refine Array do
3
+ def to_markdown
4
+ map { |item| "- #{item}"}.join "\n"
5
+ end
6
+
7
+ def to_html
8
+ CommonMarker.render_html to_markdown, :DEFAULT, [:table]
9
+ end
10
+ end
11
+ end
@@ -2,7 +2,7 @@ module Madman
2
2
  module Renderers
3
3
  class Default
4
4
  def self.render(text, opts={})
5
- CommonMarker.render_html text, :DEFAULT, [:table]
5
+ CommonMarker.render_html text, [:DEFAULT, :UNSAFE], [:table]
6
6
  end
7
7
  end
8
8
  end
@@ -4,10 +4,13 @@ module Madman
4
4
 
5
5
  Slim::Engine.set_options pretty: true
6
6
 
7
- configure :development do
8
- register Sinatra::Reloader
9
- also_reload "#{__dir__}/*.rb"
10
- end
7
+ # Reloader temporarily removed due to
8
+ # https://github.com/sinatra/sinatra/issues/1587
9
+ #
10
+ # configure :development do
11
+ # register Sinatra::Reloader
12
+ # also_reload "#{__dir__}/*.rb"
13
+ # end
11
14
 
12
15
  get '/favicon.ico' do
13
16
  end
@@ -1,3 +1,3 @@
1
1
  module Madman
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.10"
3
3
  end
@@ -1,8 +1,10 @@
1
1
  require 'madman/refinements/string'
2
+ require 'madman/refinements/array'
2
3
 
3
4
  module Madman
4
5
  class YAMLDoc
5
6
  using StringRefinements
7
+ using ArrayRefinements
6
8
 
7
9
  attr_reader :yaml, :title
8
10
 
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.10
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: 2018-12-13 00:00:00.000000000 Z
11
+ date: 2020-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.3
19
+ version: 2.0.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.3
26
+ version: 2.0.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: requires
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.17'
47
+ version: '0.20'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.17'
54
+ version: '0.20'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mister_bin
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,42 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.11'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.11'
83
- - !ruby/object:Gem::Dependency
84
- name: sinatra-contrib
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.0'
75
+ version: '4.0'
90
76
  type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '2.0'
82
+ version: '4.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: slim
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '3.0'
89
+ version: '4.0'
104
90
  type: :runtime
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '3.0'
96
+ version: '4.0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: colsole
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -142,28 +128,28 @@ dependencies:
142
128
  requirements:
143
129
  - - "~>"
144
130
  - !ruby/object:Gem::Version
145
- version: '4.9'
131
+ version: '4.14'
146
132
  type: :runtime
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
- version: '4.9'
138
+ version: '4.14'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: sass
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
143
  - - "~>"
158
144
  - !ruby/object:Gem::Version
159
- version: '3.6'
145
+ version: '3.7'
160
146
  type: :runtime
161
147
  prerelease: false
162
148
  version_requirements: !ruby/object:Gem::Requirement
163
149
  requirements:
164
150
  - - "~>"
165
151
  - !ruby/object:Gem::Version
166
- version: '3.6'
152
+ version: '3.7'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: coffee-script
169
155
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +164,20 @@ dependencies:
178
164
  - - "~>"
179
165
  - !ruby/object:Gem::Version
180
166
  version: '2.4'
167
+ - !ruby/object:Gem::Dependency
168
+ name: addressable
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '2.7'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '2.7'
181
181
  description: A command line utility for markdown fun
182
182
  email: db@dannyben.com
183
183
  executables:
@@ -202,6 +202,7 @@ files:
202
202
  - lib/madman/item.rb
203
203
  - lib/madman/navigation.rb
204
204
  - lib/madman/preview_server.rb
205
+ - lib/madman/refinements/array.rb
205
206
  - lib/madman/refinements/string.rb
206
207
  - lib/madman/renderers.rb
207
208
  - lib/madman/renderers/default.rb
@@ -231,8 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
232
  - !ruby/object:Gem::Version
232
233
  version: '0'
233
234
  requirements: []
234
- rubyforge_project:
235
- rubygems_version: 2.7.6
235
+ rubygems_version: 3.1.2
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: The Markdown Swiss Army Knife