munge 0.5.0.beta1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +22 -10
- data/lib/munge/application.rb +2 -2
- data/lib/munge/bootstrap.rb +11 -0
- data/lib/munge/core/collection.rb +7 -1
- data/lib/munge/core/item_factory.rb +13 -19
- data/lib/munge/helper/asset_tags.rb +35 -0
- data/lib/munge/helper/asset_urls.rb +25 -0
- data/lib/munge/helper/capture.rb +16 -8
- data/lib/munge/helper/rendering.rb +20 -13
- data/lib/munge/helper/tag.rb +35 -0
- data/lib/munge/system.rb +11 -5
- data/lib/munge/util/path.rb +7 -0
- data/lib/munge/version.rb +1 -1
- data/lib/munge.rb +3 -0
- data/seeds/config/_asset_roots.rb +19 -0
- data/seeds/config/routing.rb +19 -0
- data/seeds/config/sass.rb +3 -0
- data/seeds/config/sass_helpers.rb +54 -0
- data/seeds/config/view_helpers.rb +11 -0
- data/seeds/config.yml +9 -5
- data/seeds/layouts/default.html.erb +1 -1
- data/seeds/rules.rb +22 -3
- data/seeds/setup.rb +3 -15
- data/seeds/src/assets/fonts/.empty_directory +0 -0
- data/seeds/src/assets/images/.empty_directory +0 -0
- data/seeds/src/assets/javascripts/.empty_directory +0 -0
- data/seeds/src/{_vars.scss → assets/stylesheets/_vars.scss} +0 -0
- data/seeds/src/{basic.css.scss → assets/stylesheets/basic.css.scss} +0 -0
- metadata +18 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cfe4d5e02bf3872299162b668845fbe856db41a
|
4
|
+
data.tar.gz: c1acc5e8fc9dd7c6a1c3ca2f1d7d12e360e080d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62174c45cdfb612a0351bfb37083a92f1109e25f618ddad861e086fa8e9274128f13aec4787e230d1707ffb1c723c74ce9008854d3edc4c523a7d79cab16bb6e
|
7
|
+
data.tar.gz: ec309d87bce9804227edbb8b0b86baeaadf4ac3e479edc451e795c78fb6dbc1f6fe686dc3f95818221be02b2b2fa54e52c584e9063053d94f7619c0e88156f1a
|
data/Makefile
CHANGED
@@ -1,21 +1,33 @@
|
|
1
|
-
.PHONY: all test
|
1
|
+
.PHONY: all coverage-test coverage-open seeds-build seeds-open seeds-clean test release
|
2
2
|
|
3
3
|
all:
|
4
4
|
@echo "usage:"
|
5
5
|
@echo
|
6
|
-
@echo "make test
|
7
|
-
@echo "make
|
8
|
-
@echo "make
|
9
|
-
@echo "make
|
6
|
+
@echo "make coverage-test runs tests and logs coverage"
|
7
|
+
@echo "make coverage-open starts webserver in coverage directory"
|
8
|
+
@echo "make seeds-build runs munge-build on seeds"
|
9
|
+
@echo "make seeds-open runs munge-view on seeds"
|
10
|
+
@echo "make seeds-clean removes built seeds files"
|
11
|
+
@echo "make test runs tests"
|
12
|
+
@echo "make release releases gem (dangerous)"
|
10
13
|
|
11
|
-
test:
|
12
|
-
script/test
|
13
|
-
|
14
|
-
testc:
|
14
|
+
coverage-test:
|
15
15
|
COVERAGE=1 script/test
|
16
16
|
|
17
|
-
|
17
|
+
coverage-open:
|
18
18
|
cd coverage && adsf
|
19
19
|
|
20
|
+
seeds-build:
|
21
|
+
cd seeds && ../exe/munge build
|
22
|
+
|
23
|
+
seeds-open:
|
24
|
+
cd seeds && ../exe/munge view
|
25
|
+
|
26
|
+
seeds-clean:
|
27
|
+
rm -r seeds/dest seeds/.sass-cache
|
28
|
+
|
29
|
+
test:
|
30
|
+
script/test
|
31
|
+
|
20
32
|
release:
|
21
33
|
bundle exec rake release
|
data/lib/munge/application.rb
CHANGED
@@ -14,8 +14,8 @@ module Munge
|
|
14
14
|
.each { |item| render_and_write(item, &block) }
|
15
15
|
end
|
16
16
|
|
17
|
-
def build_virtual_item(
|
18
|
-
@system.source.build(
|
17
|
+
def build_virtual_item(relpath, content, **frontmatter)
|
18
|
+
@system.source.build(relpath: relpath, content: content, frontmatter: frontmatter)
|
19
19
|
end
|
20
20
|
|
21
21
|
def create(*args)
|
data/lib/munge/bootstrap.rb
CHANGED
@@ -49,6 +49,9 @@ module Munge
|
|
49
49
|
rules_string:,
|
50
50
|
setup_path:,
|
51
51
|
rules_path:)
|
52
|
+
@setup_path = setup_path
|
53
|
+
@rules_path = rules_path
|
54
|
+
|
52
55
|
system = Munge::System.new(root_path, config)
|
53
56
|
|
54
57
|
binding.eval(setup_string, setup_path)
|
@@ -58,6 +61,14 @@ module Munge
|
|
58
61
|
binding.eval(rules_string, rules_path)
|
59
62
|
end
|
60
63
|
|
64
|
+
def root_path
|
65
|
+
File.dirname(@setup_path)
|
66
|
+
end
|
67
|
+
|
68
|
+
def config_path
|
69
|
+
File.join(root_path, "config")
|
70
|
+
end
|
71
|
+
|
61
72
|
attr_reader :app
|
62
73
|
end
|
63
74
|
end
|
@@ -4,9 +4,9 @@ module Munge
|
|
4
4
|
module Core
|
5
5
|
class ItemFactory
|
6
6
|
def initialize(text_extensions:,
|
7
|
-
|
8
|
-
@text_extensions
|
9
|
-
@
|
7
|
+
ignore_extensions:)
|
8
|
+
@text_extensions = Set.new(text_extensions)
|
9
|
+
@ignore_extensions = ignore_extensions
|
10
10
|
end
|
11
11
|
|
12
12
|
def build(relpath:,
|
@@ -16,7 +16,7 @@ module Munge
|
|
16
16
|
type = compute_file_type(relpath)
|
17
17
|
|
18
18
|
id =
|
19
|
-
if type == :text
|
19
|
+
if @ignore_extensions || type == :text
|
20
20
|
compute_id(relpath)
|
21
21
|
else
|
22
22
|
relpath
|
@@ -74,30 +74,24 @@ module Munge
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def compute_id(relpath)
|
77
|
-
dirname =
|
78
|
-
basename =
|
77
|
+
dirname = Munge::Util::Path.dirname(relpath)
|
78
|
+
basename =
|
79
|
+
if @ignore_extensions
|
80
|
+
Munge::Util::Path.basename_no_extension(relpath)
|
81
|
+
else
|
82
|
+
Munge::Util::Path.basename_one_extension(relpath)
|
83
|
+
end
|
79
84
|
|
80
85
|
id = []
|
81
86
|
|
82
|
-
unless dirname == "
|
87
|
+
unless dirname == ""
|
83
88
|
id.push(dirname)
|
84
89
|
end
|
85
90
|
|
86
|
-
|
87
|
-
id.push(basename)
|
88
|
-
end
|
91
|
+
id.push(basename)
|
89
92
|
|
90
93
|
id.join("/")
|
91
94
|
end
|
92
|
-
|
93
|
-
def compute_dirname(relpath)
|
94
|
-
File.dirname(relpath)
|
95
|
-
end
|
96
|
-
|
97
|
-
def compute_basename(relpath)
|
98
|
-
filename = File.basename(relpath)
|
99
|
-
filename.split(".").first
|
100
|
-
end
|
101
95
|
end
|
102
96
|
end
|
103
97
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Munge
|
2
|
+
module Helper
|
3
|
+
module AssetTags
|
4
|
+
def stylesheet_tag(basename, options = {})
|
5
|
+
options[:rel] = "stylesheet"
|
6
|
+
options[:href] = stylesheet_url(basename)
|
7
|
+
|
8
|
+
empty_tag(:link, options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def javascript_tag(basename, options = {})
|
12
|
+
options[:type] = "text/javascript"
|
13
|
+
options[:src] = javascript_url(basename)
|
14
|
+
|
15
|
+
content_tag(:script, options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def inline_stylesheet_tag(basename, options = {})
|
19
|
+
inline_asset_tag_helper(stylesheets_root, basename, :style, options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def inline_javascript_tag(basename, options = {})
|
23
|
+
inline_asset_tag_helper(javascripts_root, basename, :script, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def inline_asset_tag_helper(root, basename, tag, options)
|
29
|
+
rendered_asset = render(items["#{root}/#{basename}"])
|
30
|
+
|
31
|
+
content_tag(tag, rendered_asset, options)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Munge
|
2
|
+
module Helper
|
3
|
+
module AssetUrls
|
4
|
+
def image_url(basename)
|
5
|
+
item = items["#{images_root}/#{basename}"]
|
6
|
+
url_for(item)
|
7
|
+
end
|
8
|
+
|
9
|
+
def font_url(basename)
|
10
|
+
item = items["#{fonts_root}/#{basename}"]
|
11
|
+
url_for(item)
|
12
|
+
end
|
13
|
+
|
14
|
+
def stylesheet_url(basename)
|
15
|
+
item = items["#{stylesheets_root}/#{basename}"]
|
16
|
+
url_for(item)
|
17
|
+
end
|
18
|
+
|
19
|
+
def javascript_url(basename)
|
20
|
+
item = items["#{javascripts_root}/#{basename}"]
|
21
|
+
url_for(item)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/munge/helper/capture.rb
CHANGED
@@ -2,22 +2,30 @@ module Munge
|
|
2
2
|
module Helper
|
3
3
|
module Capture
|
4
4
|
def capture(&block)
|
5
|
-
|
6
|
-
|
5
|
+
if block.binding.local_variable_defined?(:_erbout)
|
6
|
+
original_erbout = block.binding.local_variable_get(:_erbout)
|
7
|
+
block.binding.local_variable_set(:_erbout, "")
|
7
8
|
|
8
|
-
|
9
|
+
captured_text = block.call
|
9
10
|
|
10
|
-
|
11
|
+
block.binding.local_variable_set(:_erbout, original_erbout)
|
11
12
|
|
12
|
-
|
13
|
+
captured_text
|
14
|
+
else
|
15
|
+
block.call
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
def append_to_erbout(block_binding, text)
|
16
|
-
|
20
|
+
if block_binding.local_variable_defined?(:_erbout)
|
21
|
+
original_erbout = block_binding.local_variable_get(:_erbout)
|
17
22
|
|
18
|
-
|
23
|
+
updated_erbout = original_erbout + text
|
19
24
|
|
20
|
-
|
25
|
+
block_binding.local_variable_set(:_erbout, updated_erbout)
|
26
|
+
end
|
27
|
+
|
28
|
+
text
|
21
29
|
end
|
22
30
|
end
|
23
31
|
end
|
@@ -4,7 +4,7 @@ module Munge
|
|
4
4
|
def render(item, engines: nil, data: {}, content_override: nil)
|
5
5
|
content = content_override || item.content
|
6
6
|
renderers = tilt_renderer_list(item, engines)
|
7
|
-
mdata = merged_data(item.frontmatter, data)
|
7
|
+
mdata = merged_data(item.frontmatter, data, { self_item: item })
|
8
8
|
|
9
9
|
render_string(content, data: mdata, engines: renderers)
|
10
10
|
end
|
@@ -12,32 +12,39 @@ module Munge
|
|
12
12
|
def layout(item_or_string, data: {}, &block)
|
13
13
|
layout_item = resolve_layout(item_or_string)
|
14
14
|
renderers = tilt_renderer_list(layout_item, nil)
|
15
|
-
mdata = merged_data(layout_item.frontmatter, data)
|
15
|
+
mdata = merged_data(layout_item.frontmatter, data, { self_layout: layout_item })
|
16
16
|
|
17
17
|
render_string(layout_item.content, data: mdata, engines: renderers, &block)
|
18
18
|
end
|
19
19
|
|
20
|
-
def render_string(content, data: {}, engines: [])
|
20
|
+
def render_string(content, data: {}, engines: [], &block)
|
21
21
|
inner =
|
22
22
|
if block_given?
|
23
|
-
|
23
|
+
capture(&block)
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
output =
|
27
|
+
engines
|
28
|
+
.inject(content) do |output, engine|
|
29
|
+
template = engine.new { output }
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
if inner
|
32
|
+
template.render(self, data) { inner }
|
33
|
+
else
|
34
|
+
template.render(self, data)
|
35
|
+
end
|
34
36
|
end
|
35
|
-
|
37
|
+
|
38
|
+
if block_given?
|
39
|
+
append_to_erbout(block.binding, output)
|
40
|
+
end
|
41
|
+
|
42
|
+
output
|
36
43
|
end
|
37
44
|
|
38
45
|
def render_with_layout(item, content_engines: nil, data: {}, content_override: nil)
|
39
46
|
inner = render(item, engines: content_engines, data: data, content_override: content_override)
|
40
|
-
mdata = merged_data(item.frontmatter, data)
|
47
|
+
mdata = merged_data(item.frontmatter, data, { self_item: item })
|
41
48
|
|
42
49
|
if item.layout
|
43
50
|
layout(item.layout, data: mdata) do
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Munge
|
2
|
+
module Helper
|
3
|
+
module Tag
|
4
|
+
def empty_tag(name, options = {})
|
5
|
+
options_str = options.map { |k, v| %(#{k}="#{v}") }.join(" ")
|
6
|
+
|
7
|
+
if options_str == ""
|
8
|
+
"<#{name} />"
|
9
|
+
else
|
10
|
+
"<#{name} #{options_str} />"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def content_tag(name, content = nil, options = {}, &block)
|
15
|
+
if content.is_a?(Hash)
|
16
|
+
options = content
|
17
|
+
content = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
options_str = options.map { |k, v| %(#{k}="#{v}") }.join(" ")
|
21
|
+
|
22
|
+
content_str =
|
23
|
+
if content
|
24
|
+
content
|
25
|
+
elsif block_given?
|
26
|
+
capture(&block)
|
27
|
+
else
|
28
|
+
""
|
29
|
+
end
|
30
|
+
|
31
|
+
"<#{name} #{options_str}>#{content_str}</#{name}>"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/munge/system.rb
CHANGED
@@ -11,21 +11,27 @@ module Munge
|
|
11
11
|
|
12
12
|
@config = config
|
13
13
|
|
14
|
-
|
14
|
+
source_item_factory =
|
15
15
|
Core::ItemFactory.new(
|
16
|
-
text_extensions: config[:text_extensions],
|
17
|
-
|
16
|
+
text_extensions: config[:text_extensions] + config[:bintext_extensions],
|
17
|
+
ignore_extensions: false
|
18
|
+
)
|
19
|
+
|
20
|
+
layouts_item_factory =
|
21
|
+
Core::ItemFactory.new(
|
22
|
+
text_extensions: config[:text_extensions] + config[:bintext_extensions],
|
23
|
+
ignore_extensions: true
|
18
24
|
)
|
19
25
|
|
20
26
|
@source =
|
21
27
|
Core::Collection.new(
|
22
|
-
item_factory:
|
28
|
+
item_factory: source_item_factory,
|
23
29
|
items: Reader::Filesystem.new(source_path)
|
24
30
|
)
|
25
31
|
|
26
32
|
@layouts =
|
27
33
|
Core::Collection.new(
|
28
|
-
item_factory:
|
34
|
+
item_factory: layouts_item_factory,
|
29
35
|
items: Reader::Filesystem.new(layouts_path)
|
30
36
|
)
|
31
37
|
|
data/lib/munge/util/path.rb
CHANGED
@@ -17,6 +17,13 @@ module Munge
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.basename_one_extension(path)
|
21
|
+
basename = File.basename(path)
|
22
|
+
basename_parts = basename.split(".")
|
23
|
+
|
24
|
+
basename_parts[0..1].join(".")
|
25
|
+
end
|
26
|
+
|
20
27
|
def self.basename_no_extension(path)
|
21
28
|
basename = File.basename(path)
|
22
29
|
basename_parts = basename.split(".")
|
data/lib/munge/version.rb
CHANGED
data/lib/munge.rb
CHANGED
@@ -11,10 +11,13 @@ require "munge/item"
|
|
11
11
|
require "munge/util/path"
|
12
12
|
require "munge/util/symbol_hash"
|
13
13
|
require "munge/util/config"
|
14
|
+
require "munge/helper/asset_tags"
|
15
|
+
require "munge/helper/asset_urls"
|
14
16
|
require "munge/helper/capture"
|
15
17
|
require "munge/helper/find"
|
16
18
|
require "munge/helper/link"
|
17
19
|
require "munge/helper/rendering"
|
20
|
+
require "munge/helper/tag"
|
18
21
|
require "munge/transformer/tilt"
|
19
22
|
require "munge/readers/filesystem"
|
20
23
|
require "munge/routers/auto_add_extension"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module AssetRoots
|
2
|
+
module_function
|
3
|
+
|
4
|
+
def images_root
|
5
|
+
"assets/images"
|
6
|
+
end
|
7
|
+
|
8
|
+
def stylesheets_root
|
9
|
+
"assets/stylesheets"
|
10
|
+
end
|
11
|
+
|
12
|
+
def javascripts_root
|
13
|
+
"assets/javascripts"
|
14
|
+
end
|
15
|
+
|
16
|
+
def fonts_root
|
17
|
+
"assets/fonts"
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
system.router.register(
|
2
|
+
Router::Fingerprint.new(
|
3
|
+
extensions: config[:bin_extensions] + config[:bintext_extensions],
|
4
|
+
separator: config[:fingeprint_separator]
|
5
|
+
))
|
6
|
+
system.router.register(
|
7
|
+
Router::RemoveIndexBasename.new(
|
8
|
+
html_extensions: config[:text_extensions],
|
9
|
+
index: config[:index]
|
10
|
+
))
|
11
|
+
system.router.register(
|
12
|
+
Router::AddIndexHtml.new(
|
13
|
+
html_extensions: config[:text_extensions],
|
14
|
+
index: config[:index]
|
15
|
+
))
|
16
|
+
system.router.register(
|
17
|
+
Router::AutoAddExtension.new(
|
18
|
+
keep_extensions: config[:bin_extensions] + config[:bintext_extensions],
|
19
|
+
))
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Sass::Script::Functions
|
2
|
+
include AssetRoots
|
3
|
+
end
|
4
|
+
|
5
|
+
Sass::Script::Functions.send(:define_method, :stringify_string) do |stringish|
|
6
|
+
if stringish.instance_of?(::String)
|
7
|
+
stringish
|
8
|
+
else
|
9
|
+
stringish.value
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
Sass::Script::Functions.send(:define_method, :route) do |id_ruby_string|
|
14
|
+
item = system.source[id_ruby_string]
|
15
|
+
r = system.router.route(item)
|
16
|
+
|
17
|
+
quoted_string(r)
|
18
|
+
end
|
19
|
+
|
20
|
+
Sass::Script::Functions.send(:define_method, :asset_route_helper) do |root, basename|
|
21
|
+
basename_string = stringify_string(basename)
|
22
|
+
|
23
|
+
route("#{root}/#{basename_string}")
|
24
|
+
end
|
25
|
+
|
26
|
+
Sass::Script::Functions.send(:define_method, :font_route) do |basename|
|
27
|
+
asset_route_helper(fonts_root, basename)
|
28
|
+
end
|
29
|
+
|
30
|
+
Sass::Script::Functions.send(:define_method, :image_route) do |basename|
|
31
|
+
asset_route_helper(images_root, basename)
|
32
|
+
end
|
33
|
+
|
34
|
+
Sass::Script::Functions.send(:define_method, :font_url) do |basename|
|
35
|
+
basename_string = stringify_string(basename)
|
36
|
+
|
37
|
+
if basename_string.include?("?")
|
38
|
+
basename_parts = basename_string.split("?")
|
39
|
+
|
40
|
+
base = "#{basename_parts[0]}"
|
41
|
+
qs = "?#{basename_parts[1]}"
|
42
|
+
|
43
|
+
path_to_font = quoted_string(font_route(base).value + qs)
|
44
|
+
|
45
|
+
unquoted_string("url(#{path_to_font})")
|
46
|
+
else
|
47
|
+
unquoted_string("url(#{font_route(basename)})")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Sass::Script::Functions.send(:define_method, :image_url) do |basename|
|
52
|
+
img_route = image_route(basename)
|
53
|
+
unquoted_string("url(#{img_route})")
|
54
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
tilt_transformer = Transformer::Tilt.new(system)
|
2
|
+
tilt_transformer.register(Munge::Helper::Capture)
|
3
|
+
tilt_transformer.register(Munge::Helper::Find)
|
4
|
+
tilt_transformer.register(Munge::Helper::Link)
|
5
|
+
tilt_transformer.register(Munge::Helper::Rendering)
|
6
|
+
tilt_transformer.register(Munge::Helper::Tag)
|
7
|
+
tilt_transformer.register(Munge::Helper::AssetUrls)
|
8
|
+
tilt_transformer.register(Munge::Helper::AssetTags)
|
9
|
+
tilt_transformer.register(AssetRoots)
|
10
|
+
|
11
|
+
system.alterant.register(tilt_transformer)
|
data/seeds/config.yml
CHANGED
@@ -9,13 +9,17 @@ text_extensions:
|
|
9
9
|
- htm
|
10
10
|
- txt
|
11
11
|
- md
|
12
|
-
|
13
|
-
-
|
14
|
-
|
12
|
+
bintext_extensions:
|
13
|
+
- js
|
14
|
+
- css
|
15
|
+
- scss
|
16
|
+
bin_extensions:
|
15
17
|
- gif
|
16
18
|
- ico
|
17
19
|
- jpg
|
18
20
|
- jpeg
|
19
21
|
- png
|
20
|
-
-
|
21
|
-
-
|
22
|
+
- otf
|
23
|
+
- ttf
|
24
|
+
- eot
|
25
|
+
- woff
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset="UTF-8">
|
5
5
|
<title><%= site_name %></title>
|
6
|
-
<link rel="stylesheet" href="<%= url_for(items["basic.css
|
6
|
+
<link rel="stylesheet" href="<%= url_for(items["assets/stylesheets/basic.css"]) %>" media="screen" charset="utf-8">
|
7
7
|
</head>
|
8
8
|
<body>
|
9
9
|
<div class="layout">
|
data/seeds/rules.rb
CHANGED
@@ -1,15 +1,34 @@
|
|
1
1
|
# HTML rules
|
2
2
|
app.source
|
3
3
|
.select { |item| item.extensions.include?("html") }
|
4
|
-
.each { |item| item.route = item.
|
4
|
+
.each { |item| item.route = item.basename }
|
5
5
|
.each { |item| item.layout = "default" }
|
6
6
|
.each { |item| item.transform }
|
7
7
|
|
8
|
+
# Font rules
|
9
|
+
app.source
|
10
|
+
.select { |item| item.relpath?("assets/fonts") }
|
11
|
+
.reject { |item| item.basename[0] == "_" }
|
12
|
+
.each { |item| item.route = item.relpath }
|
13
|
+
|
14
|
+
# Image rules
|
15
|
+
app.source
|
16
|
+
.select { |item| item.relpath?("assets/images") }
|
17
|
+
.reject { |item| item.basename[0] == "_" }
|
18
|
+
.each { |item| item.route = item.relpath }
|
19
|
+
|
20
|
+
# JS rules
|
21
|
+
app.source
|
22
|
+
.select { |item| item.relpath?("assets/javascripts") }
|
23
|
+
.reject { |item| item.basename[0] == "_" }
|
24
|
+
.each { |item| item.route = "/#{item.dirname}/#{item.basename}.js" }
|
25
|
+
.each { |item| item.transform }
|
26
|
+
|
8
27
|
# CSS rules
|
9
28
|
app.source
|
10
|
-
.select { |item| item.
|
29
|
+
.select { |item| item.relpath?("assets/stylesheets") }
|
11
30
|
.reject { |item| item.basename[0] == "_" }
|
12
|
-
.each { |item| item.route = "
|
31
|
+
.each { |item| item.route = "/#{item.dirname}/#{item.basename}.css" }
|
13
32
|
.each { |item| item.transform }
|
14
33
|
|
15
34
|
# Sitemap
|
data/seeds/setup.rb
CHANGED
@@ -1,15 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
tilt_transformer = Transformer::Tilt.new(system)
|
5
|
-
tilt_transformer.register(Munge::Helper::Capture)
|
6
|
-
tilt_transformer.register(Munge::Helper::Find)
|
7
|
-
tilt_transformer.register(Munge::Helper::Link)
|
8
|
-
tilt_transformer.register(Munge::Helper::Rendering)
|
9
|
-
|
10
|
-
system.alterant.register(tilt_transformer)
|
11
|
-
|
12
|
-
system.router.register(Router::Fingerprint.new(extensions: system.config[:keep_extensions], separator: system.config[:fingeprint_separator]))
|
13
|
-
system.router.register(Router::RemoveIndexBasename.new(html_extensions: system.config[:text_extensions], index: system.config[:index]))
|
14
|
-
system.router.register(Router::AddIndexHtml.new(html_extensions: system.config[:text_extensions], index: system.config[:index]))
|
15
|
-
system.router.register(Router::AutoAddExtension.new(keep_extensions: system.config[:keep_extensions]))
|
1
|
+
Dir.glob(File.join(config_path, "*.rb")).sort.each do |file_path|
|
2
|
+
binding.eval(File.read(file_path), file_path)
|
3
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: munge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Ahn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -178,7 +178,7 @@ dependencies:
|
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '3.4'
|
181
|
-
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.5.0
|
181
|
+
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.5.0/README.md
|
182
182
|
email:
|
183
183
|
- zach.ahn@gmail.com
|
184
184
|
executables:
|
@@ -208,10 +208,13 @@ files:
|
|
208
208
|
- lib/munge/core/router.rb
|
209
209
|
- lib/munge/core/router/itemish.rb
|
210
210
|
- lib/munge/core/write.rb
|
211
|
+
- lib/munge/helper/asset_tags.rb
|
212
|
+
- lib/munge/helper/asset_urls.rb
|
211
213
|
- lib/munge/helper/capture.rb
|
212
214
|
- lib/munge/helper/find.rb
|
213
215
|
- lib/munge/helper/link.rb
|
214
216
|
- lib/munge/helper/rendering.rb
|
217
|
+
- lib/munge/helper/tag.rb
|
215
218
|
- lib/munge/item.rb
|
216
219
|
- lib/munge/readers/filesystem.rb
|
217
220
|
- lib/munge/routers/add_index_html.rb
|
@@ -228,14 +231,22 @@ files:
|
|
228
231
|
- munge.gemspec
|
229
232
|
- seeds/Gemfile.tt
|
230
233
|
- seeds/config.yml
|
234
|
+
- seeds/config/_asset_roots.rb
|
235
|
+
- seeds/config/routing.rb
|
236
|
+
- seeds/config/sass.rb
|
237
|
+
- seeds/config/sass_helpers.rb
|
238
|
+
- seeds/config/view_helpers.rb
|
231
239
|
- seeds/data.yml
|
232
240
|
- seeds/layouts/default.html.erb
|
233
241
|
- seeds/layouts/sitemap.html.erb
|
234
242
|
- seeds/rules.rb
|
235
243
|
- seeds/setup.rb
|
236
|
-
- seeds/src/_vars.scss
|
237
244
|
- seeds/src/about.html.erb
|
238
|
-
- seeds/src/
|
245
|
+
- seeds/src/assets/fonts/.empty_directory
|
246
|
+
- seeds/src/assets/images/.empty_directory
|
247
|
+
- seeds/src/assets/javascripts/.empty_directory
|
248
|
+
- seeds/src/assets/stylesheets/_vars.scss
|
249
|
+
- seeds/src/assets/stylesheets/basic.css.scss
|
239
250
|
- seeds/src/index.html.erb
|
240
251
|
homepage: https://github.com/zachahn/munge
|
241
252
|
licenses:
|
@@ -252,9 +263,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
252
263
|
version: '0'
|
253
264
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
254
265
|
requirements:
|
255
|
-
- - "
|
266
|
+
- - ">="
|
256
267
|
- !ruby/object:Gem::Version
|
257
|
-
version:
|
268
|
+
version: '0'
|
258
269
|
requirements: []
|
259
270
|
rubyforge_project:
|
260
271
|
rubygems_version: 2.4.5
|