madman 0.2.13 → 0.3.0

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: e903e1b104d4ba3116f70598163bee37ee0b505b0379fc05ce7576bfa0cff08a
4
- data.tar.gz: 0b78baff59ac6402d4f927ff1035e7477058c49fb52f25c80de9c189d3b895e7
3
+ metadata.gz: '039309eaa86e5f877b526211a472e1633d159880d76f6671e10defe0174b0282'
4
+ data.tar.gz: feb72279e624edb0bd5eb8a843068146d91104dbd9b3d9875521573574a2332b
5
5
  SHA512:
6
- metadata.gz: c6f8e62beb90d8c27c7d133a40bcee0aa77efe73ffac5355f114633ca6998cd6f2e00ff2c53e755f0d0039228fdb706bcfe5b36c34c1434fbdddde89e45bfa18
7
- data.tar.gz: 8f065cfda51843ff01c036e8958d5953a6b6c69b9773dc0d18cb0c3abf29690a658c1755a10e8ee994365faf25a8541b19dd593fbfe86729a5699f25f79bee1e
6
+ metadata.gz: 97c8e85dfa09c26cb4688cb0a90fbb14a572c7bd5487b7d1eaf4c2e87adc7a5f35590fe9f5b6a0261190f2d4b591a56da20c31aad018560345f540471707bcf6
7
+ data.tar.gz: ed9d05c52593d1e9c1286d2997cc531a9b935d32a0efc299e7835f04fedd182293f22d7407152d13a5a288df3564d1873ab4848710d552fc0d2a30d4c219b034
data/README.md CHANGED
@@ -36,8 +36,7 @@ Features
36
36
  - [ ] Ad-hoc server to allow editing of a local markdown file.
37
37
  - [x] Markdown generation with GitHub API (optional).
38
38
  - [x] Table of Contents generation for a folder of markdown files.
39
- - [x] Web server for an entire folder (like [Madness][1]) with GitHub Pages
40
- compatibility.
39
+ - [x] Web server for an entire folder (like [Madness][1]) with GitHub Pages compatibility.
41
40
  - [x] Automatic detection of Right-to-Left markdown files for HTML rendering.
42
41
  - [x] Generate navigation README in folders without one.
43
42
  - [x] Convert YAML file to an interactive HTML with collapsible sections.
data/bin/madman CHANGED
@@ -12,4 +12,4 @@ rescue => e
12
12
  puts e.backtrace.reverse if ENV['DEBUG']
13
13
  say! "!txtred!#{e.class}: #{e.message}"
14
14
  exit 1
15
- end
15
+ end
data/lib/madman/cli.rb CHANGED
@@ -14,5 +14,4 @@ module Madman
14
14
  runner
15
15
  end
16
16
  end
17
-
18
17
  end
@@ -5,26 +5,29 @@ module Madman
5
5
  class Nav < MisterBin::Command
6
6
  include Colsole
7
7
 
8
- summary "Add site-wide navigation links to README files"
8
+ summary 'Add site-wide navigation links to README files'
9
9
 
10
- help "This command generates a Table of Contents for a directory, and injects it to a file. In addition, it supports recursive execution, which will add a Table of Contents to all README files (or a filename of your choice) in all the subfolders, creating nagigation pages for an entire Markdown site."
10
+ help 'This command generates a Table of Contents for a directory, and injects it to a ' \
11
+ 'file. In addition, it supports recursive execution, which will add a Table of Contents ' \
12
+ 'to all README files (or a filename of your choice) in all the subfolders, creating ' \
13
+ 'nagigation pages for an entire Markdown site.'
11
14
 
12
- usage "madman nav DIR [options]"
13
- usage "madman nav (-h|--help)"
15
+ usage 'madman nav DIR [options]'
16
+ usage 'madman nav (-h|--help)'
14
17
 
15
- option "-f --force", "Inject TOC to all README files, even if they do not have a marker"
16
- option "-m --marker TEXT", "Look for an HTML comment with <!-- TEXT --> [default: nav]"
17
- option "-d --depth N", "The depth of the table of contents [default: 1]"
18
- option "-v --verbose", "Show the updated README content"
19
- option "-t --target NAME", "Set the target filename to look for. [default: README.md]"
20
- option "-r --recursive", "Inject to all target files"
21
- option "-y --dry", "Do not save the updated files, just show what will happen"
18
+ option '-f --force', 'Inject TOC to all README files, even if they do not have a marker'
19
+ option '-m --marker TEXT', 'Look for an HTML comment with <!-- TEXT --> [default: nav]'
20
+ option '-d --depth N', 'The depth of the table of contents [default: 1]'
21
+ option '-v --verbose', 'Show the updated README content'
22
+ option '-t --target NAME', 'Set the target filename to look for. [default: README.md]'
23
+ option '-r --recursive', 'Inject to all target files'
24
+ option '-y --dry', 'Do not save the updated files, just show what will happen'
22
25
 
23
- param "DIR", "The directory containing markdown files"
26
+ param 'DIR', 'The directory containing markdown files'
24
27
 
25
- example "madman nav"
26
- example "madman nav path/to/docs --force --marker toc"
27
- example "madman nav path/to/docs --dry -v -d2"
28
+ example 'madman nav'
29
+ example 'madman nav path/to/docs --force --marker toc'
30
+ example 'madman nav path/to/docs --dry -v -d2'
28
31
 
29
32
  def run
30
33
  if recursive?
@@ -33,7 +36,7 @@ module Madman
33
36
  update_file "#{dir}/#{target}"
34
37
  end
35
38
 
36
- say dry? ? "Done (dry mode, no changes were made)" : "Done"
39
+ say dry? ? 'Done (dry mode, no changes were made)' : 'Done'
37
40
  end
38
41
 
39
42
  def update_file(file)
@@ -45,7 +48,7 @@ module Madman
45
48
 
46
49
  if verbose?
47
50
  say word_wrap " !txtblu!#{doc.text}"
48
- say ""
51
+ say ''
49
52
  end
50
53
 
51
54
  doc.save unless dry?
@@ -53,15 +56,14 @@ module Madman
53
56
 
54
57
  # CLI Arguments
55
58
 
56
- def dir; args['DIR'] || '.'; end
57
- def depth; args['--depth'].to_i; end
58
- def marker; args['--marker']; end
59
- def target; args['--target']; end
60
- def force?; args['--force']; end
61
- def dry?; args['--dry']; end
62
- def verbose?; args['--verbose']; end
63
- def recursive?; args['--recursive']; end
64
-
59
+ def dir = args['DIR'] || '.'
60
+ def depth = args['--depth'].to_i
61
+ def marker = args.[]('--marker')
62
+ def target = args.[]('--target')
63
+ def force? = args.[]('--force')
64
+ def dry? = args.[]('--dry')
65
+ def verbose? = args.[]('--verbose')
66
+ def recursive? = args.[]('--recursive')
65
67
  end
66
68
  end
67
69
  end
@@ -3,23 +3,28 @@ module Madman
3
3
  class Preview < MisterBin::Command
4
4
  include Colsole
5
5
 
6
- summary "Serve a markdown or YAML file using a local server"
6
+ summary 'Serve a markdown or YAML file using a local server'
7
7
 
8
- help "This command will start a local server with two endpoints:\n / will render the markdown with the default renderer\n /github will render with the GitHub API"
8
+ help <<~USAGE
9
+ This command will start a local server with two endpoints:
10
+ / will render the markdown with the default renderer
11
+ /github will render with the GitHub API
12
+ USAGE
9
13
 
10
- usage "madman preview FILE [--port N --bind ADDRESS]"
11
- usage "madman preview (-h|--help)"
14
+ usage 'madman preview FILE [--port N --bind ADDRESS]'
15
+ usage 'madman preview (-h|--help)'
12
16
 
13
- option "-p --port N", "Set server port [default: 3000]"
14
- option "-b --bind ADDRESS", "Set server listen address [default: 0.0.0.0]"
17
+ option '-p --port N', 'Set server port [default: 3000]'
18
+ option '-b --bind ADDRESS', 'Set server listen address [default: 0.0.0.0]'
15
19
 
16
- param "FILE", "The input markdown or YAML file"
20
+ param 'FILE', 'The input markdown or YAML file'
17
21
 
18
- environment "GITHUB_ACCESS_TOKEN", "Your GitHub API access token\nRequired only if you wish to use the '/github' endpoint\nGenerate one here: https://github.com/settings/tokens"
22
+ environment 'GITHUB_ACCESS_TOKEN',
23
+ "Your GitHub API access token\nRequired only if you wish to use the '/github' endpoint\nGenerate one here: https://github.com/settings/tokens"
19
24
 
20
- example "madman preview README.md"
21
- example "madman preview README.md -p4000"
22
- example "madman preview file.yml"
25
+ example 'madman preview README.md'
26
+ example 'madman preview README.md -p4000'
27
+ example 'madman preview file.yml'
23
28
 
24
29
  def run
25
30
  file = args['FILE']
@@ -35,8 +40,6 @@ module Madman
35
40
  Madman::PreviewServer.set bind: bind, port: port, file: file
36
41
  Madman::PreviewServer.run!
37
42
  end
38
-
39
43
  end
40
44
  end
41
45
  end
42
-
@@ -3,28 +3,29 @@ module Madman
3
3
  class Readme < MisterBin::Command
4
4
  include Colsole
5
5
 
6
- summary "Create README in all qualified sub directories"
6
+ summary 'Create README in all qualified sub directories'
7
7
 
8
- help "This command generates README.md files in all subdirectories. Each file will receive an H1 caption with the name of the folder it resides in. This command is designed to assist in preparing a folder for table of contents injection."
8
+ help 'This command generates README.md files in all subdirectories. Each file will receive ' \
9
+ 'an H1 caption with the name of the folder it resides in. This command is designed to ' \
10
+ 'assist in preparing a folder for table of contents injection.'
9
11
 
10
- usage "madman readme DIR [--dry]"
11
- usage "madman readme (-h|--help)"
12
+ usage 'madman readme DIR [--dry]'
13
+ usage 'madman readme (-h|--help)'
12
14
 
13
- option "-y --dry", "Only show what will be created, don't make any changes"
15
+ option '-y --dry', "Only show what will be created, don't make any changes"
14
16
 
15
- param "DIR", "The directory containing markdown files"
17
+ param 'DIR', 'The directory containing markdown files'
16
18
 
17
- example "madman readme ."
18
- example "madman readme path/to/docs --dry"
19
+ example 'madman readme .'
20
+ example 'madman readme path/to/docs --dry'
19
21
 
20
22
  def run
21
- dir = args['DIR']
22
- basedir = Madman::Directory.new dir
23
+ basedir = Madman::Directory.new args['DIR']
23
24
 
24
- dirs = basedir.deep_list.select { |i| i.dir? }.map { |i| i.path }
25
+ dirs = basedir.deep_list.select(&:dir?).map(&:path)
25
26
  dirs.each do |dir|
26
27
  file = "#{dir}/README.md"
27
-
28
+
28
29
  if File.exist? file
29
30
  say "Skipping #{file}"
30
31
  else
@@ -34,10 +35,8 @@ module Madman
34
35
  end
35
36
  end
36
37
 
37
- say args['--dry'] ? "Done (dry mode, no changes were made)" : "Done"
38
+ say args['--dry'] ? 'Done (dry mode, no changes were made)' : 'Done'
38
39
  end
39
-
40
40
  end
41
41
  end
42
42
  end
43
-
@@ -3,22 +3,22 @@ module Madman
3
3
  class Render < MisterBin::Command
4
4
  include Colsole
5
5
 
6
- help "Render markdown or YAML to HTML"
6
+ help 'Render markdown or YAML to HTML'
7
7
 
8
- usage "madman render FILE [--github --save OUTFILE]"
9
- usage "madman render (-h|--help)"
8
+ usage 'madman render FILE [--github --save OUTFILE]'
9
+ usage 'madman render (-h|--help)'
10
10
 
11
- option "--github", "Render using the GitHub API\nRequires setting the GITHUB_ACCESS_TOKEN environment variable"
12
- option "--save OUTFILE", "Save the output to a file"
11
+ option '--github', "Render using the GitHub API\nRequires setting the GITHUB_ACCESS_TOKEN environment variable"
12
+ option '--save OUTFILE', 'Save the output to a file'
13
13
 
14
- param "FILE", "The input markdown or YAML file"
14
+ param 'FILE', 'The input markdown or YAML file'
15
15
 
16
- environment "GITHUB_ACCESS_TOKEN", "Your GitHub API access token\nGenerate one here: https://github.com/settings/tokens"
16
+ environment 'GITHUB_ACCESS_TOKEN', "Your GitHub API access token\nGenerate one here: https://github.com/settings/tokens"
17
17
 
18
- example "madman render README.md"
19
- example "madman render README.md --github"
20
- example "madman render README.md --save out.html"
21
- example "madman render file.yml --save out.html"
18
+ example 'madman render README.md'
19
+ example 'madman render README.md --github'
20
+ example 'madman render README.md --save out.html'
21
+ example 'madman render file.yml --save out.html'
22
22
 
23
23
  def run
24
24
  infile = args['FILE']
@@ -26,18 +26,16 @@ module Madman
26
26
  renderer = args['--github'] ? :github : :default
27
27
 
28
28
  doc = Madman::Document.from_file infile
29
-
29
+
30
30
  output = doc.render renderer
31
31
 
32
32
  if outfile
33
- File.write outfile, output
33
+ File.write outfile, output
34
34
  say "Saved !txtgrn!#{outfile}"
35
35
  else
36
36
  puts output
37
37
  end
38
38
  end
39
-
40
39
  end
41
40
  end
42
41
  end
43
-
@@ -3,21 +3,22 @@ module Madman
3
3
  class Serve < MisterBin::Command
4
4
  include Colsole
5
5
 
6
- summary "Serve a markdown directory using a local server"
6
+ summary 'Serve a markdown directory using a local server'
7
7
 
8
- usage "madman serve DIR [--port N --bind ADDRESS --github]"
9
- usage "madman serve (-h|--help)"
8
+ usage 'madman serve DIR [--port N --bind ADDRESS --github]'
9
+ usage 'madman serve (-h|--help)'
10
10
 
11
- option "--github", "Use the GitHub API renderer instead of the default one"
12
- option "-p --port N", "Set server port [default: 3000]"
13
- option "-b --bind ADDRESS", "Set server listen address [default: 0.0.0.0]"
11
+ option '--github', 'Use the GitHub API renderer instead of the default one'
12
+ option '-p --port N', 'Set server port [default: 3000]'
13
+ option '-b --bind ADDRESS', 'Set server listen address [default: 0.0.0.0]'
14
14
 
15
- param "DIR", "The directory containing markdown files"
15
+ param 'DIR', 'The directory containing markdown files'
16
16
 
17
- environment "GITHUB_ACCESS_TOKEN", "Your GitHub API access token\nRequired only if you wish to use the '/github' endpoint\nGenerate one here: https://github.com/settings/tokens"
17
+ environment 'GITHUB_ACCESS_TOKEN',
18
+ "Your GitHub API access token\nRequired only if you wish to use the '/github' endpoint\nGenerate one here: https://github.com/settings/tokens"
18
19
 
19
- example "madman serve"
20
- example "madman serve path/to/docs -p4000 --github"
20
+ example 'madman serve'
21
+ example 'madman serve path/to/docs -p4000 --github'
21
22
 
22
23
  def run
23
24
  dir = args['DIR']
@@ -27,13 +28,11 @@ module Madman
27
28
 
28
29
  say "Starting server at !undblu!localhost:#{port}!txtrst! using the !txtgrn!#{renderer}!txtrst! renderer\n"
29
30
 
30
- Madman::DirServer.set bind: bind, port: port,
31
+ Madman::DirServer.set bind: bind, port: port,
31
32
  dir: dir, renderer: renderer
32
-
33
+
33
34
  Madman::DirServer.run!
34
35
  end
35
-
36
36
  end
37
37
  end
38
38
  end
39
-
@@ -2,4 +2,4 @@ require 'madman/commands/nav'
2
2
  require 'madman/commands/preview'
3
3
  require 'madman/commands/readme'
4
4
  require 'madman/commands/render'
5
- require 'madman/commands/serve'
5
+ require 'madman/commands/serve'
@@ -10,19 +10,19 @@ module Madman
10
10
 
11
11
  not_found do
12
12
  content_type :text
13
- "4O4 Not Found"
13
+ '4O4 Not Found'
14
14
  end
15
15
 
16
16
  get '/favicon.ico' do
17
17
  content_type :text
18
18
  '(oOo)'
19
19
  end
20
-
20
+
21
21
  get '/*' do
22
22
  path = params[:splat].first
23
23
 
24
24
  type, file = find_file(path)
25
- redirect "#{path}/" if type == :dir and path[-1] != '/'
25
+ redirect "#{path}/" if (type == :dir) && (path[-1] != '/')
26
26
 
27
27
  if File.exist? file
28
28
  @doc = Document.from_file file
@@ -40,13 +40,12 @@ module Madman
40
40
 
41
41
  if File.directory? file
42
42
  type = path.empty? ? :root : :dir
43
- file ="#{file}/README.md"
43
+ file = "#{file}/README.md"
44
44
  else
45
- file ="#{file}.md"
45
+ file = "#{file}.md"
46
46
  end
47
47
 
48
48
  [type, file]
49
49
  end
50
-
51
50
  end
52
- end
51
+ end
@@ -7,7 +7,7 @@ module Madman
7
7
  @dir = dir
8
8
  @basedir = basedir || dir
9
9
  end
10
-
10
+
11
11
  def list
12
12
  @list ||= (dirs + files)
13
13
  end
@@ -30,7 +30,7 @@ module Madman
30
30
 
31
31
  def dirs
32
32
  result = Dir["#{dir}/*"].select { |f| File.directory? f }
33
- result.reject! do |f|
33
+ result.reject! do |f|
34
34
  basename = File.basename(f)
35
35
  basename =~ /^[a-z_\-0-9]+$/
36
36
  end
@@ -10,7 +10,7 @@ module Madman
10
10
 
11
11
  def self.from_file(file)
12
12
  if File.extname(file) == '.yml'
13
- result = new YAML.load_file(file), file
13
+ result = new YAML.unsafe_load_file(file), file
14
14
  result.yaml_mode = true
15
15
  result
16
16
  else
@@ -18,12 +18,12 @@ module Madman
18
18
  end
19
19
  end
20
20
 
21
- def initialize(text, filename=nil)
21
+ def initialize(text, filename = nil)
22
22
  @text = text
23
23
  @filename = filename
24
24
  end
25
25
 
26
- def render(renderer=:default)
26
+ def render(renderer = :default)
27
27
  if yaml_mode
28
28
  renderers[:yaml].render text, title: File.basename(filename, '.yml')
29
29
  else
@@ -35,9 +35,10 @@ module Madman
35
35
  detector.direction(text[0..200]) == 'rtl'
36
36
  end
37
37
 
38
- def save(save_as=nil)
38
+ def save(save_as = nil)
39
39
  save_as ||= filename
40
- raise ArgumentError, "No filename provided" unless save_as
40
+ raise ArgumentError, 'No filename provided' unless save_as
41
+
41
42
  File.write save_as, text
42
43
  end
43
44
 
@@ -51,4 +52,4 @@ module Madman
51
52
  Renderers.available_renderers
52
53
  end
53
54
  end
54
- end
55
+ end
@@ -6,13 +6,13 @@ module Madman
6
6
 
7
7
  content = [marker, content, marker].join "\n"
8
8
 
9
- if found_markers == 0 and force
9
+ if found_markers.zero? && force
10
10
  self.text += "\n\n#{content}"
11
11
  elsif found_markers == 1
12
- text.gsub! /#{marker}/im, content
12
+ text.gsub!(/#{marker}/im, content)
13
13
  elsif found_markers == 2
14
- text.gsub! /#{marker}.*#{marker}/im, content
14
+ text.gsub!(/#{marker}.*#{marker}/im, content)
15
15
  end
16
16
  end
17
17
  end
18
- end
18
+ end
data/lib/madman/item.rb CHANGED
@@ -5,7 +5,9 @@ module Madman
5
5
  attr_reader :path, :type, :basedir
6
6
 
7
7
  def initialize(path, type, basedir)
8
- @path, @type, @basedir = path, type, basedir
8
+ @path = path
9
+ @type = type
10
+ @basedir = basedir
9
11
  end
10
12
 
11
13
  def label
@@ -13,7 +15,7 @@ module Madman
13
15
  end
14
16
 
15
17
  def href
16
- Addressable::URI.escape(path_without_extension.sub(/^#{basedir}\//, ''))
18
+ Addressable::URI.escape(path_without_extension.sub(%r{^#{basedir}/}, ''))
17
19
  end
18
20
 
19
21
  def dir?
@@ -31,4 +33,3 @@ module Madman
31
33
  end
32
34
  end
33
35
  end
34
-
@@ -5,8 +5,9 @@ module Madman
5
5
  class Navigation
6
6
  attr_reader :dir, :depth
7
7
 
8
- def initialize(dir='.', depth: 10)
9
- @dir, @depth = dir, depth
8
+ def initialize(dir = '.', depth: 10)
9
+ @dir = dir
10
+ @depth = depth
10
11
  end
11
12
 
12
13
  def toc
@@ -28,16 +29,18 @@ module Madman
28
29
  result.join "\n"
29
30
  end
30
31
 
31
- def toc!(path=dir, level=0)
32
+ def toc!(path = dir, level = 0)
32
33
  return [] unless level < depth
34
+
33
35
  list = Directory.new(path, dir).list
34
36
 
35
37
  result = []
36
38
  list.each do |item|
37
- if item.type == :dir
39
+ case item.type
40
+ when :dir
38
41
  result.push level: level, item: item
39
- result += toc! item.path, level+1
40
- elsif item.type == :file
42
+ result += toc! item.path, level + 1
43
+ when :file
41
44
  result.push level: level, item: item
42
45
  end
43
46
  end
@@ -10,7 +10,7 @@ module Madman
10
10
  @renderer = :default
11
11
  end
12
12
 
13
- get '/' do
13
+ get '/' do
14
14
  slim :template
15
15
  end
16
16
 
@@ -19,4 +19,4 @@ module Madman
19
19
  slim :template
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -1,11 +1,11 @@
1
1
  module ArrayRefinements
2
2
  refine Array do
3
3
  def to_markdown
4
- map { |item| "- #{item}"}.join "\n"
4
+ map { |item| "- #{item}" }.join "\n"
5
5
  end
6
6
 
7
7
  def to_html
8
8
  CommonMarker.render_html to_markdown, :DEFAULT, [:table]
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,11 +1,11 @@
1
1
  module StringRefinements
2
2
  refine String do
3
3
  def slug
4
- downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
4
+ downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '')
5
5
  end
6
6
 
7
7
  def to_html
8
8
  CommonMarker.render_html self, :DEFAULT, [:table]
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,9 +1,9 @@
1
1
  module Madman
2
2
  module Renderers
3
3
  class Default
4
- def self.render(text, opts={})
5
- CommonMarker.render_html text, [:DEFAULT, :UNSAFE], [:table]
4
+ def self.render(text, _opts = {})
5
+ CommonMarker.render_html text, %i[DEFAULT UNSAFE], [:table]
6
6
  end
7
7
  end
8
8
  end
9
- end
9
+ end
@@ -1,19 +1,17 @@
1
1
  module Madman
2
2
  module Renderers
3
- class GitHub
4
- def self.render(text, opts={})
3
+ class Github
4
+ def self.render(text, _opts = {})
5
5
  client.markdown text
6
6
  end
7
7
 
8
- private
9
-
10
8
  def self.client
11
9
  Octokit::Client.new access_token: access_token
12
10
  end
13
11
 
14
12
  def self.access_token
15
- ENV['GITHUB_ACCESS_TOKEN'] or raise ArgumentError, "Please set GITHUB_ACCESS_TOKEN"
13
+ ENV['GITHUB_ACCESS_TOKEN'] or raise ArgumentError, 'Please set GITHUB_ACCESS_TOKEN'
16
14
  end
17
15
  end
18
16
  end
19
- end
17
+ end
@@ -1,12 +1,10 @@
1
1
  module Madman
2
2
  module Renderers
3
3
  class YAML
4
- def self.render(yaml, opts={})
4
+ def self.render(yaml, opts = {})
5
5
  doc = YAMLDoc.new yaml, title: opts[:title]
6
6
  doc.render
7
7
  end
8
8
  end
9
9
  end
10
10
  end
11
-
12
-
@@ -7,8 +7,8 @@ module Madman
7
7
  def self.available_renderers
8
8
  {
9
9
  default: Renderers::Default,
10
- yaml: Renderers::YAML,
11
- github: Renderers::GitHub,
10
+ yaml: Renderers::YAML,
11
+ github: Renderers::Github,
12
12
  }
13
13
  end
14
14
  end
@@ -1,10 +1,10 @@
1
1
  module Madman
2
2
  class ServerBase < Sinatra::Base
3
3
  set :views, File.expand_path('../views', __dir__)
4
-
4
+
5
5
  Slim::Engine.set_options pretty: true
6
-
7
- # Reloader temporarily removed due to
6
+
7
+ # Reloader temporarily removed due to
8
8
  # https://github.com/sinatra/sinatra/issues/1587
9
9
  #
10
10
  # configure :development do
@@ -13,7 +13,7 @@ module Madman
13
13
  # end
14
14
 
15
15
  get '/favicon.ico' do
16
+ ''
16
17
  end
17
-
18
18
  end
19
- end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Madman
2
- VERSION = "0.2.13"
3
- end
2
+ VERSION = '0.3.0'
3
+ end
@@ -40,7 +40,7 @@ module Madman
40
40
  @counter += 1
41
41
  end
42
42
 
43
- def tree!(data=nil, indent=0, caption=2)
43
+ def tree!(data = nil, indent = 0, caption = 2)
44
44
  data ||= yaml
45
45
  result = []
46
46
  caption = 6 if caption > 6
@@ -65,14 +65,13 @@ module Madman
65
65
  end
66
66
 
67
67
  if value.is_a? Hash
68
- result.push tree!(value, indent+1, caption+1)
68
+ result.push tree!(value, indent + 1, caption + 1)
69
69
  elsif value
70
- result.push "#{space * (indent+1)}#{value.to_html}"
70
+ result.push "#{space * (indent + 1)}#{value.to_html}"
71
71
  end
72
72
 
73
73
  result.push "#{space * indent}</div>"
74
74
  result
75
75
  end
76
-
77
76
  end
78
77
  end
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.13
4
+ version: 0.3.0
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: 2022-12-05 00:00:00.000000000 Z
11
+ date: 2022-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -228,7 +228,8 @@ files:
228
228
  homepage: https://github.com/dannyben/madman
229
229
  licenses:
230
230
  - MIT
231
- metadata: {}
231
+ metadata:
232
+ rubygems_mfa_required: 'true'
232
233
  post_install_message:
233
234
  rdoc_options: []
234
235
  require_paths:
@@ -237,7 +238,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
237
238
  requirements:
238
239
  - - ">="
239
240
  - !ruby/object:Gem::Version
240
- version: 2.7.0
241
+ version: 3.0.0
241
242
  required_rubygems_version: !ruby/object:Gem::Requirement
242
243
  requirements:
243
244
  - - ">="