Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require:
plugins:
- rubocop-performance
- rubocop-rspec

Expand Down
1 change: 1 addition & 0 deletions lib/madness/directory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Madness
# Represents a directory with markdown file sand subflders.
class Directory
include ServerHelper

using ArrayRefinements
using StringRefinements

Expand Down
1 change: 1 addition & 0 deletions lib/madness/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Madness
# Handle a single document path.
class Document
include ServerHelper

using StringRefinements

attr_reader :base, :path, :type, :file, :dir, :title
Expand Down
1 change: 1 addition & 0 deletions lib/madness/inline_table_of_contents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Madness
# Generate a markdown Table of Contents for a single document
class InlineTableOfContents
include ServerHelper

using StringRefinements

attr_reader :text
Expand Down
1 change: 1 addition & 0 deletions lib/madness/item.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Madness
class Item
include ServerHelper

using StringRefinements

attr_reader :path, :type
Expand Down
1 change: 1 addition & 0 deletions lib/madness/markdown_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Madness
# Handle a pure markdown document.
class MarkdownDocument
include ServerHelper

using StringRefinements

attr_reader :markdown, :title
Expand Down
1 change: 1 addition & 0 deletions lib/madness/navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Madness
# Handle the navigation links for a given directory
class Navigation
include ServerHelper

using ArrayRefinements
using StringRefinements

Expand Down
14 changes: 0 additions & 14 deletions lib/madness/refinements/hash_refinements.rb

This file was deleted.

1 change: 1 addition & 0 deletions lib/madness/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module Madness
class Search
include ServerHelper

using StringRefinements

def initialize(path = nil)
Expand Down
2 changes: 1 addition & 1 deletion lib/madness/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Server < ServerBase
nav = Navigation.new dir
breadcrumbs = Breadcrumbs.new(path).links

if (nav.links.count == 1) && (doc.type == :empty)
if nav.links.one? && doc.type == :empty
redirect to(nav.links.first.href)
end

Expand Down
3 changes: 1 addition & 2 deletions lib/madness/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module Madness
# 3. Any override provided later (for example, by the CommandLine class)
class Settings
include Singleton
using HashRefinements

def initialize
reset
Expand Down Expand Up @@ -84,7 +83,7 @@ def defaults

def file_data
result = if file_exist?
ExtendedYAML.load(filename)&.symbolize_keys
ExtendedYAML.load(filename)&.transform_keys(&:to_sym)
else
{}
end
Expand Down
22 changes: 0 additions & 22 deletions spec/madness/refinements/hash_refinements_spec.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# The reason for this is that we need the Server class to be evaluated
# (required) after base_uri is set.
if ENV['STANDALONE']
require 'madness/refinements/hash_refinements'
require 'madness/settings'
Madness::Settings.instance.base_uri = '/docs'
end
Expand All @@ -44,6 +43,7 @@
# Bootstrap Sinatra testing with rspec
module RSpecMixin
include Rack::Test::Methods

def app
described_class.prepare
described_class
Expand Down