madman 0.2.5 → 0.2.11

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: f03708959711b24be068196ff0e96133fc15dcc35136e6300e3d78cb8d2f957a
4
- data.tar.gz: b1753b87269f8f25a2fed97b44cfbfda78bec9c0733ae81dfd282ec4472ddd83
3
+ metadata.gz: 8f8251e7ea7210aa7d7d18071e550366871dfe5ff3fb4f58fd4e523be579e673
4
+ data.tar.gz: e8c29ed93d986347eae430d30a9c761df7e25559a9f665f863e395d6fd9158b8
5
5
  SHA512:
6
- metadata.gz: 648da554fe12b84d3158b65275f060a161c21ed0c4e5d10fc6c6914bd25d13f6e59e8bbda87adc0cfce4d8ed938064564e1ecad626dadef3ebeddc1d40a9ad1d
7
- data.tar.gz: 6d2ccb0f913ea156f8b11965063b5a9b48c0b0a5ee65173e979ffc7d00e78116b529019e016c6f258ef97e7dbffd758823e39c8c1e603811a747ad3945d4e5b9
6
+ metadata.gz: e1de558ae55144664fcade27dc8d855b6a01b47d368aa7e3ff901c5f70b7c7cc6dd0bb7bf1acefa4f5371423f8c822d57b2054f8275fcb17cd455d587b9f851f
7
+ data.tar.gz: 6e3198e1069baa736e1a64c8f64a73cc09ca38a2f8a1031cae7463d1d4df6111b12d4476955b3e89eaa3f1348a7e45677c19891c153f8604554489935fcc9d7f
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.5"
2
+ VERSION = "0.2.11"
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.11
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: 2019-01-04 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.5
19
+ version: '2.0'
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.0'
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,28 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.11'
75
+ version: '5.1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
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.5
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 2.0.5
82
+ version: '5.1'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: slim
99
85
  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.4
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: The Markdown Swiss Army Knife