munge 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +17 -7
- data/lib/munge/cli/dispatch.rb +2 -2
- data/lib/munge/extras/livereload/server.rb +8 -0
- data/lib/munge/item.rb +8 -0
- data/lib/munge/runner.rb +0 -2
- data/lib/munge/system/item_factory.rb +2 -2
- data/lib/munge/version.rb +1 -1
- data/seeds/Gemfile.tt +2 -2
- data/seeds/layouts/blog.html.erb +5 -0
- data/seeds/layouts/blog_archives.html.erb +1 -1
- data/seeds/layouts/blog_index.html.erb +2 -3
- data/seeds/layouts/blog_show.html.erb +1 -1
- data/seeds/rules.rb +2 -1
- data/seeds/src/blog/01-first-post.html +3 -0
- data/seeds/src/blog/02-second-post.html +3 -0
- data/seeds/src/blog/03-third-post.draft.html +3 -0
- data/seeds/src/home/index.html.erb +3 -2
- metadata +7 -6
- data/seeds/src/blog/01-first-post.md +0 -3
- data/seeds/src/blog/02-second-post.md +0 -3
- data/seeds/src/blog/03-third-post.draft.md +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94019c2c419a44b2c4be2aca94cbc587e7875439
|
4
|
+
data.tar.gz: b8113ced2804eb5b33093ba9a33da97324fbbb7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a75c4565e8cf70ca137a5516b5d320300dc51d181f28fa5c18b69c68aee7fe2e0d9f86a353c152b89552a1979a85059fb7025279e1aada0e2150597d1ed51d51
|
7
|
+
data.tar.gz: b1a255bde2c32b711c5751261a5eb2c5545a5f3aeb1e433c151059fb8549d9202eeb3a157b2cc0733caf54679de8a79f8d8c396d4f748248cfb7acfde75ba943
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,9 @@
|
|
6
6
|
|
7
7
|
Munge is a static site generator aiming to simplify complex build rules.
|
8
8
|
|
9
|
+
It's built partially to emulate unix pipes and scripts; small transformations
|
10
|
+
can be joined, composed, and applied to create almost any site you can think up.
|
11
|
+
|
9
12
|
SemVer will be followed once 1.0.0 is released.
|
10
13
|
Until then,
|
11
14
|
the API should be considered experimental.
|
@@ -13,16 +16,22 @@ the API should be considered experimental.
|
|
13
16
|
|
14
17
|
## Features
|
15
18
|
|
19
|
+
- No DSL
|
16
20
|
- No metaprogramming
|
17
|
-
-
|
21
|
+
- LiveReload
|
22
|
+
- Optional frontmatter
|
23
|
+
- Suitable for large, complex sites (e.g., multiple blogs with different
|
24
|
+
templates, a single blog with multiple data sources)
|
25
|
+
- Very configurable
|
18
26
|
- Concise rule definition
|
19
|
-
- Rules defined by iterating through arrays and modifying objects
|
27
|
+
- Rules defined by iterating through arrays and modifying matching objects
|
20
28
|
|
21
29
|
|
22
30
|
## Caveats
|
23
31
|
|
24
|
-
- Not optimized (Pull requests welcome, gradual optimizations preferred)
|
25
|
-
-
|
32
|
+
- Not yet optimized (Pull requests welcome, gradual optimizations preferred)
|
33
|
+
- User facing API has mostly stabilized, but plugins have yet to be fully worked
|
34
|
+
out
|
26
35
|
|
27
36
|
|
28
37
|
## Installation
|
@@ -30,7 +39,7 @@ the API should be considered experimental.
|
|
30
39
|
Add this line to your application's Gemfile:
|
31
40
|
|
32
41
|
```ruby
|
33
|
-
gem
|
42
|
+
gem "munge"
|
34
43
|
```
|
35
44
|
|
36
45
|
And then execute:
|
@@ -49,8 +58,9 @@ After installing your gem, you can start a project using the command line client
|
|
49
58
|
```bash
|
50
59
|
munge init path/to/project # create a barebones project
|
51
60
|
cd path/to/project
|
52
|
-
munge
|
53
|
-
munge
|
61
|
+
munge server # starts auto-compiling dev server http://localhost:7000/
|
62
|
+
munge build # compiles your project for production
|
63
|
+
munge view # preview production build on http://localhost:7000/
|
54
64
|
```
|
55
65
|
|
56
66
|
The three main files of your application are `config.yml`, `data.yml`, and `rules.rb`.
|
data/lib/munge/cli/dispatch.rb
CHANGED
@@ -8,8 +8,8 @@ module Munge
|
|
8
8
|
end
|
9
9
|
|
10
10
|
desc "build", "Build site"
|
11
|
-
method_option :reporter,
|
12
|
-
method_option :dry_run,
|
11
|
+
method_option :reporter, desc: "Set reporting formatter", default: "Default", type: :string
|
12
|
+
method_option :dry_run, desc: "Run without writing files", default: false, type: :boolean
|
13
13
|
method_option :verbosity, aliases: "-v", desc: "Preferred amount of output", enum: %w(all written silent), default: "written", type: :string
|
14
14
|
def build
|
15
15
|
ENV["MUNGE_ENV"] ||= "production"
|
@@ -16,10 +16,13 @@ module Munge
|
|
16
16
|
socket << @messaging.reload(file)
|
17
17
|
end
|
18
18
|
rescue Reel::SocketError
|
19
|
+
print_error("error pushing livereload notification to browser")
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
24
|
+
private
|
25
|
+
|
23
26
|
def on_connection(connection)
|
24
27
|
connection.each_request do |request|
|
25
28
|
if request.websocket?
|
@@ -41,6 +44,7 @@ module Munge
|
|
41
44
|
end
|
42
45
|
end
|
43
46
|
rescue Reel::SocketError
|
47
|
+
print_error("error with livereload socket")
|
44
48
|
end
|
45
49
|
|
46
50
|
def handle_request(request)
|
@@ -51,6 +55,10 @@ module Munge
|
|
51
55
|
request.respond(:not_found, "not found")
|
52
56
|
end
|
53
57
|
end
|
58
|
+
|
59
|
+
def print_error(message)
|
60
|
+
$stderr.puts(message)
|
61
|
+
end
|
54
62
|
end
|
55
63
|
end
|
56
64
|
end
|
data/lib/munge/item.rb
CHANGED
@@ -41,6 +41,14 @@ module Munge
|
|
41
41
|
Munge::Util::Path.basename_no_extension(@relpath)
|
42
42
|
end
|
43
43
|
|
44
|
+
# @return [String] relpath, without extensions
|
45
|
+
def basepath
|
46
|
+
dirname = Munge::Util::Path.dirname(@relpath)
|
47
|
+
basename = Munge::Util::Path.basename_no_extension(@relpath)
|
48
|
+
|
49
|
+
Munge::Util::Path.join(dirname, basename)
|
50
|
+
end
|
51
|
+
|
44
52
|
# @return [Array<String>] extensions (everything following the first ".")
|
45
53
|
def extensions
|
46
54
|
Munge::Util::Path.extnames(@relpath)
|
data/lib/munge/runner.rb
CHANGED
@@ -60,14 +60,14 @@ module Munge
|
|
60
60
|
private
|
61
61
|
|
62
62
|
def item_file_type(abspath)
|
63
|
-
if
|
63
|
+
if text_file_extension?(abspath)
|
64
64
|
:text
|
65
65
|
else
|
66
66
|
:binary
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
def
|
70
|
+
def text_file_extension?(filepath)
|
71
71
|
extensions = Munge::Util::Path.extnames(filepath)
|
72
72
|
intersection = extensions & @text_extensions
|
73
73
|
|
data/lib/munge/version.rb
CHANGED
data/seeds/Gemfile.tt
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem
|
3
|
+
gem "munge", "~> <%= Munge::VERSION %>"
|
data/seeds/rules.rb
CHANGED
@@ -32,7 +32,8 @@ app.create("blog-archive.html.erb", "", posts: blog_public_items)
|
|
32
32
|
# Home page rules
|
33
33
|
app.nonrouted
|
34
34
|
.select { |item| item.relpath?("home") }
|
35
|
-
.
|
35
|
+
.select { |item| item.type == :text }
|
36
|
+
.each { |item| item.route = "#{item.basepath.sub(%r{^home/}, "")}" }
|
36
37
|
.each { |item| item.layout = "default" }
|
37
38
|
.each(&transform)
|
38
39
|
|
@@ -22,10 +22,11 @@ title: Woohoo!
|
|
22
22
|
</p>
|
23
23
|
|
24
24
|
<p>
|
25
|
-
<strong><code>config.
|
25
|
+
<strong><code>config.rb</code>:</strong>
|
26
26
|
The keys defined here are used to change the behavior of the app.
|
27
27
|
Many of the keys are passed directly into the initializers in
|
28
|
-
<code>setup.rb</code>.
|
28
|
+
<code>setup.rb</code>. It is possible to create arbitrary configuration keys
|
29
|
+
and use them in custom plugins, etc.
|
29
30
|
</p>
|
30
31
|
|
31
32
|
<h2>Example Links</h2>
|
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.17.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: 2017-
|
11
|
+
date: 2017-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -302,7 +302,7 @@ dependencies:
|
|
302
302
|
- - "~>"
|
303
303
|
- !ruby/object:Gem::Version
|
304
304
|
version: '0.6'
|
305
|
-
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.
|
305
|
+
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.17.0/README.md
|
306
306
|
email:
|
307
307
|
- zach.ahn@gmail.com
|
308
308
|
executables:
|
@@ -376,6 +376,7 @@ files:
|
|
376
376
|
- seeds/Gemfile.tt
|
377
377
|
- seeds/config.rb
|
378
378
|
- seeds/data.yml
|
379
|
+
- seeds/layouts/blog.html.erb
|
379
380
|
- seeds/layouts/blog_archives.html.erb
|
380
381
|
- seeds/layouts/blog_index.html.erb
|
381
382
|
- seeds/layouts/blog_show.html.erb
|
@@ -392,9 +393,9 @@ files:
|
|
392
393
|
- seeds/src/assets/javascripts/.empty_directory
|
393
394
|
- seeds/src/assets/stylesheets/_vars.scss
|
394
395
|
- seeds/src/assets/stylesheets/basic.css.scss
|
395
|
-
- seeds/src/blog/01-first-post.
|
396
|
-
- seeds/src/blog/02-second-post.
|
397
|
-
- seeds/src/blog/03-third-post.draft.
|
396
|
+
- seeds/src/blog/01-first-post.html
|
397
|
+
- seeds/src/blog/02-second-post.html
|
398
|
+
- seeds/src/blog/03-third-post.draft.html
|
398
399
|
- seeds/src/home/about.html.erb
|
399
400
|
- seeds/src/home/index.html.erb
|
400
401
|
homepage: https://github.com/zachahn/munge
|