madman 0.2.7 → 0.2.12

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: 59b6c7012665541c932e1e93a168b95432aeda6574dade5fa7677ae08483e4cc
4
- data.tar.gz: 798abf76013f4de440598743540f8fe498150cf2939069f59a9991afbf4424c8
3
+ metadata.gz: '045932758c95c7094714d6880c66c33a9ce3179627acc6fb23fa9dc3cb8c4f9d'
4
+ data.tar.gz: 5743a5f22be0d49e57aee5611902dfebd24e84b5f845e2d9ec64d2cb3c07315f
5
5
  SHA512:
6
- metadata.gz: 5aa1d60871b3ae30ff102e83056f9b747141d9742af08462c4ea7d969783a591cdbaf4469e342c35f66ba9c7cd14e721f40c5437d2fadd4cef092b62e7c0de63
7
- data.tar.gz: 461e2f3f7bf6007b7c531c1673abe8ef0c8123ab20d2c3ce68ff4f50a0681dbafc07c7c3d891c4e5295d3d0c17e99be61e7c0e3a05f37301fc477f1832e15319
6
+ metadata.gz: 0e0afe77b7a85c9818870947784f219aebbfc0de5807fc55011d15ca6d8aec449bfb6cdfecc6e80071ca172e9e1bb77dca748e8b396bc674471b543479ce3a7c
7
+ data.tar.gz: e510a0cd32153ad6e5ec29cd38fb6d094d1485fe1f13403cbf15b8939b0011fc093f25d6f211367c9b45129c5b877383f2d3cbcd3d3ce2f9e6aa3584ec4f573e
data/README.md CHANGED
@@ -2,7 +2,7 @@ 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
7
 
8
8
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Madman
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.12"
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,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.12
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-01-10 00:00:00.000000000 Z
11
+ date: 2020-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: sinatra
14
+ name: addressable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.5
19
+ version: '2.7'
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.5
26
+ version: '2.7'
27
27
  - !ruby/object:Gem::Dependency
28
- name: requires
28
+ name: coffee-script
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: '2.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
40
+ version: '2.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: colsole
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.5'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: commonmarker
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,103 +81,103 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0.6'
69
83
  - !ruby/object:Gem::Dependency
70
- name: puma
84
+ name: octokit
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '4.0'
89
+ version: '4.14'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '4.0'
96
+ version: '4.14'
83
97
  - !ruby/object:Gem::Dependency
84
- name: slim
98
+ name: puma
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '4.0'
103
+ version: '5.1'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '4.0'
110
+ version: '5.1'
97
111
  - !ruby/object:Gem::Dependency
98
- name: colsole
112
+ name: requires
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '0.5'
117
+ version: '0.1'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '0.5'
124
+ version: '0.1'
111
125
  - !ruby/object:Gem::Dependency
112
- name: string-direction
126
+ name: sassc
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: '1.2'
131
+ version: '2.4'
118
132
  type: :runtime
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: '1.2'
138
+ version: '2.4'
125
139
  - !ruby/object:Gem::Dependency
126
- name: octokit
140
+ name: sinatra
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '4.14'
145
+ version: '2.0'
132
146
  type: :runtime
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '4.14'
152
+ version: '2.0'
139
153
  - !ruby/object:Gem::Dependency
140
- name: sass
154
+ name: slim
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '3.7'
159
+ version: '4.0'
146
160
  type: :runtime
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '3.7'
166
+ version: '4.0'
153
167
  - !ruby/object:Gem::Dependency
154
- name: coffee-script
168
+ name: string-direction
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - "~>"
158
172
  - !ruby/object:Gem::Version
159
- version: '2.4'
173
+ version: '1.2'
160
174
  type: :runtime
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: '2.4'
180
+ version: '1.2'
167
181
  description: A command line utility for markdown fun
168
182
  email: db@dannyben.com
169
183
  executables:
@@ -188,6 +202,7 @@ files:
188
202
  - lib/madman/item.rb
189
203
  - lib/madman/navigation.rb
190
204
  - lib/madman/preview_server.rb
205
+ - lib/madman/refinements/array.rb
191
206
  - lib/madman/refinements/string.rb
192
207
  - lib/madman/renderers.rb
193
208
  - lib/madman/renderers/default.rb
@@ -217,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
232
  - !ruby/object:Gem::Version
218
233
  version: '0'
219
234
  requirements: []
220
- rubygems_version: 3.0.3
235
+ rubygems_version: 3.1.4
221
236
  signing_key:
222
237
  specification_version: 4
223
238
  summary: The Markdown Swiss Army Knife