munge 0.10.0 → 0.11.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 +16 -12
- data/lib/munge/cli/commands/init.rb +42 -0
- data/lib/munge/cli/commands/server.rb +43 -0
- data/lib/munge/cli/commands/view.rb +16 -5
- data/lib/munge/cli/dispatch.rb +19 -31
- data/lib/munge/cli.rb +8 -2
- data/lib/munge/formatters/default.rb +73 -0
- data/lib/munge/formatters/dots.rb +90 -0
- data/lib/munge/helpers/asset_paths.rb +4 -4
- data/lib/munge/helpers/link.rb +2 -2
- data/lib/munge/helpers/tag.rb +6 -2
- data/lib/munge/reporter.rb +35 -0
- data/lib/munge/runner.rb +12 -6
- data/lib/munge/transformers/tilt_transformer.rb +1 -1
- data/lib/munge/util/path.rb +0 -7
- data/lib/munge/version.rb +1 -1
- data/lib/munge/write_manager.rb +7 -3
- data/lib/munge.rb +5 -3
- data/munge.gemspec +5 -0
- data/seeds/.gitignore +1 -0
- data/seeds/config/routing.rb +10 -5
- data/seeds/layouts/default.html.erb +1 -1
- metadata +90 -4
- data/lib/munge/reporters/default.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73fdb1d0c438b5ae814e7c09fe7d3ea7516b1986
|
4
|
+
data.tar.gz: 9c691b2ccac2ffe871fdb654856ba70003538d86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4d895246116728a131ad6c9ccfb0f5c3e1737b0492a60b707d2f628a6e4bdb82cd7f4d675028fb92eb9645a3e096a9fc88d713a48b929c1126263823f33740c
|
7
|
+
data.tar.gz: d8678cf6f83de2e45d46379d396941f209f8d7355862a4384d1aa1a17db0e961d5a2ade08d8d8d67528ab3d529e4c6c9b3ab44c2a25d39eabdce7023a440056d
|
@@ -2,22 +2,26 @@ module Munge
|
|
2
2
|
module Cli
|
3
3
|
module Commands
|
4
4
|
class Build
|
5
|
-
def initialize(bootloader, dry_run:, reporter:)
|
5
|
+
def initialize(bootloader, dry_run:, reporter:, verbosity:, build_root: nil)
|
6
6
|
destination_root = bootloader.root_path
|
7
|
-
config
|
8
|
-
|
7
|
+
config = bootloader.config
|
8
|
+
app = application(bootloader)
|
9
|
+
destination = File.expand_path(build_root || config[:output], destination_root)
|
9
10
|
|
10
|
-
runner =
|
11
|
+
@runner =
|
11
12
|
Munge::Runner.new(
|
12
|
-
items:
|
13
|
-
router:
|
14
|
-
alterant:
|
13
|
+
items: app.vomit(:items),
|
14
|
+
router: app.vomit(:router),
|
15
|
+
alterant: app.vomit(:alterant),
|
15
16
|
writer: writer(dry_run),
|
16
|
-
|
17
|
-
|
17
|
+
formatter: formatter(reporter),
|
18
|
+
verbosity: verbosity.to_sym,
|
19
|
+
destination: destination
|
18
20
|
)
|
21
|
+
end
|
19
22
|
|
20
|
-
|
23
|
+
def call
|
24
|
+
@runner.write
|
21
25
|
end
|
22
26
|
|
23
27
|
private
|
@@ -36,8 +40,8 @@ module Munge
|
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
|
-
def
|
40
|
-
Munge::
|
43
|
+
def formatter(class_name)
|
44
|
+
Munge::Formatters.const_get(class_name).new
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Munge
|
2
|
+
module Cli
|
3
|
+
module Commands
|
4
|
+
class Init
|
5
|
+
include Thor::Base
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
File.expand_path("../../../../../seeds", __FILE__)
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(path)
|
13
|
+
self.options = {}
|
14
|
+
self.destination_root = File.expand_path(path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
directory(".", destination_root)
|
19
|
+
|
20
|
+
inside(destination_root) do
|
21
|
+
run_bundle("install")
|
22
|
+
run_bundle("binstub munge")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def run_bundle(command)
|
29
|
+
if Gem::Specification.find_all_by_name("bundler").any?
|
30
|
+
say_status :run, "bundle #{command}"
|
31
|
+
|
32
|
+
require "bundler"
|
33
|
+
|
34
|
+
::Bundler.with_clean_env do
|
35
|
+
system("bundle #{command}")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Munge
|
2
|
+
module Cli
|
3
|
+
module Commands
|
4
|
+
class Server
|
5
|
+
def initialize(bootloader)
|
6
|
+
@bootloader = bootloader
|
7
|
+
@listener = listener
|
8
|
+
end
|
9
|
+
|
10
|
+
def call
|
11
|
+
@listener.start
|
12
|
+
|
13
|
+
system("munge build")
|
14
|
+
|
15
|
+
system("munge view")
|
16
|
+
rescue Interrupt
|
17
|
+
@listener.stop
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def listener
|
23
|
+
require "listen"
|
24
|
+
|
25
|
+
listen = Listen.to(@bootloader.root_path) do
|
26
|
+
system("munge build")
|
27
|
+
end
|
28
|
+
|
29
|
+
ignore(listen, ENV["BUILD_ROOT"])
|
30
|
+
ignore(listen, @bootloader.config[:output])
|
31
|
+
|
32
|
+
listen
|
33
|
+
end
|
34
|
+
|
35
|
+
def ignore(listener, pattern)
|
36
|
+
if pattern
|
37
|
+
listener.ignore(/^#{pattern}/)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -28,18 +28,29 @@ module Munge
|
|
28
28
|
module Cli
|
29
29
|
module Commands
|
30
30
|
class View
|
31
|
-
def initialize(bootloader, host:, port:)
|
31
|
+
def initialize(bootloader, host:, port:, build_root: nil)
|
32
32
|
config = bootloader.config
|
33
|
+
@host = host
|
34
|
+
@port = port
|
35
|
+
root = File.expand_path(build_root || config[:output], bootloader.root_path)
|
33
36
|
|
34
|
-
app =
|
37
|
+
@app =
|
35
38
|
Rack::Builder.new do
|
36
39
|
use Rack::ShowExceptions
|
37
40
|
use Rack::Head
|
38
|
-
use Adsf::Rack::IndexFileFinder, root:
|
39
|
-
run Rack::File.new(
|
41
|
+
use Adsf::Rack::IndexFileFinder, root: root
|
42
|
+
run Rack::File.new(root)
|
40
43
|
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def call
|
47
|
+
Signal.trap("INT") do
|
48
|
+
# Prints a newline after the terminal prints `^C`
|
49
|
+
puts
|
50
|
+
Rack::Handler::WEBrick.shutdown
|
51
|
+
end
|
41
52
|
|
42
|
-
Rack::Handler::WEBrick.run(app, Host: host, Port: port)
|
53
|
+
Rack::Handler::WEBrick.run(@app, Host: @host, Port: @port)
|
43
54
|
end
|
44
55
|
end
|
45
56
|
end
|
data/lib/munge/cli/dispatch.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
require "thor"
|
2
|
-
|
3
1
|
module Munge
|
4
2
|
module Cli
|
5
3
|
class Dispatch < Thor
|
6
|
-
include Thor::Actions
|
7
|
-
|
8
|
-
def self.source_root
|
9
|
-
File.expand_path("../../../../seeds", __FILE__)
|
10
|
-
end
|
11
|
-
|
12
4
|
desc "init PATH", "Create new site at PATH"
|
13
5
|
def init(path)
|
14
|
-
|
15
|
-
|
16
|
-
inside(path) do
|
17
|
-
run_bundle("install")
|
18
|
-
run_bundle("binstub munge")
|
19
|
-
end
|
6
|
+
Commands::Init.new(path).call
|
20
7
|
end
|
21
8
|
|
22
|
-
desc "build", "Build
|
23
|
-
method_option :reporter,
|
24
|
-
method_option :dry_run,
|
9
|
+
desc "build", "Build site"
|
10
|
+
method_option :reporter, desc: "Set reporting formatter", default: "Default", type: :string
|
11
|
+
method_option :dry_run, desc: "Run without writing files", default: false, type: :boolean
|
12
|
+
method_option :verbosity, aliases: "-v", desc: "Preferred amount of output", enum: %w(all written silent), default: "written", type: :string
|
25
13
|
def build
|
26
|
-
|
14
|
+
ENV["MUNGE_ENV"] ||= "production"
|
15
|
+
|
16
|
+
Commands::Build.new(bootloader, **symbolized_options, build_root: ENV["BUILD_ROOT"]).call
|
27
17
|
end
|
28
18
|
|
29
19
|
desc "view", "View built files"
|
30
20
|
method_option :port, aliases: "-p", desc: "Set port", default: 7000, type: :numeric
|
31
21
|
method_option :host, aliases: "-h", desc: "Set host", default: "0.0.0.0", type: :string
|
32
22
|
def view
|
33
|
-
|
23
|
+
ENV["MUNGE_ENV"] ||= "production"
|
24
|
+
|
25
|
+
Commands::View.new(bootloader, **symbolized_options, build_root: ENV["BUILD_ROOT"]).call
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "server", "Run the development server"
|
29
|
+
def server
|
30
|
+
ENV["MUNGE_ENV"] ||= "development"
|
31
|
+
ENV["BUILD_ROOT"] ||= "tmp/development-build"
|
32
|
+
|
33
|
+
Commands::Server.new(bootloader).call
|
34
34
|
end
|
35
35
|
|
36
36
|
desc "version", "Print version"
|
@@ -48,18 +48,6 @@ module Munge
|
|
48
48
|
def symbolized_options
|
49
49
|
Munge::Util::SymbolHash.deep_convert(options)
|
50
50
|
end
|
51
|
-
|
52
|
-
def run_bundle(command)
|
53
|
-
if Gem::Specification::find_all_by_name("bundler").any?
|
54
|
-
say_status :run, "bundle #{command}"
|
55
|
-
|
56
|
-
require "bundler"
|
57
|
-
|
58
|
-
::Bundler.with_clean_env do
|
59
|
-
system("bundle #{command}")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
51
|
end
|
64
52
|
end
|
65
53
|
end
|
data/lib/munge/cli.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
-
require "
|
1
|
+
require "rainbow"
|
2
|
+
require "thor"
|
3
|
+
|
4
|
+
require "munge/cli/commands/init"
|
2
5
|
require "munge/cli/commands/build"
|
3
6
|
require "munge/cli/commands/view"
|
7
|
+
require "munge/cli/commands/server"
|
8
|
+
require "munge/cli/dispatch"
|
4
9
|
|
5
|
-
require "munge/
|
10
|
+
require "munge/formatters/default"
|
11
|
+
require "munge/formatters/dots"
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Munge
|
2
|
+
module Formatters
|
3
|
+
class Default
|
4
|
+
def initialize
|
5
|
+
@new_count = 0
|
6
|
+
@changed_count = 0
|
7
|
+
@identical_count = 0
|
8
|
+
@reported_count = 0
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(_item, relpath, write_status, should_print)
|
12
|
+
case write_status
|
13
|
+
when :new
|
14
|
+
report_new(relpath, should_print)
|
15
|
+
when :changed
|
16
|
+
report_changed(relpath, should_print)
|
17
|
+
when :identical
|
18
|
+
report_identical(relpath, should_print)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def start
|
23
|
+
@start_time = Time.now
|
24
|
+
|
25
|
+
puts "Started build"
|
26
|
+
end
|
27
|
+
|
28
|
+
def done
|
29
|
+
@done_time = Time.now
|
30
|
+
|
31
|
+
report = [
|
32
|
+
"Wrote #{@new_count + @changed_count}",
|
33
|
+
"Processed #{@new_count + @changed_count + @identical_count}"
|
34
|
+
]
|
35
|
+
|
36
|
+
puts report.join(", ")
|
37
|
+
puts "Took #{@done_time - @start_time} seconds"
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def report_new(relpath, should_print)
|
43
|
+
@new_count += 1
|
44
|
+
|
45
|
+
if should_print
|
46
|
+
puts report(Rainbow("created").green, relpath)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def report_changed(relpath, should_print)
|
51
|
+
@changed_count += 1
|
52
|
+
|
53
|
+
if should_print
|
54
|
+
puts report(Rainbow("updated").green, relpath)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def report_identical(relpath, should_print)
|
59
|
+
@identical_count += 1
|
60
|
+
|
61
|
+
if should_print
|
62
|
+
puts report(Rainbow("identical").yellow, relpath)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def report(action, relpath)
|
67
|
+
@reported_count += 1
|
68
|
+
|
69
|
+
%(#{action.rjust(24)} #{relpath})
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Munge
|
2
|
+
module Formatters
|
3
|
+
class Dots
|
4
|
+
def initialize
|
5
|
+
@counts = {
|
6
|
+
new: 0,
|
7
|
+
changed: 0,
|
8
|
+
identical: 0
|
9
|
+
}
|
10
|
+
|
11
|
+
@relpaths = {
|
12
|
+
new: [],
|
13
|
+
changed: [],
|
14
|
+
identical: []
|
15
|
+
}
|
16
|
+
|
17
|
+
@dots = {
|
18
|
+
new: Rainbow("W").green,
|
19
|
+
changed: Rainbow("W").yellow,
|
20
|
+
identical: "."
|
21
|
+
}
|
22
|
+
|
23
|
+
@total = 0
|
24
|
+
end
|
25
|
+
|
26
|
+
def call(_item, relpath, write_status, should_print)
|
27
|
+
@total += 1
|
28
|
+
|
29
|
+
@counts[write_status] += 1
|
30
|
+
|
31
|
+
if should_print
|
32
|
+
@relpaths[write_status].push(relpath)
|
33
|
+
end
|
34
|
+
|
35
|
+
print @dots[write_status]
|
36
|
+
end
|
37
|
+
|
38
|
+
def start
|
39
|
+
@start_time = Time.now
|
40
|
+
|
41
|
+
puts "Building:"
|
42
|
+
end
|
43
|
+
|
44
|
+
def done
|
45
|
+
@done_time = Time.now
|
46
|
+
|
47
|
+
# Print a newline after the line of dots
|
48
|
+
puts
|
49
|
+
|
50
|
+
list!
|
51
|
+
|
52
|
+
summary!
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def list!
|
58
|
+
lists = [
|
59
|
+
[@relpaths[:new], "New items:"],
|
60
|
+
[@relpaths[:changed], "Updated items:"],
|
61
|
+
[@relpaths[:identical], "Identical items:"]
|
62
|
+
]
|
63
|
+
|
64
|
+
lists.each do |list, title|
|
65
|
+
if list.empty?
|
66
|
+
next
|
67
|
+
end
|
68
|
+
|
69
|
+
puts
|
70
|
+
puts title
|
71
|
+
puts
|
72
|
+
puts list.join(", ")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def summary!
|
77
|
+
write_summary = [
|
78
|
+
"Created #{@counts[:new]}",
|
79
|
+
"Updated #{@counts[:changed]}",
|
80
|
+
"Ignored #{@counts[:identical]}"
|
81
|
+
]
|
82
|
+
|
83
|
+
puts
|
84
|
+
puts "Processed #{@total} in #{@done_time - @start_time} seconds"
|
85
|
+
puts
|
86
|
+
puts write_summary.join(", ")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -3,22 +3,22 @@ module Munge
|
|
3
3
|
module AssetPaths
|
4
4
|
def image_path(basename)
|
5
5
|
item = items["#{images_root}/#{basename}"]
|
6
|
-
|
6
|
+
path_to(item)
|
7
7
|
end
|
8
8
|
|
9
9
|
def font_path(basename)
|
10
10
|
item = items["#{fonts_root}/#{basename}"]
|
11
|
-
|
11
|
+
path_to(item)
|
12
12
|
end
|
13
13
|
|
14
14
|
def stylesheet_path(basename)
|
15
15
|
item = items["#{stylesheets_root}/#{basename}"]
|
16
|
-
|
16
|
+
path_to(item)
|
17
17
|
end
|
18
18
|
|
19
19
|
def javascript_path(basename)
|
20
20
|
item = items["#{javascripts_root}/#{basename}"]
|
21
|
-
|
21
|
+
path_to(item)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/lib/munge/helpers/link.rb
CHANGED
data/lib/munge/helpers/tag.rb
CHANGED
@@ -2,7 +2,7 @@ module Munge
|
|
2
2
|
module Helpers
|
3
3
|
module Tag
|
4
4
|
def empty_tag(name, options = {})
|
5
|
-
options_str = options.map { |k, v| %(#{k}="#{v}") }.join(" ")
|
5
|
+
options_str = options.map { |k, v| %(#{k}="#{h(v)}") }.join(" ")
|
6
6
|
|
7
7
|
if options_str == ""
|
8
8
|
"<#{name} />"
|
@@ -17,7 +17,7 @@ module Munge
|
|
17
17
|
content = nil
|
18
18
|
end
|
19
19
|
|
20
|
-
options_str = options.map { |k, v| %(#{k}="#{v}") }.join(" ")
|
20
|
+
options_str = options.map { |k, v| %(#{k}="#{h(v)}") }.join(" ")
|
21
21
|
|
22
22
|
content_str =
|
23
23
|
if content
|
@@ -30,6 +30,10 @@ module Munge
|
|
30
30
|
|
31
31
|
"<#{name} #{options_str}>#{content_str}</#{name}>"
|
32
32
|
end
|
33
|
+
|
34
|
+
def h(string)
|
35
|
+
CGI.escape_html(string)
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Munge
|
2
|
+
class Reporter
|
3
|
+
def initialize(formatter:, verbosity:)
|
4
|
+
@formatter = formatter
|
5
|
+
@verbosity = verbosity
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(item, relpath, write_status)
|
9
|
+
@formatter.call(item, relpath, write_status, should_print?(write_status))
|
10
|
+
end
|
11
|
+
|
12
|
+
def start
|
13
|
+
@formatter.start
|
14
|
+
end
|
15
|
+
|
16
|
+
def done
|
17
|
+
@formatter.done
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def should_print?(write_status)
|
23
|
+
case @verbosity
|
24
|
+
when :all
|
25
|
+
return true
|
26
|
+
when :written
|
27
|
+
return write_status == :new || write_status == :changed
|
28
|
+
when :silent
|
29
|
+
return false
|
30
|
+
end
|
31
|
+
|
32
|
+
false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/munge/runner.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
module Munge
|
2
2
|
class Runner
|
3
|
-
def initialize(items:, router:, alterant:, writer:,
|
3
|
+
def initialize(items:, router:, alterant:, writer:, formatter:, verbosity:, destination:)
|
4
4
|
@items = items
|
5
5
|
@router = router
|
6
6
|
@alterant = alterant
|
7
7
|
@writer = writer
|
8
|
-
@reporter =
|
8
|
+
@reporter = Munge::Reporter.new(formatter: formatter, verbosity: verbosity)
|
9
9
|
@write_manager = Munge::WriteManager.new(driver: File)
|
10
10
|
@destination = destination
|
11
11
|
end
|
12
12
|
|
13
13
|
def write
|
14
|
+
@reporter.start
|
15
|
+
|
14
16
|
@items
|
15
17
|
.reject { |item| item.route.nil? }
|
16
18
|
.each { |item| render_and_write(item) }
|
19
|
+
|
20
|
+
@reporter.done
|
17
21
|
end
|
18
22
|
|
19
23
|
private
|
@@ -26,13 +30,15 @@ module Munge
|
|
26
30
|
write_status = @write_manager.status(abspath, content)
|
27
31
|
|
28
32
|
case write_status
|
29
|
-
when :
|
33
|
+
when :new, :changed
|
30
34
|
@writer.write(abspath, content)
|
31
|
-
when :
|
32
|
-
|
35
|
+
when :double_write_error
|
36
|
+
raise "attempted to write #{item.route} twice"
|
37
|
+
when :identical
|
38
|
+
# Defer to the reporter
|
33
39
|
end
|
34
40
|
|
35
|
-
@reporter.call(item, write_status)
|
41
|
+
@reporter.call(item, relpath, write_status)
|
36
42
|
end
|
37
43
|
end
|
38
44
|
end
|
@@ -13,7 +13,7 @@ module Munge
|
|
13
13
|
|
14
14
|
def call(item, content = nil, renderer = nil)
|
15
15
|
scope = @pristine_scope.dup
|
16
|
-
scope.instance_variable_set
|
16
|
+
scope.instance_variable_set(:@renderer, @renderer)
|
17
17
|
dirty_scope = extend_with_helpers(scope)
|
18
18
|
dirty_scope.instance_variable_set(:@tilt_options, @demands)
|
19
19
|
dirty_scope.render_with_layout(item, content_engines: renderer, content_override: content)
|
data/lib/munge/util/path.rb
CHANGED
@@ -28,13 +28,6 @@ module Munge
|
|
28
28
|
File.basename(path)
|
29
29
|
end
|
30
30
|
|
31
|
-
def self.basename_one_extension(path)
|
32
|
-
basename = File.basename(path)
|
33
|
-
basename_parts = basename.split(".")
|
34
|
-
|
35
|
-
basename_parts[0..1].join(".")
|
36
|
-
end
|
37
|
-
|
38
31
|
def self.basename_no_extension(path)
|
39
32
|
basename = File.basename(path)
|
40
33
|
basename_parts = basename.split(".")
|
data/lib/munge/version.rb
CHANGED
data/lib/munge/write_manager.rb
CHANGED
@@ -12,11 +12,15 @@ module Munge
|
|
12
12
|
|
13
13
|
@write_paths.push(path)
|
14
14
|
|
15
|
-
if
|
15
|
+
if !@driver.exist?(path)
|
16
|
+
return :new
|
17
|
+
end
|
18
|
+
|
19
|
+
if @driver.read(path) == content
|
16
20
|
return :identical
|
17
|
-
else
|
18
|
-
return :different
|
19
21
|
end
|
22
|
+
|
23
|
+
:changed
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
data/lib/munge.rb
CHANGED
@@ -3,13 +3,14 @@ require "forwardable"
|
|
3
3
|
require "pathname"
|
4
4
|
require "set"
|
5
5
|
require "yaml"
|
6
|
+
require "cgi"
|
6
7
|
|
7
8
|
require "tilt"
|
8
9
|
|
9
|
-
|
10
|
-
# require for development
|
10
|
+
if Gem::Specification.find_all_by_name("pry-byebug").any?
|
11
11
|
require "pry-byebug"
|
12
|
-
|
12
|
+
elsif Gem::Specification.find_all_by_name("pry").any?
|
13
|
+
require "pry"
|
13
14
|
end
|
14
15
|
|
15
16
|
# Core
|
@@ -32,6 +33,7 @@ require "munge/writers/noop"
|
|
32
33
|
require "munge/write_manager"
|
33
34
|
require "munge/application"
|
34
35
|
require "munge/runner"
|
36
|
+
require "munge/reporter"
|
35
37
|
require "munge/init"
|
36
38
|
require "munge/bootloader"
|
37
39
|
|
data/munge.gemspec
CHANGED
@@ -27,15 +27,20 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.9"
|
28
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
29
29
|
spec.add_development_dependency "minitest", "~> 5.8"
|
30
|
+
spec.add_development_dependency "minitest-bisect", "~> 1.3"
|
31
|
+
spec.add_development_dependency "rack-test", "~> 0.6"
|
30
32
|
spec.add_development_dependency "fakefs", "~> 0.6"
|
31
33
|
spec.add_development_dependency "pry-byebug", "~> 3.3"
|
32
34
|
spec.add_development_dependency "redcarpet", "~> 3.3"
|
33
35
|
spec.add_development_dependency "rubocop", "~> 0.32"
|
36
|
+
spec.add_development_dependency "timecop", "~> 0.8"
|
34
37
|
spec.add_development_dependency "codeclimate-test-reporter", "~> 0.4"
|
35
38
|
spec.add_development_dependency "simplecov", "~> 0.10"
|
36
39
|
|
37
40
|
spec.add_runtime_dependency "adsf", "~> 1.2"
|
41
|
+
spec.add_runtime_dependency "listen", "~> 3.0", "< 3.1"
|
38
42
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
43
|
+
spec.add_runtime_dependency "rainbow", ">= 1.99.1", "< 3.0"
|
39
44
|
spec.add_runtime_dependency "tilt", "~> 2.0"
|
40
45
|
spec.add_runtime_dependency "sass", "~> 3.4"
|
41
46
|
end
|
data/seeds/.gitignore
CHANGED
data/seeds/config/routing.rb
CHANGED
@@ -1,18 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
if ENV["MUNGE_ENV"] == "production"
|
2
|
+
system.router.register(
|
3
|
+
Routers::Fingerprint.new(
|
4
|
+
extensions: config[:bin_extensions] + config[:bintext_extensions],
|
5
|
+
separator: config[:fingeprint_separator]
|
6
|
+
))
|
7
|
+
end
|
8
|
+
|
6
9
|
system.router.register(
|
7
10
|
Routers::RemoveIndexBasename.new(
|
8
11
|
html_extensions: config[:text_extensions],
|
9
12
|
index: config[:index]
|
10
13
|
))
|
14
|
+
|
11
15
|
system.router.register(
|
12
16
|
Routers::AddIndexHtml.new(
|
13
17
|
html_extensions: config[:text_extensions],
|
14
18
|
index: config[:index]
|
15
19
|
))
|
20
|
+
|
16
21
|
system.router.register(
|
17
22
|
Routers::AutoAddExtension.new(
|
18
23
|
keep_extensions: config[:bin_extensions] + config[:bintext_extensions]
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset="UTF-8">
|
5
5
|
<title><%= site_name %></title>
|
6
|
-
<link rel="stylesheet" href="<%=
|
6
|
+
<link rel="stylesheet" href="<%= path_to(items["assets/stylesheets/basic.css"]) %>" media="screen" charset="utf-8">
|
7
7
|
</head>
|
8
8
|
<body>
|
9
9
|
<div class="layout">
|
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.11.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-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-bisect
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.6'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: fakefs
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +136,20 @@ dependencies:
|
|
108
136
|
- - "~>"
|
109
137
|
- !ruby/object:Gem::Version
|
110
138
|
version: '0.32'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: timecop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.8'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.8'
|
111
153
|
- !ruby/object:Gem::Dependency
|
112
154
|
name: codeclimate-test-reporter
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +192,26 @@ dependencies:
|
|
150
192
|
- - "~>"
|
151
193
|
- !ruby/object:Gem::Version
|
152
194
|
version: '1.2'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: listen
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '3.0'
|
202
|
+
- - "<"
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '3.1'
|
205
|
+
type: :runtime
|
206
|
+
prerelease: false
|
207
|
+
version_requirements: !ruby/object:Gem::Requirement
|
208
|
+
requirements:
|
209
|
+
- - "~>"
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '3.0'
|
212
|
+
- - "<"
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '3.1'
|
153
215
|
- !ruby/object:Gem::Dependency
|
154
216
|
name: thor
|
155
217
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +226,26 @@ dependencies:
|
|
164
226
|
- - "~>"
|
165
227
|
- !ruby/object:Gem::Version
|
166
228
|
version: '0.19'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: rainbow
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: 1.99.1
|
236
|
+
- - "<"
|
237
|
+
- !ruby/object:Gem::Version
|
238
|
+
version: '3.0'
|
239
|
+
type: :runtime
|
240
|
+
prerelease: false
|
241
|
+
version_requirements: !ruby/object:Gem::Requirement
|
242
|
+
requirements:
|
243
|
+
- - ">="
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
version: 1.99.1
|
246
|
+
- - "<"
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '3.0'
|
167
249
|
- !ruby/object:Gem::Dependency
|
168
250
|
name: tilt
|
169
251
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,7 +274,7 @@ dependencies:
|
|
192
274
|
- - "~>"
|
193
275
|
- !ruby/object:Gem::Version
|
194
276
|
version: '3.4'
|
195
|
-
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.
|
277
|
+
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.11.0/README.md
|
196
278
|
email:
|
197
279
|
- zach.ahn@gmail.com
|
198
280
|
executables:
|
@@ -209,8 +291,12 @@ files:
|
|
209
291
|
- lib/munge/bootloader.rb
|
210
292
|
- lib/munge/cli.rb
|
211
293
|
- lib/munge/cli/commands/build.rb
|
294
|
+
- lib/munge/cli/commands/init.rb
|
295
|
+
- lib/munge/cli/commands/server.rb
|
212
296
|
- lib/munge/cli/commands/view.rb
|
213
297
|
- lib/munge/cli/dispatch.rb
|
298
|
+
- lib/munge/formatters/default.rb
|
299
|
+
- lib/munge/formatters/dots.rb
|
214
300
|
- lib/munge/go/sass.rb
|
215
301
|
- lib/munge/go/sass/asset_urls.rb
|
216
302
|
- lib/munge/helpers/asset_paths.rb
|
@@ -222,7 +308,7 @@ files:
|
|
222
308
|
- lib/munge/helpers/tag.rb
|
223
309
|
- lib/munge/init.rb
|
224
310
|
- lib/munge/item.rb
|
225
|
-
- lib/munge/
|
311
|
+
- lib/munge/reporter.rb
|
226
312
|
- lib/munge/routers/add_index_html.rb
|
227
313
|
- lib/munge/routers/auto_add_extension.rb
|
228
314
|
- lib/munge/routers/fingerprint.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Munge
|
2
|
-
module Reporters
|
3
|
-
class Default
|
4
|
-
def initialize
|
5
|
-
end
|
6
|
-
|
7
|
-
def call(item, write_status)
|
8
|
-
case write_status
|
9
|
-
when :different
|
10
|
-
puts "wrote #{item.route}"
|
11
|
-
when :identical
|
12
|
-
puts "identical #{item.route}"
|
13
|
-
when :double_write_error
|
14
|
-
raise "attempted to write #{item.route} twice"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|