munge 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdbfe2a9223c246cb18bd9fcdaf389c52075eef5
4
- data.tar.gz: 591d3ea317628eeed159e629e31bb476777be91d
3
+ metadata.gz: e5afa7095e7748d33f0ed3eb2896c4c25d2fa5dd
4
+ data.tar.gz: c772f9864ea064587b5d16f1445f6e6064780024
5
5
  SHA512:
6
- metadata.gz: 3360ab60a36319f56066a7a82967bde4c5d70f4bae08d6b0709eb8c8b1531f1caf1aefe0eb351aa3a9a27803898d61ed2446a98fe4daded6bbc164d2dd8ab9ef
7
- data.tar.gz: bddb33da3a1739658e3f9bcc510e10244bf0a461a2963c83d3ba062808a4dc3907fea300d3e4ed26c9d8323ff576b111e59598d85bf8c6348520356c1b77ef0d
6
+ metadata.gz: 396bfa27c4b98d242674f24e9845b6161b45cadc94fa7bacb17565766d0b3a72528b0b26415682056af7f012529973be0e6b565712e0510a279c94591a5cbc50
7
+ data.tar.gz: a4df269dd5dd9b109409427f603a9c44565156f88e5ffb9fd16bffa24a3727bc2afa4a70a812dc2ad94e81d954bc44ec370ba6277bd98f8ae624bfa22ef32788
data/.rubocop.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.1
2
3
  Exclude:
3
4
  - vendor/bundle/**/*
4
5
  - Gemfile
@@ -32,8 +33,14 @@ Style/GuardClause:
32
33
  Style/IfUnlessModifier:
33
34
  Enabled: false
34
35
 
36
+ Style/MultilineMethodCallIndentation:
37
+ EnforcedStyle: indented
38
+
35
39
  Style/MultilineOperationIndentation:
36
40
  EnforcedStyle: indented
37
41
 
38
42
  Style/StringLiterals:
39
43
  EnforcedStyle: double_quotes
44
+
45
+ Style/UnneededInterpolation:
46
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.3.0
3
4
  - 2.2
4
5
  - 2.1
5
6
  - ruby-head
data/README.md CHANGED
@@ -59,7 +59,7 @@ Here's an example `rules.rb` for a blog.
59
59
 
60
60
  ```ruby
61
61
  # home page
62
- app.source
62
+ app.unrouted
63
63
  .select { |item| item.id == "home" } # looks for items where path is "src/home.*"
64
64
  .each { |item| item.route = "" } # sets output file to "/index.html"
65
65
  .each { |item| item.layout = "default"} # sets layout to "layouts/default.*"
@@ -67,7 +67,7 @@ app.source
67
67
  .each { |item| item.transform(:tilt) } # have Tilt compile this file
68
68
 
69
69
  # blog posts
70
- app.source
70
+ app.unrouted
71
71
  .select { |item| item.relpath?("posts") } # looks for items in "src/posts/**/*"
72
72
  .each { |item| item.route = "blog/#{item.basename}" } # sets output file to "/blog/#{basename}/index.html"
73
73
  .each { |item| item.layout = "post" }
@@ -75,7 +75,7 @@ app.source
75
75
 
76
76
  # blog index
77
77
  posts_for_index =
78
- app.source
78
+ app.routed
79
79
  .select { |item| item.route?("blog") }
80
80
  .sort_by { |item| item.route }
81
81
  .reverse
data/exe/munge CHANGED
@@ -6,6 +6,6 @@ if File.exist?(File.expand_path("../../.git", __FILE__))
6
6
  end
7
7
 
8
8
  require "munge"
9
- require "munge/cli/dispatch"
9
+ require "munge/cli"
10
10
 
11
11
  Munge::Cli::Dispatch.start(ARGV)
data/lib/munge.rb CHANGED
@@ -6,6 +6,12 @@ require "yaml"
6
6
 
7
7
  require "tilt"
8
8
 
9
+ begin
10
+ # require for development
11
+ require "pry-byebug"
12
+ rescue LoadError
13
+ end
14
+
9
15
  # Core
10
16
  require "munge/version"
11
17
  require "munge/item"
@@ -16,9 +22,11 @@ require "munge/system/router"
16
22
  require "munge/system/item_factory"
17
23
  require "munge/system/collection"
18
24
  require "munge/system/readers/filesystem"
19
- require "munge/system/write"
20
25
  require "munge/system/alterant"
21
26
  require "munge/system"
27
+ require "munge/writers/filesystem"
28
+ require "munge/writers/noop"
29
+ require "munge/write_manager"
22
30
  require "munge/application"
23
31
  require "munge/runner"
24
32
  require "munge/bootstrap"
@@ -4,36 +4,30 @@ module Munge
4
4
  @system = system
5
5
  end
6
6
 
7
- def source
8
- @system.source
7
+ def items
8
+ @system.items
9
9
  end
10
10
 
11
- def write(&block)
12
- @system.source
13
- .reject { |item| item.route.nil? }
14
- .each { |item| render_and_write(item, &block) }
11
+ def nonrouted
12
+ items.select { |item| item.route.nil? }
13
+ end
14
+
15
+ def routed
16
+ items.reject { |item| item.route.nil? }
15
17
  end
16
18
 
17
19
  def build_virtual_item(relpath, content, **frontmatter)
18
- @system.source.build(relpath: relpath, content: content, frontmatter: frontmatter)
20
+ @system.items.build(relpath: relpath, content: content, frontmatter: frontmatter)
19
21
  end
20
22
 
21
23
  def create(*args)
22
24
  item = build_virtual_item(*args)
23
25
  yield item if block_given?
24
- @system.source.push(item)
26
+ @system.items.push(item)
25
27
  end
26
28
 
27
- private
28
-
29
- def render_and_write(item, &block)
30
- relpath = @system.router.filepath(item)
31
-
32
- write_status = @system.writer.write(relpath, @system.alterant.transform(item))
33
-
34
- if block_given?
35
- block.call(item, write_status)
36
- end
29
+ def vomit(component_name)
30
+ @system.public_send(component_name)
37
31
  end
38
32
  end
39
33
  end
data/lib/munge/cli.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "munge/cli/dispatch"
2
+ require "munge/cli/commands/build"
3
+ require "munge/cli/commands/view"
4
+
5
+ require "munge/reporters/default"
@@ -2,8 +2,38 @@ module Munge
2
2
  module Cli
3
3
  module Commands
4
4
  class Build
5
- def initialize(destination_root)
6
- Munge::Runner.write(destination_root)
5
+ def initialize(destination_root, config, options)
6
+ @app = application(destination_root)
7
+ @dry_run = options[:dry_run]
8
+ reporter_class = Munge::Reporters.const_get(options[:reporter])
9
+
10
+ runner =
11
+ Munge::Runner.new(
12
+ items: @app.vomit(:items),
13
+ router: @app.vomit(:router),
14
+ alterant: @app.vomit(:alterant),
15
+ writer: writer,
16
+ reporter: reporter_class.new,
17
+ destination: File.expand_path(config[:output], destination_root)
18
+ )
19
+
20
+ runner.write
21
+ end
22
+
23
+ private
24
+
25
+ def application(root_path)
26
+ bootstrap = Munge::Bootstrap.new_from_dir(root_path: root_path)
27
+
28
+ bootstrap.app
29
+ end
30
+
31
+ def writer
32
+ if @dry_run
33
+ Munge::Writers::Noop.new
34
+ else
35
+ Munge::Writers::Filesystem.new
36
+ end
7
37
  end
8
38
  end
9
39
  end
@@ -28,7 +28,7 @@ module Munge
28
28
  module Cli
29
29
  module Commands
30
30
  class View
31
- def initialize(options, config_path)
31
+ def initialize(config_path, options)
32
32
  config = Munge::Util::Config.read(config_path)
33
33
  rack_opts = { Host: options[:host], Port: options[:port] }
34
34
 
@@ -6,7 +6,7 @@ module Munge
6
6
  include Thor::Actions
7
7
 
8
8
  def self.source_root
9
- File.expand_path("../../../seeds", __FILE__)
9
+ File.expand_path("../../../../seeds", __FILE__)
10
10
  end
11
11
 
12
12
  desc "init PATH", "Create new site at PATH"
@@ -15,26 +15,31 @@ module Munge
15
15
  end
16
16
 
17
17
  desc "build", "Build in current directory"
18
+ method_option :reporter, desc: "Set reporter", default: "Default", type: :string
19
+ method_option :dry_run, desc: "Run without writing files", default: false, type: :boolean
18
20
  def build
19
- require_relative "commands/build"
20
- Commands::Build.new(destination_root)
21
+ Commands::Build.new(destination_root, loaded_config, options)
21
22
  end
22
23
 
23
24
  desc "view", "View built files"
24
25
  method_option :port, aliases: "-p", desc: "Set port", default: 7000, type: :numeric
25
26
  method_option :host, aliases: "-h", desc: "Set host", default: "0.0.0.0", type: :string
26
27
  def view
27
- require_relative "commands/view"
28
- Commands::View.new(options, config_path)
28
+ Commands::View.new(config_path, options)
29
29
  end
30
30
 
31
31
  desc "version", "Print version"
32
+ map %w(-v --version) => "version"
32
33
  def version
33
34
  puts "munge #{Munge::VERSION}"
34
35
  end
35
36
 
36
37
  private
37
38
 
39
+ def loaded_config
40
+ Munge::Util::Config.read(config_path)
41
+ end
42
+
38
43
  def config_path
39
44
  File.join(destination_root, "config.yml")
40
45
  end
@@ -10,7 +10,7 @@ module Sass::Script::Functions
10
10
  def asset_route_helper(root, basename)
11
11
  basename_string = stringify_string(basename)
12
12
 
13
- item = system.source["#{root}/#{basename_string}"]
13
+ item = system.items["#{root}/#{basename_string}"]
14
14
  r = system.router.route(item)
15
15
 
16
16
  quoted_string(r)
@@ -2,7 +2,7 @@ module Munge
2
2
  module Helpers
3
3
  module Find
4
4
  def items
5
- @source
5
+ @items
6
6
  end
7
7
 
8
8
  def layouts
@@ -0,0 +1,19 @@
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
+ fail "attempted to write #{item.route} twice"
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -23,7 +23,7 @@ module Munge
23
23
  def item_is_html?(item)
24
24
  intersection = item.extensions & @html_extensions
25
25
 
26
- intersection.length > 0
26
+ !intersection.empty?
27
27
  end
28
28
 
29
29
  def route_needs_extension?(route)
@@ -29,7 +29,7 @@ module Munge
29
29
  def item_should_have_extension?(item)
30
30
  intersection = item.extensions & @keep_extensions
31
31
 
32
- intersection.length > 0
32
+ !intersection.empty?
33
33
  end
34
34
 
35
35
  def route_doesnt_have_extension?(initial_route)
@@ -37,7 +37,7 @@ module Munge
37
37
 
38
38
  intersection = initial_route_extensions & @keep_extensions
39
39
 
40
- intersection.length == 0
40
+ intersection.empty?
41
41
  end
42
42
  end
43
43
  end
@@ -18,11 +18,7 @@ module Munge
18
18
 
19
19
  intersection = item.extensions & @extensions
20
20
 
21
- if intersection.size == 0
22
- false
23
- else
24
- true
25
- end
21
+ !intersection.empty?
26
22
  end
27
23
 
28
24
  def call(initial_route, item)
@@ -24,7 +24,7 @@ module Munge
24
24
  def item_is_html?(item)
25
25
  intersection = item.extensions & @html_extensions
26
26
 
27
- intersection.length > 0
27
+ !intersection.empty?
28
28
  end
29
29
 
30
30
  def basename_is_index?(route)
data/lib/munge/runner.rb CHANGED
@@ -1,38 +1,38 @@
1
1
  module Munge
2
2
  class Runner
3
- class << self
4
- def method_missing(method, root_path, *args)
5
- runner = new(application(root_path))
6
- runner.public_send(method, *args)
7
- end
3
+ def initialize(items:, router:, alterant:, writer:, reporter:, destination:)
4
+ @items = items
5
+ @router = router
6
+ @alterant = alterant
7
+ @writer = writer
8
+ @reporter = reporter
9
+ @write_manager = Munge::WriteManager.new(driver: File)
10
+ @destination = destination
11
+ end
8
12
 
9
- def respond_to_missing?(method, *)
10
- if instance_methods.include?(method)
11
- true
12
- else
13
- super
14
- end
15
- end
13
+ def write
14
+ @items
15
+ .reject { |item| item.route.nil? }
16
+ .each { |item| render_and_write(item) }
17
+ end
16
18
 
17
- def application(root_path)
18
- bootstrap = Munge::Bootstrap.new_from_dir(root_path: root_path)
19
+ private
19
20
 
20
- bootstrap.app
21
- end
22
- end
21
+ def render_and_write(item)
22
+ relpath = @router.filepath(item)
23
+ abspath = File.join(@destination, relpath)
24
+ content = @alterant.transform(item)
23
25
 
24
- def initialize(application)
25
- @app = application
26
- end
26
+ write_status = @write_manager.status(abspath, content)
27
27
 
28
- def write
29
- @app.write do |item, did_write|
30
- if did_write
31
- puts "wrote #{item.route}"
32
- else
33
- puts "identical #{item.route}"
34
- end
28
+ case write_status
29
+ when :different
30
+ @writer.write(abspath, content)
31
+ when :identical, :double_write_error
32
+ # we'll defer all other cases to the reporter
35
33
  end
34
+
35
+ @reporter.call(item, write_status)
36
36
  end
37
37
  end
38
38
  end
data/lib/munge/system.rb CHANGED
@@ -14,16 +14,16 @@ module Munge
14
14
  source_item_factory =
15
15
  ItemFactory.new(
16
16
  text_extensions: config[:text_extensions] + config[:bintext_extensions],
17
- ignore_extensions: false
17
+ ignore_extensions: config[:dynamic_extensions]
18
18
  )
19
19
 
20
20
  layouts_item_factory =
21
21
  ItemFactory.new(
22
22
  text_extensions: config[:text_extensions] + config[:bintext_extensions],
23
- ignore_extensions: true
23
+ ignore_extensions: %w(.+)
24
24
  )
25
25
 
26
- @source =
26
+ @items =
27
27
  Collection.new(
28
28
  item_factory: source_item_factory,
29
29
  items: Readers::Filesystem.new(source_path)
@@ -42,11 +42,6 @@ module Munge
42
42
  Router.new(
43
43
  alterant: @alterant
44
44
  )
45
-
46
- @writer =
47
- Write.new(
48
- output: output_path
49
- )
50
45
  end
51
46
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
52
47
 
@@ -54,7 +49,6 @@ module Munge
54
49
  attr_accessor :config
55
50
  attr_accessor :global_data
56
51
  attr_accessor :router
57
- attr_accessor :source
58
- attr_accessor :writer
52
+ attr_accessor :items
59
53
  end
60
54
  end
@@ -12,7 +12,7 @@ module Munge
12
12
  # name should be snake_case Symbol
13
13
  def register_manually(name, transformer)
14
14
  if @registry.key?(name)
15
- fail "already registered transformer `#{name}`"
15
+ raise "already registered transformer `#{name}`"
16
16
  else
17
17
  @registry[name] = transformer
18
18
  end
@@ -34,7 +34,7 @@ module Munge
34
34
  if @registry.key?(name)
35
35
  @registry[name]
36
36
  else
37
- fail "transformer `#{name}` is not installed"
37
+ raise "transformer `#{name}` is not installed"
38
38
  end
39
39
  end
40
40
  end
@@ -39,7 +39,7 @@ module Munge
39
39
  found_item = @items[id]
40
40
 
41
41
  if found_item.nil?
42
- fail "item not found (#{id})"
42
+ raise "item not found (#{id})"
43
43
  end
44
44
 
45
45
  found_item
@@ -1,12 +1,13 @@
1
1
  require_relative "item_factory/content_parser"
2
+ require_relative "item_factory/item_identifier"
2
3
 
3
4
  module Munge
4
5
  class System
5
6
  class ItemFactory
6
7
  def initialize(text_extensions:,
7
8
  ignore_extensions:)
8
- @text_extensions = Set.new(text_extensions)
9
- @ignore_extensions = ignore_extensions
9
+ @text_extensions = Set.new(text_extensions)
10
+ @item_identifier = Munge::System::ItemFactory::ItemIdentifier.new(remove_extensions: ignore_extensions)
10
11
  end
11
12
 
12
13
  def build(relpath:,
@@ -15,12 +16,7 @@ module Munge
15
16
  stat: nil)
16
17
  type = compute_file_type(relpath)
17
18
 
18
- id =
19
- if @ignore_extensions || type == :text
20
- compute_id(relpath)
21
- else
22
- relpath
23
- end
19
+ id = @item_identifier.call(relpath)
24
20
 
25
21
  Munge::Item.new(
26
22
  relpath: relpath,
@@ -72,26 +68,6 @@ module Munge
72
68
  :binary
73
69
  end
74
70
  end
75
-
76
- def compute_id(relpath)
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
84
-
85
- id = []
86
-
87
- unless dirname == ""
88
- id.push(dirname)
89
- end
90
-
91
- id.push(basename)
92
-
93
- id.join("/")
94
- end
95
71
  end
96
72
  end
97
73
  end
@@ -0,0 +1,38 @@
1
+ module Munge
2
+ class System
3
+ class ItemFactory
4
+ class ItemIdentifier
5
+ def initialize(remove_extensions:)
6
+ @remove_extension_regex = join_regex_strings(remove_extensions)
7
+ end
8
+
9
+ def call(relpath)
10
+ dirname = Munge::Util::Path.dirname(relpath)
11
+ basename = Munge::Util::Path.basename_no_extension(relpath)
12
+ extensions = Munge::Util::Path.extnames(relpath)
13
+
14
+ filtered_extensions =
15
+ extensions
16
+ .map { |ext| @remove_extension_regex.match(ext) || ext }
17
+ .select { |ext| ext.is_a?(String) }
18
+
19
+ new_basename =
20
+ [basename, *filtered_extensions].join(".")
21
+
22
+ Munge::Util::Path.join(dirname, new_basename)
23
+ end
24
+
25
+ private
26
+
27
+ def join_regex_strings(strings)
28
+ regexes =
29
+ strings
30
+ .map { |str| "\\A#{str}\\Z" }
31
+ .map { |str| Regexp.new(str) }
32
+
33
+ Regexp.union(regexes)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -15,7 +15,7 @@ module Munge
15
15
  when :filepath
16
16
  @registries[:filepath].push(router)
17
17
  else
18
- fail "invalid router"
18
+ raise "invalid router"
19
19
  end
20
20
  end
21
21
 
@@ -34,7 +34,7 @@ module Munge
34
34
 
35
35
  def route_mapper(item, method_name, initial_route = nil)
36
36
  if !item.route && !initial_route
37
- fail "item has no route"
37
+ raise "item has no route"
38
38
  end
39
39
 
40
40
  itemish = Itemish.new(item, @alterant)
@@ -17,6 +17,17 @@ module Munge
17
17
  end
18
18
  end
19
19
 
20
+ def self.extnames(path)
21
+ basename = File.basename(path)
22
+ basename_parts = basename.split(".")
23
+
24
+ basename_parts[1..-1]
25
+ end
26
+
27
+ def self.basename(path)
28
+ File.basename(path)
29
+ end
30
+
20
31
  def self.basename_one_extension(path)
21
32
  basename = File.basename(path)
22
33
  basename_parts = basename.split(".")
@@ -60,6 +71,12 @@ module Munge
60
71
  correct
61
72
  end
62
73
  end
74
+
75
+ def self.join(*path_components)
76
+ path_components
77
+ .reject(&:empty?)
78
+ .join("/")
79
+ end
63
80
  end
64
81
  end
65
82
  end
data/lib/munge/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Munge
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -0,0 +1,22 @@
1
+ module Munge
2
+ class WriteManager
3
+ def initialize(driver:)
4
+ @driver = driver
5
+ @write_paths = []
6
+ end
7
+
8
+ def status(path, content)
9
+ if @write_paths.include?(path)
10
+ return :double_write_error
11
+ end
12
+
13
+ @write_paths.push(path)
14
+
15
+ if @driver.exist?(path) && @driver.read(path) == content
16
+ return :identical
17
+ else
18
+ return :different
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ module Munge
2
+ module Writers
3
+ class Filesystem
4
+ def write(abspath, content)
5
+ FileUtils.mkdir_p(File.dirname(abspath))
6
+
7
+ File.write(abspath, content)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module Munge
2
+ module Writers
3
+ class Noop
4
+ def write(_abspath, _content)
5
+ end
6
+ end
7
+ end
8
+ end
data/munge.gemspec CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "minitest", "~> 5.8"
28
28
  spec.add_development_dependency "fakefs", "~> 0.6"
29
+ spec.add_development_dependency "pry-byebug", "~> 3.3"
29
30
  spec.add_development_dependency "redcarpet", "~> 3.3"
30
31
  spec.add_development_dependency "rubocop", "~> 0.32"
31
32
  spec.add_development_dependency "codeclimate-test-reporter", "~> 0.4"
data/seeds/Gemfile.tt CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in munge.gemspec
4
3
  gem 'munge', '~> <%= Munge::VERSION %>'
data/seeds/config.yml CHANGED
@@ -23,3 +23,7 @@ bin_extensions:
23
23
  - ttf
24
24
  - eot
25
25
  - woff
26
+ dynamic_extensions:
27
+ - erb
28
+ - scss
29
+ - md
data/seeds/rules.rb CHANGED
@@ -1,31 +1,31 @@
1
1
  # HTML rules
2
- app.source
2
+ app.nonrouted
3
3
  .select { |item| item.extensions.include?("html") }
4
4
  .each { |item| item.route = item.basename }
5
5
  .each { |item| item.layout = "default" }
6
6
  .each { |item| item.transform }
7
7
 
8
8
  # Font rules
9
- app.source
9
+ app.nonrouted
10
10
  .select { |item| item.relpath?("assets/fonts") }
11
11
  .reject { |item| item.basename[0] == "_" }
12
12
  .each { |item| item.route = item.relpath }
13
13
 
14
14
  # Image rules
15
- app.source
15
+ app.nonrouted
16
16
  .select { |item| item.relpath?("assets/images") }
17
17
  .reject { |item| item.basename[0] == "_" }
18
18
  .each { |item| item.route = item.relpath }
19
19
 
20
20
  # JS rules
21
- app.source
21
+ app.nonrouted
22
22
  .select { |item| item.relpath?("assets/javascripts") }
23
23
  .reject { |item| item.basename[0] == "_" }
24
24
  .each { |item| item.route = "/#{item.dirname}/#{item.basename}.js" }
25
25
  .each { |item| item.transform }
26
26
 
27
27
  # CSS rules
28
- app.source
28
+ app.nonrouted
29
29
  .select { |item| item.relpath?("assets/stylesheets") }
30
30
  .reject { |item| item.basename[0] == "_" }
31
31
  .each { |item| item.route = "/#{item.dirname}/#{item.basename}.css" }
@@ -33,7 +33,7 @@ app.source
33
33
 
34
34
  # Sitemap
35
35
  html_pages =
36
- app.source
36
+ app.routed
37
37
  .reject { |item| item.route.nil? }
38
38
  .select { |item| item.extensions.include?("html") }
39
39
  .sort_by { |item| item.route }
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.6.0
4
+ version: 0.7.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-03-06 00:00:00.000000000 Z
11
+ date: 2016-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.3'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: redcarpet
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +192,7 @@ dependencies:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
194
  version: '3.4'
181
- description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.6.0/README.md
195
+ description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.7.0/README.md
182
196
  email:
183
197
  - zach.ahn@gmail.com
184
198
  executables:
@@ -199,6 +213,7 @@ files:
199
213
  - lib/munge.rb
200
214
  - lib/munge/application.rb
201
215
  - lib/munge/bootstrap.rb
216
+ - lib/munge/cli.rb
202
217
  - lib/munge/cli/commands/build.rb
203
218
  - lib/munge/cli/commands/view.rb
204
219
  - lib/munge/cli/dispatch.rb
@@ -212,6 +227,7 @@ files:
212
227
  - lib/munge/helpers/rendering.rb
213
228
  - lib/munge/helpers/tag.rb
214
229
  - lib/munge/item.rb
230
+ - lib/munge/reporters/default.rb
215
231
  - lib/munge/routers/add_index_html.rb
216
232
  - lib/munge/routers/auto_add_extension.rb
217
233
  - lib/munge/routers/fingerprint.rb
@@ -222,15 +238,18 @@ files:
222
238
  - lib/munge/system/collection.rb
223
239
  - lib/munge/system/item_factory.rb
224
240
  - lib/munge/system/item_factory/content_parser.rb
241
+ - lib/munge/system/item_factory/item_identifier.rb
225
242
  - lib/munge/system/readers/filesystem.rb
226
243
  - lib/munge/system/router.rb
227
244
  - lib/munge/system/router/itemish.rb
228
- - lib/munge/system/write.rb
229
245
  - lib/munge/transformers/tilt.rb
230
246
  - lib/munge/util/config.rb
231
247
  - lib/munge/util/path.rb
232
248
  - lib/munge/util/symbol_hash.rb
233
249
  - lib/munge/version.rb
250
+ - lib/munge/write_manager.rb
251
+ - lib/munge/writers/filesystem.rb
252
+ - lib/munge/writers/noop.rb
234
253
  - munge.gemspec
235
254
  - seeds/Gemfile.tt
236
255
  - seeds/config.yml
@@ -1,22 +0,0 @@
1
- module Munge
2
- class System
3
- class Write
4
- def initialize(output:)
5
- @output = output
6
- end
7
-
8
- def write(relpath, content)
9
- abspath = File.join(@output, relpath)
10
-
11
- FileUtils.mkdir_p(File.dirname(abspath))
12
-
13
- if File.exist?(abspath) && File.read(abspath) == content
14
- return false
15
- else
16
- File.write(abspath, content)
17
- true
18
- end
19
- end
20
- end
21
- end
22
- end