munge 0.18.0 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/munge.rb +32 -31
- data/lib/munge/application.rb +7 -7
- data/lib/munge/bootloader.rb +0 -11
- data/lib/munge/cli.rb +3 -3
- data/lib/munge/cli/commands/build.rb +17 -21
- data/lib/munge/cli/commands/clean.rb +28 -33
- data/lib/munge/cli/commands/init.rb +1 -1
- data/lib/munge/cli/commands/server.rb +3 -3
- data/lib/munge/cli/dispatch.rb +56 -13
- data/lib/munge/config.rb +2 -2
- data/lib/munge/{system.rb → conglomerate.rb} +21 -14
- data/lib/munge/{system → conglomerate}/collection.rb +5 -26
- data/lib/munge/{system → conglomerate}/item_factory.rb +1 -1
- data/lib/munge/{system → conglomerate}/item_factory/content_parser.rb +1 -1
- data/lib/munge/{system → conglomerate}/item_factory/item_identifier.rb +1 -1
- data/lib/munge/conglomerate/processor.rb +138 -0
- data/lib/munge/conglomerate/reader.rb +33 -0
- data/lib/munge/{system → conglomerate}/router.rb +3 -3
- data/lib/munge/{system → conglomerate}/router/itemish.rb +1 -1
- data/lib/munge/{errors.rb → error.rb} +1 -25
- data/lib/munge/{extras → extra}/livereload.rb +5 -5
- data/lib/munge/{extras → extra}/livereload/messaging.rb +1 -1
- data/lib/munge/{extras → extra}/livereload/server.rb +1 -1
- data/lib/munge/{extras → extra}/livereload/update_client.rb +1 -1
- data/lib/munge/{extras → extra}/livereload/update_server.rb +1 -1
- data/lib/munge/{extras → extra}/livereload/vendor/livereload.js +0 -0
- data/lib/munge/{formatters → formatter}/default.rb +1 -1
- data/lib/munge/{formatters → formatter}/dots.rb +1 -1
- data/lib/munge/{formatters → formatter}/silent.rb +1 -1
- data/lib/munge/function/clean.rb +18 -0
- data/lib/munge/function/write.rb +68 -0
- data/lib/munge/go/sass.rb +5 -5
- data/lib/munge/go/sass/asset_urls.rb +2 -2
- data/lib/munge/{helpers → helper}/asset_paths.rb +1 -1
- data/lib/munge/{helpers → helper}/asset_tags.rb +1 -1
- data/lib/munge/{helpers → helper}/capture.rb +1 -1
- data/lib/munge/helper/data.rb +21 -0
- data/lib/munge/helper/define_module.rb +13 -0
- data/lib/munge/{helpers → helper}/find.rb +3 -3
- data/lib/munge/{helpers → helper}/link.rb +3 -3
- data/lib/munge/{helpers → helper}/livereload.rb +1 -1
- data/lib/munge/helper/rendering.rb +51 -0
- data/lib/munge/{helpers → helper}/tag.rb +4 -8
- data/lib/munge/item.rb +4 -5
- data/lib/munge/load.rb +60 -0
- data/lib/munge/pre_init.rb +10 -7
- data/lib/munge/{routers → router}/add_directory_index.rb +1 -1
- data/lib/munge/{routers → router}/auto_add_extension.rb +1 -1
- data/lib/munge/{routers → router}/fingerprint.rb +1 -1
- data/lib/munge/{routers → router}/remove_index_basename.rb +1 -1
- data/lib/munge/version.rb +1 -1
- data/lib/munge/vfs/dry_run.rb +28 -0
- data/lib/munge/vfs/filesystem.rb +44 -0
- data/lib/munge/vfs/memory.rb +33 -0
- data/lib/munge/write_manager/all.rb +11 -11
- data/lib/munge/write_manager/only_needed.rb +9 -9
- data/munge.gemspec +25 -17
- data/seeds/boot.rb +21 -0
- data/seeds/boot.yml +10 -0
- data/seeds/config.rb +7 -0
- data/seeds/layouts/blog_archives.html.erb +1 -1
- data/seeds/layouts/blog_index.html.erb +1 -1
- data/seeds/layouts/default.html.erb +1 -1
- data/seeds/lib/routing.rb +8 -8
- data/seeds/lib/sass.rb +1 -1
- data/seeds/lib/view_helpers.rb +3 -11
- data/seeds/rules.rb +1 -1
- data/seeds/src/home/index.html.erb +1 -1
- metadata +64 -46
- data/lib/munge/cleaner.rb +0 -31
- data/lib/munge/helpers/rendering.rb +0 -100
- data/lib/munge/init.rb +0 -45
- data/lib/munge/io/dry_run.rb +0 -31
- data/lib/munge/io/filesystem.rb +0 -38
- data/lib/munge/io/noop.rb +0 -27
- data/lib/munge/runner.rb +0 -68
- data/lib/munge/system/processor.rb +0 -52
- data/lib/munge/system/readers/filesystem.rb +0 -52
- data/lib/munge/transformers/tilt_transformer.rb +0 -40
- data/lib/munge/util/import.rb +0 -15
- data/seeds/setup.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 182b8b1edb4fd48e071f740629c0ba64819ea1b1
|
4
|
+
data.tar.gz: 92fe60dcdfa3db9d725ce3d4c771608b8b06605a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bffbbecdb7b150ff5fb63ece5254cf2fdbb931399fe38a85c8025804db5ae081ad53c6e3ff9ae910b1bb3190910dac61eb24dd2e3f079a627bad9c774593e31
|
7
|
+
data.tar.gz: 6e72c3ddb97d3f38ab1f9afb52979fe5bf7925b1b81e4a789f0e7560c72ec6f50f6803d52b5dc0e645ee15575c69f95eec8d5dbe14d78a560206d844876dfe9f
|
data/lib/munge.rb
CHANGED
@@ -5,6 +5,7 @@ require "yaml"
|
|
5
5
|
require "cgi"
|
6
6
|
|
7
7
|
require "tilt"
|
8
|
+
require "fixer_upper"
|
8
9
|
|
9
10
|
if Gem::Specification.find_all_by_name("pry-byebug").any?
|
10
11
|
require "pry-byebug"
|
@@ -15,47 +16,47 @@ end
|
|
15
16
|
# Core
|
16
17
|
require "munge/version"
|
17
18
|
require "munge/item"
|
18
|
-
require "munge/
|
19
|
+
require "munge/error"
|
19
20
|
require "munge/util/path"
|
20
21
|
require "munge/util/symbol_hash"
|
21
22
|
require "munge/util/boolean_regex"
|
22
|
-
require "munge/
|
23
|
-
require "munge/
|
24
|
-
require "munge/
|
25
|
-
require "munge/
|
26
|
-
require "munge/
|
27
|
-
require "munge/
|
28
|
-
require "munge/
|
29
|
-
require "munge/
|
30
|
-
require "munge/
|
31
|
-
require "munge/
|
32
|
-
require "munge/
|
33
|
-
require "munge/
|
34
|
-
require "munge/io/noop"
|
23
|
+
require "munge/conglomerate/router"
|
24
|
+
require "munge/conglomerate/router/itemish"
|
25
|
+
require "munge/conglomerate/item_factory"
|
26
|
+
require "munge/conglomerate/item_factory/content_parser"
|
27
|
+
require "munge/conglomerate/item_factory/item_identifier"
|
28
|
+
require "munge/conglomerate/collection"
|
29
|
+
require "munge/conglomerate/reader"
|
30
|
+
require "munge/conglomerate/processor"
|
31
|
+
require "munge/conglomerate"
|
32
|
+
require "munge/vfs/dry_run"
|
33
|
+
require "munge/vfs/filesystem"
|
34
|
+
require "munge/vfs/memory"
|
35
35
|
require "munge/write_manager/all"
|
36
36
|
require "munge/write_manager/only_needed"
|
37
|
+
require "munge/function/clean"
|
38
|
+
require "munge/function/write"
|
37
39
|
require "munge/application"
|
38
40
|
require "munge/config"
|
39
|
-
require "munge/runner"
|
40
41
|
require "munge/reporter"
|
41
|
-
require "munge/cleaner"
|
42
42
|
require "munge/pre_init"
|
43
|
-
require "munge/init"
|
44
43
|
require "munge/bootloader"
|
44
|
+
require "munge/load"
|
45
45
|
|
46
46
|
# Extensions
|
47
|
-
require "munge/
|
48
|
-
require "munge/
|
49
|
-
require "munge/
|
50
|
-
require "munge/
|
51
|
-
require "munge/
|
52
|
-
require "munge/
|
53
|
-
require "munge/
|
54
|
-
require "munge/
|
55
|
-
require "munge/
|
56
|
-
require "munge/
|
57
|
-
require "munge/
|
58
|
-
require "munge/
|
59
|
-
require "munge/
|
47
|
+
require "munge/helper/asset_tags"
|
48
|
+
require "munge/helper/asset_paths"
|
49
|
+
require "munge/helper/capture"
|
50
|
+
require "munge/helper/data"
|
51
|
+
require "munge/helper/find"
|
52
|
+
require "munge/helper/link"
|
53
|
+
require "munge/helper/rendering"
|
54
|
+
require "munge/helper/tag"
|
55
|
+
require "munge/helper/livereload"
|
56
|
+
require "munge/helper/define_module"
|
57
|
+
require "munge/router/auto_add_extension"
|
58
|
+
require "munge/router/fingerprint"
|
59
|
+
require "munge/router/add_directory_index"
|
60
|
+
require "munge/router/remove_index_basename"
|
60
61
|
|
61
|
-
require "munge/
|
62
|
+
require "munge/extra/livereload"
|
data/lib/munge/application.rb
CHANGED
@@ -2,13 +2,13 @@ module Munge
|
|
2
2
|
# This class is one of the main interfaces users would interact with. This
|
3
3
|
# provides methods to create and iterate through items.
|
4
4
|
class Application
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(conglomerate)
|
6
|
+
@conglomerate = conglomerate
|
7
7
|
end
|
8
8
|
|
9
9
|
# @return [Array<Item>]
|
10
10
|
def items
|
11
|
-
@
|
11
|
+
@conglomerate.items
|
12
12
|
end
|
13
13
|
|
14
14
|
# @return [Array<Item>]
|
@@ -25,7 +25,7 @@ module Munge
|
|
25
25
|
#
|
26
26
|
# @return [Item]
|
27
27
|
def build_virtual_item(relpath, content, **frontmatter)
|
28
|
-
@
|
28
|
+
@conglomerate.item_factory.build(relpath: relpath, content: content, frontmatter: frontmatter)
|
29
29
|
end
|
30
30
|
|
31
31
|
# Creates an Item and inserts it into the registry of Items.
|
@@ -37,15 +37,15 @@ module Munge
|
|
37
37
|
# @return [Array<Item>]
|
38
38
|
def create(*args)
|
39
39
|
item = build_virtual_item(*args)
|
40
|
-
@
|
40
|
+
@conglomerate.items.push(item)
|
41
41
|
[item]
|
42
42
|
end
|
43
43
|
|
44
|
-
# Returns parts of
|
44
|
+
# Returns parts of Conglomerate
|
45
45
|
#
|
46
46
|
# @private
|
47
47
|
def vomit(component_name)
|
48
|
-
@
|
48
|
+
@conglomerate.public_send(component_name)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
data/lib/munge/bootloader.rb
CHANGED
@@ -11,17 +11,6 @@ module Munge
|
|
11
11
|
@config = Munge::PreInit.new(config_path).config
|
12
12
|
end
|
13
13
|
|
14
|
-
# @return [Munge::Init]
|
15
|
-
def init
|
16
|
-
@init ||=
|
17
|
-
Init.new(
|
18
|
-
root_path: root_path,
|
19
|
-
config: config,
|
20
|
-
setup_path: setup_path,
|
21
|
-
rules_path: rules_path
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
14
|
attr_reader :root_path
|
26
15
|
attr_reader :setup_path
|
27
16
|
attr_reader :rules_path
|
data/lib/munge/cli.rb
CHANGED
@@ -9,6 +9,6 @@ require "munge/cli/commands/clean"
|
|
9
9
|
require "munge/cli/commands/update"
|
10
10
|
require "munge/cli/dispatch"
|
11
11
|
|
12
|
-
require "munge/
|
13
|
-
require "munge/
|
14
|
-
require "munge/
|
12
|
+
require "munge/formatter/default"
|
13
|
+
require "munge/formatter/dots"
|
14
|
+
require "munge/formatter/silent"
|
@@ -10,46 +10,42 @@ module Munge
|
|
10
10
|
def initialize(bootloader, dry_run:, reporter:, verbosity:, build_root: nil)
|
11
11
|
destination_root = bootloader.root_path
|
12
12
|
config = bootloader.config
|
13
|
-
app = application(bootloader)
|
14
13
|
destination = File.expand_path(build_root || config[:output_path], destination_root)
|
15
14
|
|
16
|
-
|
15
|
+
vfs = new_vfs(dry_run, destination)
|
16
|
+
|
17
|
+
loader = Munge::Load.new(bootloader.root_path)
|
17
18
|
|
18
19
|
@runner =
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
)
|
20
|
+
loader.app do |_application, conglomerate|
|
21
|
+
Munge::Function::Write.new(
|
22
|
+
conglomerate: conglomerate,
|
23
|
+
reporter: Munge::Reporter.new(formatter: new_formatter(reporter), verbosity: verbosity.to_sym),
|
24
|
+
manager: Munge::WriteManager::OnlyNeeded.new(vfs),
|
25
|
+
destination: vfs
|
26
|
+
)
|
27
|
+
end
|
28
28
|
end
|
29
29
|
|
30
30
|
# @return [Array<String>] list of updated items routes
|
31
31
|
def call
|
32
|
-
@runner.
|
32
|
+
@runner.call
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def
|
38
|
-
|
39
|
-
|
40
|
-
bootstrap.app
|
41
|
-
end
|
37
|
+
def new_vfs(dry_run, destination)
|
38
|
+
fs = Munge::Vfs::Filesystem.new(destination)
|
42
39
|
|
43
|
-
def new_io(dry_run)
|
44
40
|
if dry_run
|
45
|
-
Munge::
|
41
|
+
Munge::Vfs::DryRun.new(fs)
|
46
42
|
else
|
47
|
-
|
43
|
+
fs
|
48
44
|
end
|
49
45
|
end
|
50
46
|
|
51
47
|
def new_formatter(class_name)
|
52
|
-
Munge::
|
48
|
+
Munge::Formatter.const_get(class_name).new
|
53
49
|
end
|
54
50
|
end
|
55
51
|
end
|
@@ -6,54 +6,49 @@ module Munge
|
|
6
6
|
def initialize(bootloader, dry_run:, reporter:, verbosity:, build_root: nil)
|
7
7
|
destination_root = bootloader.root_path
|
8
8
|
config = bootloader.config
|
9
|
-
app = application(bootloader)
|
10
9
|
destination = File.expand_path(build_root || config[:output_path], destination_root)
|
11
|
-
@dry_run = dry_run
|
12
10
|
|
13
|
-
|
11
|
+
memory = Munge::Vfs::Memory.new
|
12
|
+
vfs = new_vfs(dry_run, destination)
|
13
|
+
|
14
|
+
loader = Munge::Load.new(bootloader.root_path)
|
14
15
|
|
15
16
|
@runner =
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
loader.app do |_application, conglomerate|
|
18
|
+
Munge::Function::Write.new(
|
19
|
+
conglomerate: conglomerate,
|
20
|
+
reporter: Munge::Reporter.new(formatter: formatter("Silent"), verbosity: :silent),
|
21
|
+
manager: Munge::WriteManager::All.new(memory),
|
22
|
+
destination: memory
|
23
|
+
).call
|
24
|
+
|
25
|
+
Munge::Function::Clean.new(
|
26
|
+
memory: memory,
|
27
|
+
destination: vfs
|
28
|
+
)
|
29
|
+
end
|
25
30
|
|
26
31
|
@output_path = File.expand_path(build_root || config[:output_path], destination_root)
|
27
32
|
end
|
28
33
|
|
29
34
|
def call
|
30
|
-
|
31
|
-
if @dry_run
|
32
|
-
Munge::Io::DryRun.new(Munge::Io::Filesystem.new)
|
33
|
-
else
|
34
|
-
Munge::Io::Filesystem.new
|
35
|
-
end
|
36
|
-
|
37
|
-
cleaner =
|
38
|
-
Munge::Cleaner.new(
|
39
|
-
path_to_clean: @output_path,
|
40
|
-
paths_to_write: @runner.write,
|
41
|
-
io: io
|
42
|
-
)
|
43
|
-
|
44
|
-
cleaner.delete
|
35
|
+
@runner.call
|
45
36
|
end
|
46
37
|
|
47
38
|
private
|
48
39
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
52
|
-
bootstrap.app
|
40
|
+
def formatter(class_name)
|
41
|
+
Munge::Formatter.const_get(class_name).new
|
53
42
|
end
|
54
43
|
|
55
|
-
def
|
56
|
-
Munge::
|
44
|
+
def new_vfs(dry_run, destination)
|
45
|
+
fs = Munge::Vfs::Filesystem.new(destination)
|
46
|
+
|
47
|
+
if dry_run
|
48
|
+
Munge::Vfs::DryRun.new(fs)
|
49
|
+
else
|
50
|
+
fs
|
51
|
+
end
|
57
52
|
end
|
58
53
|
end
|
59
54
|
end
|
@@ -10,13 +10,13 @@ module Munge
|
|
10
10
|
@livereload =
|
11
11
|
if livereload
|
12
12
|
if Gem.loaded_specs.key?("reel")
|
13
|
-
Munge::
|
13
|
+
Munge::Extra::Livereload::Main.new(true)
|
14
14
|
else
|
15
15
|
STDERR.puts "Gem `reel` is not installed. Check that your Ruby version is compatible"
|
16
|
-
Munge::
|
16
|
+
Munge::Extra::Livereload::Main.new(false)
|
17
17
|
end
|
18
18
|
else
|
19
|
-
Munge::
|
19
|
+
Munge::Extra::Livereload::Main.new(false)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
data/lib/munge/cli/dispatch.rb
CHANGED
@@ -8,9 +8,20 @@ module Munge
|
|
8
8
|
end
|
9
9
|
|
10
10
|
desc "build", "Build site"
|
11
|
-
method_option :reporter,
|
12
|
-
|
13
|
-
|
11
|
+
method_option :reporter,
|
12
|
+
desc: "Set reporting formatter",
|
13
|
+
default: "Default",
|
14
|
+
type: :string
|
15
|
+
method_option :dry_run,
|
16
|
+
desc: "Run without writing files",
|
17
|
+
default: false,
|
18
|
+
type: :boolean
|
19
|
+
method_option :verbosity,
|
20
|
+
aliases: "-v",
|
21
|
+
desc: "Preferred amount of output",
|
22
|
+
enum: %w(all written silent),
|
23
|
+
default: "written",
|
24
|
+
type: :string
|
14
25
|
def build
|
15
26
|
production!
|
16
27
|
|
@@ -18,8 +29,16 @@ module Munge
|
|
18
29
|
end
|
19
30
|
|
20
31
|
desc "view", "View built files"
|
21
|
-
method_option :port,
|
22
|
-
|
32
|
+
method_option :port,
|
33
|
+
aliases: "-p",
|
34
|
+
desc: "Set port",
|
35
|
+
default: 7000,
|
36
|
+
type: :numeric
|
37
|
+
method_option :host,
|
38
|
+
aliases: "-h",
|
39
|
+
desc: "Set host",
|
40
|
+
default: "0.0.0.0",
|
41
|
+
type: :string
|
23
42
|
def view
|
24
43
|
production!
|
25
44
|
|
@@ -27,9 +46,20 @@ module Munge
|
|
27
46
|
end
|
28
47
|
|
29
48
|
desc "server", "Run the development server"
|
30
|
-
method_option :livereload,
|
31
|
-
|
32
|
-
|
49
|
+
method_option :livereload,
|
50
|
+
desc: "Reload browser on update",
|
51
|
+
default: Gem.loaded_specs.key?("reel"),
|
52
|
+
type: :boolean
|
53
|
+
method_option :port,
|
54
|
+
aliases: "-p",
|
55
|
+
desc: "Set port",
|
56
|
+
default: 7000,
|
57
|
+
type: :numeric
|
58
|
+
method_option :host,
|
59
|
+
aliases: "-h",
|
60
|
+
desc: "Set host",
|
61
|
+
default: "0.0.0.0",
|
62
|
+
type: :string
|
33
63
|
def server
|
34
64
|
development!
|
35
65
|
|
@@ -37,16 +67,29 @@ module Munge
|
|
37
67
|
end
|
38
68
|
|
39
69
|
desc "clean", "Remove old built files (generally unnecessary)"
|
40
|
-
method_option :reporter,
|
41
|
-
|
42
|
-
|
70
|
+
method_option :reporter,
|
71
|
+
desc: "Set reporting formatter",
|
72
|
+
default: "Default",
|
73
|
+
type: :string
|
74
|
+
method_option :dry_run,
|
75
|
+
desc: "Run without writing files",
|
76
|
+
default: false,
|
77
|
+
type: :boolean
|
78
|
+
method_option :verbosity,
|
79
|
+
aliases: "-v",
|
80
|
+
desc: "Preferred amount of output",
|
81
|
+
enum: %w(all written silent),
|
82
|
+
default: "written",
|
83
|
+
type: :string
|
43
84
|
def clean
|
44
85
|
production!
|
45
86
|
|
46
87
|
Commands::Clean.new(bootloader, **symbolized_options, build_root: ENV["BUILD_ROOT"]).call
|
47
88
|
end
|
48
89
|
|
49
|
-
desc "update",
|
90
|
+
desc "update",
|
91
|
+
"Use with caution: override local configs with pristine version " \
|
92
|
+
"(useful after bumping version in Gemfile)"
|
50
93
|
def update
|
51
94
|
development!
|
52
95
|
|
@@ -67,7 +110,7 @@ module Munge
|
|
67
110
|
|
68
111
|
def bootloader
|
69
112
|
Munge::Bootloader.new(root_path: current_working_directory)
|
70
|
-
rescue Munge::
|
113
|
+
rescue Munge::Error::ConfigRbNotFound => e
|
71
114
|
puts e.message
|
72
115
|
exit
|
73
116
|
end
|