munge 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/munge/helpers/asset_tags.rb +10 -4
- data/lib/munge/helpers/link.rb +1 -1
- data/lib/munge/system/item_factory/item_identifier.rb +1 -1
- data/lib/munge/version.rb +1 -1
- data/seeds/layouts/blog_archives.html.erb +7 -0
- data/seeds/layouts/blog_index.html.erb +7 -0
- data/seeds/layouts/blog_show.html.erb +3 -0
- data/seeds/lib/routing.rb +8 -4
- data/seeds/rules.rb +52 -22
- data/seeds/src/blog/01-first-post.md +3 -0
- data/seeds/src/blog/02-second-post.md +3 -0
- data/seeds/src/blog/03-third-post.draft.md +3 -0
- data/seeds/src/{about.html.erb → home/about.html.erb} +0 -2
- data/seeds/src/{index.html.erb → home/index.html.erb} +9 -4
- metadata +12 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a89ec9386b6243aad9b81eefacf82593e7ed7398
|
4
|
+
data.tar.gz: 207829f90d9401f2e67515ab50c8bbfb236d1bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88bda267fc35cf2ff6b74e4e2500505aca408d306fabdc2201386721d82b801cb1bd70ee43f015caec48356d13b84f5f8c5d2922d2c2da34b03fa695996dceaa
|
7
|
+
data.tar.gz: acd79ec11a7b1fc356aaa3323e51c748bcbbf24add3d37ebc826dd510a8dacfb9cc9d73efdaa15c7fd0d11087987bec2a94fe880e74af332599d78aa14a7335c
|
data/README.md
CHANGED
@@ -15,18 +15,24 @@ module Munge
|
|
15
15
|
content_tag(:script, options)
|
16
16
|
end
|
17
17
|
|
18
|
+
def image_tag(basename, options = {})
|
19
|
+
options[:src] ||= image_path(basename)
|
20
|
+
|
21
|
+
empty_tag(:img, options)
|
22
|
+
end
|
23
|
+
|
18
24
|
def inline_stylesheet_tag(basename, options = {})
|
19
|
-
inline_asset_tag_helper(
|
25
|
+
inline_asset_tag_helper(:stylesheet_path, basename, :style, options)
|
20
26
|
end
|
21
27
|
|
22
28
|
def inline_javascript_tag(basename, options = {})
|
23
|
-
inline_asset_tag_helper(
|
29
|
+
inline_asset_tag_helper(:javascript_path, basename, :script, options)
|
24
30
|
end
|
25
31
|
|
26
32
|
private
|
27
33
|
|
28
|
-
def inline_asset_tag_helper(
|
29
|
-
rendered_asset = render(
|
34
|
+
def inline_asset_tag_helper(asset_path_method, basename, tag, options)
|
35
|
+
rendered_asset = render(send(asset_path_method, basename))
|
30
36
|
|
31
37
|
content_tag(tag, rendered_asset, options)
|
32
38
|
end
|
data/lib/munge/helpers/link.rb
CHANGED
@@ -7,7 +7,7 @@ module Munge
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(relpath)
|
10
|
-
dirname = Munge::Util::Path.dirname(relpath)
|
10
|
+
dirname = Munge::Util::Path.ensure_relpath(Munge::Util::Path.dirname(relpath))
|
11
11
|
basename = Munge::Util::Path.basename_no_extension(relpath)
|
12
12
|
extensions = Munge::Util::Path.extnames(relpath)
|
13
13
|
|
data/lib/munge/version.rb
CHANGED
data/seeds/lib/routing.rb
CHANGED
@@ -3,22 +3,26 @@ if ENV["MUNGE_ENV"] == "production"
|
|
3
3
|
Routers::Fingerprint.new(
|
4
4
|
extensions: config[:bin_extensions] + config[:bintext_extensions],
|
5
5
|
separator: config[:fingeprint_separator]
|
6
|
-
)
|
6
|
+
)
|
7
|
+
)
|
7
8
|
end
|
8
9
|
|
9
10
|
system.router.register(
|
10
11
|
Routers::RemoveIndexBasename.new(
|
11
12
|
html_extensions: config[:text_extensions],
|
12
13
|
index: config[:index]
|
13
|
-
)
|
14
|
+
)
|
15
|
+
)
|
14
16
|
|
15
17
|
system.router.register(
|
16
18
|
Routers::AddIndexHtml.new(
|
17
19
|
html_extensions: config[:text_extensions],
|
18
20
|
index: config[:index]
|
19
|
-
)
|
21
|
+
)
|
22
|
+
)
|
20
23
|
|
21
24
|
system.router.register(
|
22
25
|
Routers::AutoAddExtension.new(
|
23
26
|
keep_extensions: config[:bin_extensions] + config[:bintext_extensions]
|
24
|
-
)
|
27
|
+
)
|
28
|
+
)
|
data/seeds/rules.rb
CHANGED
@@ -1,35 +1,65 @@
|
|
1
|
-
#
|
1
|
+
# General route helpers
|
2
|
+
transform = -> (item) { item.transform }
|
3
|
+
|
4
|
+
# Blog rules
|
5
|
+
blog_items =
|
6
|
+
app.nonrouted
|
7
|
+
.select { |item| item.relpath?("blog") }
|
8
|
+
.sort_by { |item| item.basename }
|
9
|
+
.each { |item| item[:hide] = item.extensions.include?("draft") }
|
10
|
+
.each { |item| item[:text] = item.content.valid_encoding? }
|
11
|
+
.each { |item| item.route = "blog/#{item.basename}" }
|
12
|
+
.reverse
|
13
|
+
|
14
|
+
blog_public_items = blog_items.select { |i| !i[:hide] && i[:text] }
|
15
|
+
blog_index_items = blog_public_items[0..7]
|
16
|
+
|
17
|
+
blog_items
|
18
|
+
.select { |item| item[:text] }
|
19
|
+
.each { |item| item.layout = "blog_show" }
|
20
|
+
.each(&transform)
|
21
|
+
|
22
|
+
app.create("blog-index.html.erb", "", posts: blog_index_items)
|
23
|
+
.each { |item| item.route = "blog" }
|
24
|
+
.each { |item| item.layout = "blog_index" }
|
25
|
+
.each(&transform)
|
26
|
+
|
27
|
+
app.create("blog-archive.html.erb", "", posts: blog_public_items)
|
28
|
+
.each { |item| item.route = "blog/archives" }
|
29
|
+
.each { |item| item.layout = "blog_archives" }
|
30
|
+
.each(&transform)
|
31
|
+
|
32
|
+
# Home page rules
|
2
33
|
app.nonrouted
|
3
|
-
.select { |item| item.
|
4
|
-
.each { |item| item.route = item.
|
34
|
+
.select { |item| item.relpath?("home") }
|
35
|
+
.each { |item| item.route = "#{item.id.sub(%r{^home/}, "")}" }
|
5
36
|
.each { |item| item.layout = "default" }
|
6
|
-
.each
|
37
|
+
.each(&transform)
|
38
|
+
|
39
|
+
# Asset route helpers
|
40
|
+
def app_asset(subdir)
|
41
|
+
app.nonrouted
|
42
|
+
.select { |item| item.relpath?("assets/#{subdir}") }
|
43
|
+
.reject { |item| item.basename[0] == "_" }
|
44
|
+
end
|
7
45
|
|
8
46
|
# Font rules
|
9
|
-
|
10
|
-
.
|
11
|
-
.reject { |item| item.basename[0] == "_" }
|
12
|
-
.each { |item| item.route = item.relpath }
|
47
|
+
app_asset("fonts")
|
48
|
+
.each { |item| item.route = "/assets/#{item.filename}" }
|
13
49
|
|
14
50
|
# Image rules
|
15
|
-
|
16
|
-
.
|
17
|
-
.reject { |item| item.basename[0] == "_" }
|
18
|
-
.each { |item| item.route = item.relpath }
|
51
|
+
app_asset("images")
|
52
|
+
.each { |item| item.route = "/assets/#{item.filename}" }
|
19
53
|
|
20
54
|
# JS rules
|
21
|
-
|
22
|
-
.
|
23
|
-
.
|
24
|
-
.each { |item| item.route = "/#{item.dirname}/#{item.basename}.js" }
|
25
|
-
.each { |item| item.transform }
|
55
|
+
app_asset("javascripts")
|
56
|
+
.each { |item| item.route = "/assets/#{item.basename}.js" }
|
57
|
+
.each(&transform)
|
26
58
|
|
27
59
|
# CSS rules
|
28
|
-
|
29
|
-
.
|
30
|
-
.
|
31
|
-
.each { |item| item.route = "/#{item.dirname}/#{item.basename}.css" }
|
32
|
-
.each { |item| item.transform }
|
60
|
+
app_asset("stylesheets")
|
61
|
+
.each { |item| item.route = "/assets/#{item.basename}.css" }
|
62
|
+
.each(&transform)
|
33
63
|
|
34
64
|
# Sitemap
|
35
65
|
html_pages =
|
@@ -1,5 +1,5 @@
|
|
1
1
|
---
|
2
|
-
title:
|
2
|
+
title: Woohoo!
|
3
3
|
---
|
4
4
|
|
5
5
|
<h1><%= title %></h1>
|
@@ -28,12 +28,17 @@ title: Welcome
|
|
28
28
|
<code>setup.rb</code>.
|
29
29
|
</p>
|
30
30
|
|
31
|
-
<h2>Links</h2>
|
31
|
+
<h2>Example Links</h2>
|
32
|
+
|
33
|
+
<ul>
|
34
|
+
<li><%= link_to(items["blog-index.html"], "Example blog") %></li>
|
35
|
+
<li><%= link_to(items["home/about.html"], "Example page") %></li>
|
36
|
+
</ul>
|
37
|
+
|
38
|
+
<h2>Munge Links</h2>
|
32
39
|
|
33
40
|
<ul>
|
34
41
|
<li><a href="https://github.com/zachahn/munge">Munge homepage</a></li>
|
35
42
|
<li><a href="https://github.com/zachahn/munge/issues">Munge issues</a></li>
|
36
43
|
<li><a href="https://rubygems.org/gems/munge">Gem homepage</a></li>
|
37
44
|
</ul>
|
38
|
-
|
39
|
-
<%= render(layouts["sitemap"]) %>
|
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.
|
4
|
+
version: 0.14.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-
|
11
|
+
date: 2016-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -288,27 +288,7 @@ dependencies:
|
|
288
288
|
- - "~>"
|
289
289
|
- !ruby/object:Gem::Version
|
290
290
|
version: '3.4'
|
291
|
-
|
292
|
-
name: rack
|
293
|
-
requirement: !ruby/object:Gem::Requirement
|
294
|
-
requirements:
|
295
|
-
- - ">="
|
296
|
-
- !ruby/object:Gem::Version
|
297
|
-
version: '1.0'
|
298
|
-
- - "<"
|
299
|
-
- !ruby/object:Gem::Version
|
300
|
-
version: '2.0'
|
301
|
-
type: :runtime
|
302
|
-
prerelease: false
|
303
|
-
version_requirements: !ruby/object:Gem::Requirement
|
304
|
-
requirements:
|
305
|
-
- - ">="
|
306
|
-
- !ruby/object:Gem::Version
|
307
|
-
version: '1.0'
|
308
|
-
- - "<"
|
309
|
-
- !ruby/object:Gem::Version
|
310
|
-
version: '2.0'
|
311
|
-
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.13.0/README.md
|
291
|
+
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.14.0/README.md
|
312
292
|
email:
|
313
293
|
- zach.ahn@gmail.com
|
314
294
|
executables:
|
@@ -373,6 +353,9 @@ files:
|
|
373
353
|
- seeds/Gemfile.tt
|
374
354
|
- seeds/config.yml
|
375
355
|
- seeds/data.yml
|
356
|
+
- seeds/layouts/blog_archives.html.erb
|
357
|
+
- seeds/layouts/blog_index.html.erb
|
358
|
+
- seeds/layouts/blog_show.html.erb
|
376
359
|
- seeds/layouts/default.html.erb
|
377
360
|
- seeds/layouts/sitemap.html.erb
|
378
361
|
- seeds/lib/_asset_roots.rb
|
@@ -381,13 +364,16 @@ files:
|
|
381
364
|
- seeds/lib/view_helpers.rb
|
382
365
|
- seeds/rules.rb
|
383
366
|
- seeds/setup.rb
|
384
|
-
- seeds/src/about.html.erb
|
385
367
|
- seeds/src/assets/fonts/.empty_directory
|
386
368
|
- seeds/src/assets/images/.empty_directory
|
387
369
|
- seeds/src/assets/javascripts/.empty_directory
|
388
370
|
- seeds/src/assets/stylesheets/_vars.scss
|
389
371
|
- seeds/src/assets/stylesheets/basic.css.scss
|
390
|
-
- seeds/src/
|
372
|
+
- seeds/src/blog/01-first-post.md
|
373
|
+
- seeds/src/blog/02-second-post.md
|
374
|
+
- seeds/src/blog/03-third-post.draft.md
|
375
|
+
- seeds/src/home/about.html.erb
|
376
|
+
- seeds/src/home/index.html.erb
|
391
377
|
homepage: https://github.com/zachahn/munge
|
392
378
|
licenses:
|
393
379
|
- MIT
|
@@ -408,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
408
394
|
version: '0'
|
409
395
|
requirements: []
|
410
396
|
rubyforge_project:
|
411
|
-
rubygems_version: 2.
|
397
|
+
rubygems_version: 2.5.2
|
412
398
|
signing_key:
|
413
399
|
specification_version: 4
|
414
400
|
summary: Static site generator aiming to simplify complex build rules
|