munge 0.15.1 → 0.16.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/cli/commands/build.rb +1 -0
- data/lib/munge/cli/commands/server.rb +37 -5
- data/lib/munge/cli/dispatch.rb +2 -1
- data/lib/munge/config.rb +2 -0
- data/lib/munge/extras/livereload/messaging.rb +40 -0
- data/lib/munge/extras/livereload/server.rb +57 -0
- data/lib/munge/extras/livereload/update_client.rb +19 -0
- data/lib/munge/extras/livereload/update_server.rb +14 -0
- data/lib/munge/extras/livereload/vendor/livereload.js +1183 -0
- data/lib/munge/extras/livereload.rb +32 -0
- data/lib/munge/helpers/livereload.rb +19 -0
- data/lib/munge/helpers/tag.rb +7 -2
- data/lib/munge/runner.rb +5 -0
- data/lib/munge/system/item_factory/content_parser.rb +1 -1
- data/lib/munge/version.rb +1 -1
- data/lib/munge.rb +3 -0
- data/munge.gemspec +4 -0
- data/seeds/config.rb +1 -1
- data/seeds/lib/view_helpers.rb +1 -0
- metadata +24 -4
@@ -0,0 +1,32 @@
|
|
1
|
+
if Gem.loaded_specs.key?("reel")
|
2
|
+
require "celluloid/current"
|
3
|
+
require "reel"
|
4
|
+
|
5
|
+
require "munge/extras/livereload/update_server"
|
6
|
+
require "munge/extras/livereload/update_client"
|
7
|
+
require "munge/extras/livereload/messaging"
|
8
|
+
require "munge/extras/livereload/server"
|
9
|
+
end
|
10
|
+
|
11
|
+
module Munge
|
12
|
+
module Extras
|
13
|
+
module Livereload
|
14
|
+
class Main
|
15
|
+
def initialize(activated)
|
16
|
+
@activated = activated
|
17
|
+
|
18
|
+
if @activated
|
19
|
+
Server.supervise
|
20
|
+
@updater = UpdateServer.new
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def notify_changes(files:)
|
25
|
+
if @activated
|
26
|
+
@updater.notify(files)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Munge
|
2
|
+
module Helpers
|
3
|
+
module Livereload
|
4
|
+
def livereload_script(force: false)
|
5
|
+
should_show = ENV["MUNGE_ENV"] == "development" && Gem.loaded_specs.key?("reel")
|
6
|
+
|
7
|
+
loading_script =
|
8
|
+
%q{document.write('<script src="http://'} +
|
9
|
+
%q{ + (location.host || 'localhost').split(':')[0]} +
|
10
|
+
%q{ + ':35729/livereload.js?snipver=1"></'} +
|
11
|
+
%q{ + 'script>')}
|
12
|
+
|
13
|
+
if should_show || force
|
14
|
+
content_tag(:script, loading_script)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/munge/helpers/tag.rb
CHANGED
@@ -17,7 +17,12 @@ module Munge
|
|
17
17
|
content = nil
|
18
18
|
end
|
19
19
|
|
20
|
-
options_str =
|
20
|
+
options_str =
|
21
|
+
if options.any?
|
22
|
+
" " + options.map { |k, v| %(#{k}="#{h(v)}") }.join(" ")
|
23
|
+
else
|
24
|
+
""
|
25
|
+
end
|
21
26
|
|
22
27
|
content_str =
|
23
28
|
if content
|
@@ -28,7 +33,7 @@ module Munge
|
|
28
33
|
""
|
29
34
|
end
|
30
35
|
|
31
|
-
"<#{name}
|
36
|
+
"<#{name}#{options_str}>#{content_str}</#{name}>"
|
32
37
|
end
|
33
38
|
|
34
39
|
def h(string)
|
data/lib/munge/runner.rb
CHANGED
@@ -8,6 +8,7 @@ module Munge
|
|
8
8
|
@reporter = Munge::Reporter.new(formatter: formatter, verbosity: verbosity)
|
9
9
|
@write_manager = Munge::WriteManager.new(driver: File)
|
10
10
|
@destination = destination
|
11
|
+
@written_items = []
|
11
12
|
end
|
12
13
|
|
13
14
|
def write
|
@@ -18,6 +19,8 @@ module Munge
|
|
18
19
|
.each { |item| render_and_write(item) }
|
19
20
|
|
20
21
|
@reporter.done
|
22
|
+
|
23
|
+
@written_items
|
21
24
|
end
|
22
25
|
|
23
26
|
private
|
@@ -25,6 +28,7 @@ module Munge
|
|
25
28
|
def render_and_write(item)
|
26
29
|
relpath = @router.filepath(item)
|
27
30
|
abspath = File.join(@destination, relpath)
|
31
|
+
route = @router.route(item)
|
28
32
|
content = @processor.transform(item)
|
29
33
|
|
30
34
|
write_status = @write_manager.status(abspath, content)
|
@@ -32,6 +36,7 @@ module Munge
|
|
32
36
|
case write_status
|
33
37
|
when :new, :changed
|
34
38
|
@writer.write(abspath, content)
|
39
|
+
@written_items.push(route)
|
35
40
|
when :double_write_error
|
36
41
|
raise Errors::DoubleWriteError, item.route
|
37
42
|
when :identical
|
data/lib/munge/version.rb
CHANGED
data/lib/munge.rb
CHANGED
@@ -48,8 +48,11 @@ require "munge/helpers/find"
|
|
48
48
|
require "munge/helpers/link"
|
49
49
|
require "munge/helpers/rendering"
|
50
50
|
require "munge/helpers/tag"
|
51
|
+
require "munge/helpers/livereload"
|
51
52
|
require "munge/routers/auto_add_extension"
|
52
53
|
require "munge/routers/fingerprint"
|
53
54
|
require "munge/routers/add_directory_index"
|
54
55
|
require "munge/routers/remove_index_basename"
|
55
56
|
require "munge/transformers/tilt_transformer"
|
57
|
+
|
58
|
+
require "munge/extras/livereload"
|
data/munge.gemspec
CHANGED
@@ -45,6 +45,10 @@ Gem::Specification.new do |spec|
|
|
45
45
|
spec.add_runtime_dependency "tilt", "~> 2.0"
|
46
46
|
spec.add_runtime_dependency "sass", "~> 3.4"
|
47
47
|
|
48
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.2.2")
|
49
|
+
spec.add_runtime_dependency "reel", "~> 0.6"
|
50
|
+
end
|
51
|
+
|
48
52
|
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.3")
|
49
53
|
spec.add_runtime_dependency "rack", ">= 1.0", "< 2.0"
|
50
54
|
end
|
data/seeds/config.rb
CHANGED
data/seeds/lib/view_helpers.rb
CHANGED
@@ -6,6 +6,7 @@ tilt_transformer.register(Munge::Helpers::Rendering)
|
|
6
6
|
tilt_transformer.register(Munge::Helpers::Tag)
|
7
7
|
tilt_transformer.register(Munge::Helpers::AssetPaths)
|
8
8
|
tilt_transformer.register(Munge::Helpers::AssetTags)
|
9
|
+
tilt_transformer.register(Munge::Helpers::Livereload)
|
9
10
|
tilt_transformer.register(AssetRoots)
|
10
11
|
|
11
12
|
system.processor.register(tilt_transformer)
|
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.16.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-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -288,7 +288,21 @@ dependencies:
|
|
288
288
|
- - "~>"
|
289
289
|
- !ruby/object:Gem::Version
|
290
290
|
version: '3.4'
|
291
|
-
|
291
|
+
- !ruby/object:Gem::Dependency
|
292
|
+
name: reel
|
293
|
+
requirement: !ruby/object:Gem::Requirement
|
294
|
+
requirements:
|
295
|
+
- - "~>"
|
296
|
+
- !ruby/object:Gem::Version
|
297
|
+
version: '0.6'
|
298
|
+
type: :runtime
|
299
|
+
prerelease: false
|
300
|
+
version_requirements: !ruby/object:Gem::Requirement
|
301
|
+
requirements:
|
302
|
+
- - "~>"
|
303
|
+
- !ruby/object:Gem::Version
|
304
|
+
version: '0.6'
|
305
|
+
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.16.0/README.md
|
292
306
|
email:
|
293
307
|
- zach.ahn@gmail.com
|
294
308
|
executables:
|
@@ -312,6 +326,12 @@ files:
|
|
312
326
|
- lib/munge/cli/dispatch.rb
|
313
327
|
- lib/munge/config.rb
|
314
328
|
- lib/munge/errors.rb
|
329
|
+
- lib/munge/extras/livereload.rb
|
330
|
+
- lib/munge/extras/livereload/messaging.rb
|
331
|
+
- lib/munge/extras/livereload/server.rb
|
332
|
+
- lib/munge/extras/livereload/update_client.rb
|
333
|
+
- lib/munge/extras/livereload/update_server.rb
|
334
|
+
- lib/munge/extras/livereload/vendor/livereload.js
|
315
335
|
- lib/munge/formatters/default.rb
|
316
336
|
- lib/munge/formatters/dots.rb
|
317
337
|
- lib/munge/go/sass.rb
|
@@ -321,6 +341,7 @@ files:
|
|
321
341
|
- lib/munge/helpers/capture.rb
|
322
342
|
- lib/munge/helpers/find.rb
|
323
343
|
- lib/munge/helpers/link.rb
|
344
|
+
- lib/munge/helpers/livereload.rb
|
324
345
|
- lib/munge/helpers/rendering.rb
|
325
346
|
- lib/munge/helpers/tag.rb
|
326
347
|
- lib/munge/init.rb
|
@@ -401,4 +422,3 @@ signing_key:
|
|
401
422
|
specification_version: 4
|
402
423
|
summary: Static site generator aiming to simplify complex build rules
|
403
424
|
test_files: []
|
404
|
-
has_rdoc:
|