munge 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a89ec9386b6243aad9b81eefacf82593e7ed7398
4
- data.tar.gz: 207829f90d9401f2e67515ab50c8bbfb236d1bfb
3
+ metadata.gz: 25f673749fbc6937969b76dc5e6067a6b93d36db
4
+ data.tar.gz: 662c67d7e42c7a62ce0a2759c31de3c9f61911a0
5
5
  SHA512:
6
- metadata.gz: 88bda267fc35cf2ff6b74e4e2500505aca408d306fabdc2201386721d82b801cb1bd70ee43f015caec48356d13b84f5f8c5d2922d2c2da34b03fa695996dceaa
7
- data.tar.gz: acd79ec11a7b1fc356aaa3323e51c748bcbbf24add3d37ebc826dd510a8dacfb9cc9d73efdaa15c7fd0d11087987bec2a94fe880e74af332599d78aa14a7335c
6
+ metadata.gz: 96c0ad09cbe74495f54bb76a9c1f2db9449362cb2e521331b2408c20f2572d091d07077ee3f59522c4b0e430e8702f9845ee5cb2c9aac0bb5adc60e027de4ef2
7
+ data.tar.gz: 86d863d8c3cc7ceb8022097fbdee9dc87851376d842f77499627aa2aa54119c15a2f7e96bb95d456cbf27f82809f030fb3edd8b9d6ae1eb2017b280edb4a1032
@@ -3,26 +3,26 @@ module Munge
3
3
  class Bootloader
4
4
  # @param root_path [String] Absolute path to munge directory
5
5
  def initialize(root_path:)
6
- @root_path = root_path
7
- @config_path = File.join(root_path, "config.yml")
8
- @setup_path = File.join(root_path, "setup.rb")
9
- @rules_path = File.join(root_path, "rules.rb")
10
- @config = Munge::Util::Config.read(@config_path)
6
+ @root_path = root_path
7
+ @setup_path = File.join(root_path, "setup.rb")
8
+ @rules_path = File.join(root_path, "rules.rb")
9
+
10
+ config_path = File.join(root_path, "config.rb")
11
+ @config = Munge::PreInit.new(config_path).config
11
12
  end
12
13
 
13
14
  # @return [Munge::Init]
14
15
  def init
15
16
  @init ||=
16
17
  Init.new(
17
- root_path: @root_path,
18
- config: @config,
19
- setup_path: @setup_path,
20
- rules_path: @rules_path
18
+ root_path: root_path,
19
+ config: config,
20
+ setup_path: setup_path,
21
+ rules_path: rules_path
21
22
  )
22
23
  end
23
24
 
24
25
  attr_reader :root_path
25
- attr_reader :config_path
26
26
  attr_reader :setup_path
27
27
  attr_reader :rules_path
28
28
  attr_reader :config
@@ -11,7 +11,7 @@ module Munge
11
11
  destination_root = bootloader.root_path
12
12
  config = bootloader.config
13
13
  app = application(bootloader)
14
- destination = File.expand_path(build_root || config[:output], destination_root)
14
+ destination = File.expand_path(build_root || config[:output_path], destination_root)
15
15
 
16
16
  @runner =
17
17
  Munge::Runner.new(
@@ -27,7 +27,7 @@ module Munge
27
27
  end
28
28
 
29
29
  ignore(listen, ENV["BUILD_ROOT"])
30
- ignore(listen, @bootloader.config[:output])
30
+ ignore(listen, @bootloader.config[:output_path])
31
31
 
32
32
  listen
33
33
  end
@@ -37,7 +37,7 @@ module Munge
37
37
  config = bootloader.config
38
38
  @host = host
39
39
  @port = port
40
- root = File.expand_path(build_root || config[:output], bootloader.root_path)
40
+ root = File.expand_path(build_root || config[:output_path], bootloader.root_path)
41
41
 
42
42
  @app =
43
43
  Rack::Builder.new do
@@ -55,7 +55,7 @@ module Munge
55
55
 
56
56
  def bootloader
57
57
  Munge::Bootloader.new(root_path: current_working_directory)
58
- rescue Munge::Errors::ConfigYmlNotFound => e
58
+ rescue Munge::Errors::ConfigRbNotFound => e
59
59
  puts e.message
60
60
  exit
61
61
  end
@@ -0,0 +1,53 @@
1
+ module Munge
2
+ class Config
3
+ def initialize(**configs)
4
+ @configs = configs
5
+ end
6
+
7
+ def [](key)
8
+ sym_key = key.to_sym
9
+
10
+ if @configs.key?(sym_key)
11
+ @configs[sym_key]
12
+ else
13
+ raise Munge::Errors::ConfigKeyNotFound, sym_key
14
+ end
15
+ end
16
+
17
+ def []=(key, value)
18
+ @configs[key.to_sym] = value
19
+ end
20
+
21
+ def key?(key)
22
+ @configs.key?(key)
23
+ end
24
+
25
+ def method_missing(method_name, *arguments)
26
+ if setter_fn?(method_name)
27
+ self[key_from_setter(method_name)] = arguments.first
28
+ elsif key?(method_name)
29
+ self[method_name]
30
+ end
31
+ end
32
+
33
+ def respond_to_missing?(method_name, include_private = false)
34
+ if setter_fn?(method_name)
35
+ true
36
+ elsif key?(method_name)
37
+ true
38
+ else
39
+ super
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def setter_fn?(method_name)
46
+ method_name.to_s.end_with?("=")
47
+ end
48
+
49
+ def key_from_setter(method_name)
50
+ method_name.to_s.sub(/=$/, "").to_sym
51
+ end
52
+ end
53
+ end
data/lib/munge/errors.rb CHANGED
@@ -65,7 +65,7 @@ module Munge
65
65
  end
66
66
  end
67
67
 
68
- class ConfigYmlNotFound < Base
68
+ class ConfigRbNotFound < Base
69
69
  include ErrorWithIdentifier
70
70
 
71
71
  def message
@@ -73,5 +73,13 @@ module Munge
73
73
  "Are you in the correct directory, or did you run `munge init`?"
74
74
  end
75
75
  end
76
+
77
+ class ConfigKeyNotFound < Base
78
+ include ErrorWithIdentifier
79
+
80
+ def message
81
+ "Couldn't find config for key: #{@identifier.inspect}"
82
+ end
83
+ end
76
84
  end
77
85
  end
data/lib/munge/go/sass.rb CHANGED
@@ -18,13 +18,11 @@ module Munge
18
18
  #
19
19
  # @param system [Munge::System]
20
20
  # @return [void]
21
- # rubocop:disable Style/AccessorMethodName
22
21
  def set_sass_system!(system)
23
22
  Sass::Script::Functions.send(:define_method, :system) do
24
23
  system
25
24
  end
26
25
  end
27
- # rubocop:enable Style/AccessorMethodName
28
26
 
29
27
  # Includes methods into Sass functions scope
30
28
  #
data/lib/munge/init.rb CHANGED
@@ -2,6 +2,8 @@ module Munge
2
2
  # This class loads the user rules, as well as provides some useful methods
3
3
  # for setup.
4
4
  class Init
5
+ include Munge::Util::Import
6
+
5
7
  # Initializing loads up the user's `setup.rb` and `rules.rb`.
6
8
  def initialize(root_path:,
7
9
  config:,
@@ -34,8 +36,7 @@ module Munge
34
36
  # @return [void]
35
37
  def import(file_path)
36
38
  absolute_file_path = File.expand_path(file_path, root_path)
37
- contents = File.read(absolute_file_path)
38
- @binding.eval(contents, absolute_file_path)
39
+ import_to_context(absolute_file_path, @binding)
39
40
  end
40
41
 
41
42
  attr_reader :app
@@ -0,0 +1,28 @@
1
+ module Munge
2
+ class PreInit
3
+ include Munge::Util::Import
4
+
5
+ def initialize(config_path)
6
+ if !File.exist?(config_path)
7
+ raise Munge::Errors::ConfigRbNotFound, config_path
8
+ end
9
+
10
+ @config_path = config_path
11
+ end
12
+
13
+ def config
14
+ config = Munge::Config.new
15
+
16
+ import_to_context(@config_path, binding)
17
+
18
+ config
19
+ end
20
+
21
+ private
22
+
23
+ def __end__
24
+ contents = File.read(@config_path)
25
+ contents.split(/^__END__$/, 2).last
26
+ end
27
+ end
28
+ end
@@ -1,9 +1,9 @@
1
1
  module Munge
2
2
  module Routers
3
- class AddIndexHtml
4
- def initialize(html_extensions:, index:)
5
- @html_extensions = html_extensions
6
- @index = index
3
+ class AddDirectoryIndex
4
+ def initialize(extensions:, index:)
5
+ @extensions = extensions
6
+ @index = index
7
7
  end
8
8
 
9
9
  def type
@@ -21,7 +21,7 @@ module Munge
21
21
  private
22
22
 
23
23
  def item_is_html?(item)
24
- intersection = item.extensions & @html_extensions
24
+ intersection = item.extensions & @extensions
25
25
 
26
26
  !intersection.empty?
27
27
  end
@@ -39,7 +39,7 @@ module Munge
39
39
  end
40
40
 
41
41
  def hash(content)
42
- Digest::MD5.hexdigest(content)
42
+ Digest::SHA256.hexdigest(content)
43
43
  end
44
44
 
45
45
  def disassemble(path)
@@ -1,10 +1,10 @@
1
1
  module Munge
2
2
  module Routers
3
- class RemoveIndexBasename
4
- def initialize(html_extensions:, index:)
5
- @html_extensions = html_extensions
6
- @index = index
7
- @index_basename = Munge::Util::Path.basename_no_extension(@index)
3
+ class RemoveBasename
4
+ def initialize(extensions:, basenames:, keep_explicit:)
5
+ @extensions = extensions
6
+ @basenames = basenames
7
+ @keep_if_explicit_extension = keep_explicit
8
8
  end
9
9
 
10
10
  def type
@@ -12,7 +12,7 @@ module Munge
12
12
  end
13
13
 
14
14
  def match?(initial_route, item)
15
- item_is_html?(item) && basename_is_index?(initial_route)
15
+ item_has_extension?(item) && route_has_basename?(initial_route)
16
16
  end
17
17
 
18
18
  def call(initial_route, _item)
@@ -21,14 +21,24 @@ module Munge
21
21
 
22
22
  private
23
23
 
24
- def item_is_html?(item)
25
- intersection = item.extensions & @html_extensions
24
+ def item_has_extension?(item)
25
+ intersection = item.extensions & @extensions
26
26
 
27
27
  !intersection.empty?
28
28
  end
29
29
 
30
- def basename_is_index?(route)
31
- File.basename(route) == @index_basename
30
+ def route_has_basename?(route)
31
+ if @keep_if_explicit_extension
32
+ route_extensions = Munge::Util::Path.extnames(route)
33
+
34
+ if route_extensions.any?
35
+ return false
36
+ end
37
+ end
38
+
39
+ route_basename = Munge::Util::Path.basename_no_extension(route)
40
+
41
+ @basenames.include?(route_basename)
32
42
  end
33
43
  end
34
44
  end
@@ -5,7 +5,7 @@ module Munge
5
5
  # @param ignore_extensions [Array<String>] Strings are converted to regex
6
6
  def initialize(text_extensions:,
7
7
  ignore_extensions:)
8
- @text_extensions = Set.new(text_extensions)
8
+ @text_extensions = text_extensions
9
9
  @item_identifier = ItemIdentifier.new(remove_extensions: ignore_extensions)
10
10
  end
11
11
 
@@ -59,20 +59,20 @@ module Munge
59
59
 
60
60
  private
61
61
 
62
- def file_extensions(filepath)
63
- extensions = File.basename(filepath).split(".")[1..-1]
64
- Set.new(extensions)
65
- end
66
-
67
62
  def item_file_type(abspath)
68
- exts = file_extensions(abspath)
69
-
70
- if exts.intersect?(@text_extensions)
63
+ if has_text_extension?(abspath)
71
64
  :text
72
65
  else
73
66
  :binary
74
67
  end
75
68
  end
69
+
70
+ def has_text_extension?(filepath)
71
+ extensions = Munge::Util::Path.extnames(filepath)
72
+ intersection = extensions & @text_extensions
73
+
74
+ intersection.any?
75
+ end
76
76
  end
77
77
  end
78
78
  end
@@ -13,9 +13,9 @@ module Munge
13
13
  @compiled_content ||= @processor.transform(@item)
14
14
  end
15
15
 
16
- def_delegators :@item, *%i(type relpath id frontmatter stat layout)
17
- def_delegators :@item, *%i(dirname filename basename extensions)
18
- def_delegators :@item, *%i(relpath? route?)
16
+ def_delegators :@item, :type, :relpath, :id, :frontmatter, :stat, :layout
17
+ def_delegators :@item, :dirname, :filename, :basename, :extensions
18
+ def_delegators :@item, :relpath?, :route?
19
19
  end
20
20
  end
21
21
  end
data/lib/munge/system.rb CHANGED
@@ -8,12 +8,12 @@ module Munge
8
8
  def items
9
9
  return @items if @items
10
10
 
11
- source_path = File.expand_path(@config[:source], @root_path)
11
+ source_path = File.expand_path(@config[:source_path], @root_path)
12
12
 
13
13
  source_item_factory =
14
14
  ItemFactory.new(
15
- text_extensions: @config[:text_extensions] + @config[:bintext_extensions],
16
- ignore_extensions: @config[:dynamic_extensions]
15
+ text_extensions: @config[:items_text_extensions],
16
+ ignore_extensions: @config[:items_ignore_extensions]
17
17
  )
18
18
 
19
19
  @items =
@@ -26,11 +26,11 @@ module Munge
26
26
  def layouts
27
27
  return @layouts if @layouts
28
28
 
29
- layouts_path = File.expand_path(@config[:layouts], @root_path)
29
+ layouts_path = File.expand_path(@config[:layouts_path], @root_path)
30
30
 
31
31
  layouts_item_factory =
32
32
  ItemFactory.new(
33
- text_extensions: @config[:text_extensions] + @config[:bintext_extensions],
33
+ text_extensions: @config[:layouts_text_extensions],
34
34
  ignore_extensions: %w(.+)
35
35
  )
36
36
 
@@ -55,7 +55,7 @@ module Munge
55
55
  def global_data
56
56
  return @global_data if @global_data
57
57
 
58
- data_path = File.expand_path(@config[:data], @root_path)
58
+ data_path = File.expand_path(@config[:data_path], @root_path)
59
59
  @global_data = YAML.load_file(data_path) || {}
60
60
  end
61
61
 
@@ -11,7 +11,7 @@ module Munge
11
11
  :tilt
12
12
  end
13
13
 
14
- def call(item, content = nil, renderer = nil)
14
+ def call(item, content, renderer = nil)
15
15
  scope = Scope.new(@system.clone, @demands)
16
16
  @registry.each { |helpers| scope.extend(helpers) }
17
17
 
@@ -0,0 +1,15 @@
1
+ module Munge
2
+ module Util
3
+ module Import
4
+ # Loads file into current scope. Similar to `load "filename.rb"`
5
+ #
6
+ # @param absolute_file_path [String]
7
+ # @param execution_context [Binding]
8
+ # @return [void]
9
+ def import_to_context(absolute_file_path, execution_context)
10
+ contents = File.read(absolute_file_path)
11
+ execution_context.eval(contents, absolute_file_path)
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/munge/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Munge
2
- VERSION = "0.14.0".freeze
2
+ VERSION = "0.15.0".freeze
3
3
  end
data/lib/munge.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require "fileutils"
2
2
  require "forwardable"
3
3
  require "pathname"
4
- require "set"
5
4
  require "yaml"
6
5
  require "cgi"
7
6
 
@@ -19,8 +18,8 @@ require "munge/item"
19
18
  require "munge/errors"
20
19
  require "munge/util/path"
21
20
  require "munge/util/symbol_hash"
22
- require "munge/util/config"
23
21
  require "munge/util/boolean_regex"
22
+ require "munge/util/import"
24
23
  require "munge/system/router"
25
24
  require "munge/system/router/itemish"
26
25
  require "munge/system/item_factory"
@@ -34,8 +33,10 @@ require "munge/writers/filesystem"
34
33
  require "munge/writers/noop"
35
34
  require "munge/write_manager"
36
35
  require "munge/application"
36
+ require "munge/config"
37
37
  require "munge/runner"
38
38
  require "munge/reporter"
39
+ require "munge/pre_init"
39
40
  require "munge/init"
40
41
  require "munge/bootloader"
41
42
 
@@ -49,6 +50,6 @@ require "munge/helpers/rendering"
49
50
  require "munge/helpers/tag"
50
51
  require "munge/routers/auto_add_extension"
51
52
  require "munge/routers/fingerprint"
52
- require "munge/routers/add_index_html"
53
+ require "munge/routers/add_directory_index"
53
54
  require "munge/routers/remove_index_basename"
54
55
  require "munge/transformers/tilt_transformer"
data/seeds/config.rb ADDED
@@ -0,0 +1,65 @@
1
+ yml = YAML.load(__end__)
2
+
3
+ # Path to content
4
+ config.source_path = "src"
5
+ # Path to layouts
6
+ config.layouts_path = "layouts"
7
+ # Path to output result directory
8
+ config.output_path = "dest"
9
+ # Path to global data file
10
+ config.data_path = "data.yml"
11
+
12
+ # Determines `item.type` for items and layouts
13
+ # This can be useful avoid applying a transformation to an image
14
+ config.items_text_extensions = yml["text_extensions"] + yml["bintext_extensions"]
15
+ config.layouts_text_extensions = yml["text_extensions"] + yml["bintext_extensions"]
16
+
17
+ # Specify which extensions shouldn't be included as a part of `item.id`
18
+ config.items_ignore_extensions = yml["dynamic_extensions"]
19
+
20
+ # Specify which files require an asset fingerprint
21
+ config.router_fingerprint_extensions = yml["bin_extensions"] + yml["bintext_extensions"]
22
+
23
+ # Separator between basename and fingerprint hash
24
+ config.router_fingeprint_separator = "-"
25
+
26
+ # Remove basename from compiled _route_ if the basename is passed and original file has extension
27
+ config.router_remove_basename_original_extensions = %w(htm html)
28
+ config.router_remove_basename_route_basenames = %w(index)
29
+ config.router_remove_basename_keep_explicit = true
30
+
31
+ # Append basename to the _filepath_ if missing and if original file has extension
32
+ config.router_add_index_original_extensions = yml["text_extensions"]
33
+ config.router_add_index_basename = "index.html"
34
+
35
+ # Ensure that items with these extensions retains the extension, even if the route itself does not specify it
36
+ config.router_keep_extensions = yml["bin_extensions"] + yml["bintext_extensions"]
37
+
38
+ __END__
39
+ ---
40
+ text_extensions:
41
+ - html
42
+ - htm
43
+ - txt
44
+ - md
45
+
46
+ bintext_extensions:
47
+ - js
48
+ - css
49
+ - scss
50
+
51
+ bin_extensions:
52
+ - gif
53
+ - ico
54
+ - jpg
55
+ - jpeg
56
+ - png
57
+ - otf
58
+ - ttf
59
+ - eot
60
+ - woff
61
+
62
+ dynamic_extensions:
63
+ - erb
64
+ - scss
65
+ - md
data/seeds/lib/routing.rb CHANGED
@@ -1,28 +1,29 @@
1
1
  if ENV["MUNGE_ENV"] == "production"
2
2
  system.router.register(
3
3
  Routers::Fingerprint.new(
4
- extensions: config[:bin_extensions] + config[:bintext_extensions],
5
- separator: config[:fingeprint_separator]
4
+ extensions: config[:router_fingerprint_extensions],
5
+ separator: config[:router_fingeprint_separator]
6
6
  )
7
7
  )
8
8
  end
9
9
 
10
10
  system.router.register(
11
- Routers::RemoveIndexBasename.new(
12
- html_extensions: config[:text_extensions],
13
- index: config[:index]
11
+ Routers::RemoveBasename.new(
12
+ extensions: config[:router_remove_basename_original_extensions],
13
+ basenames: config[:router_remove_basename_route_basenames],
14
+ keep_explicit: config[:router_remove_basename_keep_explicit]
14
15
  )
15
16
  )
16
17
 
17
18
  system.router.register(
18
- Routers::AddIndexHtml.new(
19
- html_extensions: config[:text_extensions],
20
- index: config[:index]
19
+ Routers::AddDirectoryIndex.new(
20
+ extensions: config[:router_add_index_original_extensions],
21
+ index: config[:router_add_index_basename]
21
22
  )
22
23
  )
23
24
 
24
25
  system.router.register(
25
26
  Routers::AutoAddExtension.new(
26
- keep_extensions: config[:bin_extensions] + config[:bintext_extensions]
27
+ keep_extensions: config[:router_keep_extensions]
27
28
  )
28
29
  )
data/seeds/lib/sass.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "munge/go/sass"
2
2
 
3
- Munge::Go.add_sass_load_path!(root_path, config[:source], AssetRoots.stylesheets_root)
3
+ Munge::Go.add_sass_load_path!(root_path, config[:source_path], AssetRoots.stylesheets_root)
4
4
 
5
5
  Munge::Go.set_sass_system!(system)
6
6
 
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.14.0
4
+ version: 0.15.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-12-23 00:00:00.000000000 Z
11
+ date: 2017-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -288,7 +288,7 @@ dependencies:
288
288
  - - "~>"
289
289
  - !ruby/object:Gem::Version
290
290
  version: '3.4'
291
- description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.14.0/README.md
291
+ description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.15.0/README.md
292
292
  email:
293
293
  - zach.ahn@gmail.com
294
294
  executables:
@@ -310,6 +310,7 @@ files:
310
310
  - lib/munge/cli/commands/update.rb
311
311
  - lib/munge/cli/commands/view.rb
312
312
  - lib/munge/cli/dispatch.rb
313
+ - lib/munge/config.rb
313
314
  - lib/munge/errors.rb
314
315
  - lib/munge/formatters/default.rb
315
316
  - lib/munge/formatters/dots.rb
@@ -324,8 +325,9 @@ files:
324
325
  - lib/munge/helpers/tag.rb
325
326
  - lib/munge/init.rb
326
327
  - lib/munge/item.rb
328
+ - lib/munge/pre_init.rb
327
329
  - lib/munge/reporter.rb
328
- - lib/munge/routers/add_index_html.rb
330
+ - lib/munge/routers/add_directory_index.rb
329
331
  - lib/munge/routers/auto_add_extension.rb
330
332
  - lib/munge/routers/fingerprint.rb
331
333
  - lib/munge/routers/remove_index_basename.rb
@@ -341,7 +343,7 @@ files:
341
343
  - lib/munge/system/router/itemish.rb
342
344
  - lib/munge/transformers/tilt_transformer.rb
343
345
  - lib/munge/util/boolean_regex.rb
344
- - lib/munge/util/config.rb
346
+ - lib/munge/util/import.rb
345
347
  - lib/munge/util/path.rb
346
348
  - lib/munge/util/symbol_hash.rb
347
349
  - lib/munge/version.rb
@@ -351,7 +353,7 @@ files:
351
353
  - munge.gemspec
352
354
  - seeds/.gitignore
353
355
  - seeds/Gemfile.tt
354
- - seeds/config.yml
356
+ - seeds/config.rb
355
357
  - seeds/data.yml
356
358
  - seeds/layouts/blog_archives.html.erb
357
359
  - seeds/layouts/blog_index.html.erb
@@ -1,30 +0,0 @@
1
- module Munge
2
- module Util
3
- class Config
4
- class << self
5
- def read(path)
6
- abspath = File.expand_path(path)
7
-
8
- yaml = read_yaml(abspath)
9
-
10
- config =
11
- if yaml.is_a?(Hash)
12
- yaml
13
- else
14
- {}
15
- end
16
-
17
- Munge::Util::SymbolHash.deep_convert(config)
18
- end
19
-
20
- private
21
-
22
- def read_yaml(abspath)
23
- YAML.load_file(abspath)
24
- rescue
25
- raise Munge::Errors::ConfigYmlNotFound, abspath
26
- end
27
- end
28
- end
29
- end
30
- end
data/seeds/config.yml DELETED
@@ -1,29 +0,0 @@
1
- source: src
2
- output: dest
3
- data: data.yml
4
- layouts: layouts
5
- index: index.html
6
- fingeprint_separator: "-"
7
- text_extensions:
8
- - html
9
- - htm
10
- - txt
11
- - md
12
- bintext_extensions:
13
- - js
14
- - css
15
- - scss
16
- bin_extensions:
17
- - gif
18
- - ico
19
- - jpg
20
- - jpeg
21
- - png
22
- - otf
23
- - ttf
24
- - eot
25
- - woff
26
- dynamic_extensions:
27
- - erb
28
- - scss
29
- - md