munge 0.12.0 → 0.13.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: b3e1eb8424b81b08cb185b26e80273a94ff027f5
4
- data.tar.gz: eb0dbd0f3a65fbd4ce2ab8b5e8aacc48158ee03c
3
+ metadata.gz: c0a3b52e10d621eb9279d8e67047237914533a18
4
+ data.tar.gz: 772664c0d20c42a8ebc98bf158cef506429b73cf
5
5
  SHA512:
6
- metadata.gz: fc9abaedb2d419a05eb69b45e14702e88438162df849749daa1b968b3617a6f271e5a4c89985a65adcf0c2ec2bebf5dc32298940bf9ac9e2bde95637eb8dd8e3
7
- data.tar.gz: 814114a8a51a3e298687569cc7effde92cfb872304761633cf0df035c06f71734a7b4f6e672c009c0333627f2ea18f79c8cfc0147eb06b3bfb53806efda4f1cb
6
+ metadata.gz: 146e9511c1b41e8326657a16e20993fc44506d35b784194e8c182a2c60d0f1744a7ea85a222320ed28eb038b99e8ef9093996f7860058c377815fdeeaf7a2439
7
+ data.tar.gz: 77d5320774df65fd79e61dc417f2a9a4c7fd3856da5654b7055553d56d9607bbd93f3d98b9b83bd1981d178bb4330235a1f2ae3bcd75554ab6d43843a809f161
@@ -15,7 +15,7 @@ module Munge
15
15
  end
16
16
 
17
17
  def call
18
- directory("config", File.expand_path("config", destination_root))
18
+ directory("lib", File.expand_path("lib", destination_root))
19
19
  copy_file("setup.rb")
20
20
  end
21
21
  end
@@ -55,6 +55,9 @@ module Munge
55
55
 
56
56
  def bootloader
57
57
  Munge::Bootloader.new(root_path: current_working_directory)
58
+ rescue Munge::Errors::ConfigYmlNotFound => e
59
+ puts e.message
60
+ exit
58
61
  end
59
62
 
60
63
  def symbolized_options
@@ -0,0 +1,77 @@
1
+ module Munge
2
+ module Errors
3
+ class Base < StandardError
4
+ end
5
+
6
+ module ErrorWithIdentifier
7
+ def initialize(identifier)
8
+ @identifier = identifier
9
+ end
10
+ end
11
+
12
+ class DoubleWriteError < Base
13
+ include ErrorWithIdentifier
14
+
15
+ def message
16
+ "attempted to write #{@identifier} twice"
17
+ end
18
+ end
19
+
20
+ class DuplicateItemError < Base
21
+ include ErrorWithIdentifier
22
+
23
+ def message
24
+ "item with id `#{@identifier}` already exists"
25
+ end
26
+ end
27
+
28
+ class ItemNotFoundError < Base
29
+ include ErrorWithIdentifier
30
+
31
+ def message
32
+ "item not found (#{@identifier})"
33
+ end
34
+ end
35
+
36
+ class ItemHasNoRouteError < Base
37
+ include ErrorWithIdentifier
38
+
39
+ def message
40
+ "item `#{@identifier}` has no route"
41
+ end
42
+ end
43
+
44
+ class DuplicateTransformerError < Base
45
+ include ErrorWithIdentifier
46
+
47
+ def message
48
+ "already registered transformer `#{@identifier}`"
49
+ end
50
+ end
51
+
52
+ class TransformerNotFoundError < Base
53
+ include ErrorWithIdentifier
54
+
55
+ def message
56
+ "transformer `#{@identifier}` is not installed"
57
+ end
58
+ end
59
+
60
+ class InvalidRouterError < Base
61
+ include ErrorWithIdentifier
62
+
63
+ def message
64
+ "invalid router with type #{@identifier}"
65
+ end
66
+ end
67
+
68
+ class ConfigYmlNotFound < Base
69
+ include ErrorWithIdentifier
70
+
71
+ def message
72
+ "Expected to find config file: #{@identifier}\n" \
73
+ "Are you in the correct directory, or did you run `munge init`?"
74
+ end
75
+ end
76
+ end
77
+ end
data/lib/munge/init.rb CHANGED
@@ -24,9 +24,9 @@ module Munge
24
24
  @app.items.freeze
25
25
  end
26
26
 
27
- # @return [String] path to user's `config/` directory
28
- def config_path
29
- File.join(root_path, "config")
27
+ # @return [String] path to user's `lib/` directory
28
+ def lib_path
29
+ File.join(root_path, "lib")
30
30
  end
31
31
 
32
32
  # Loads file into current scope. Similar to `load "filename.rb"`
data/lib/munge/runner.rb CHANGED
@@ -33,7 +33,7 @@ module Munge
33
33
  when :new, :changed
34
34
  @writer.write(abspath, content)
35
35
  when :double_write_error
36
- raise "attempted to write #{item.route} twice"
36
+ raise Errors::DoubleWriteError, item.route
37
37
  when :identical
38
38
  # Defer to the reporter
39
39
  end
@@ -48,7 +48,7 @@ module Munge
48
48
  # @return [void]
49
49
  def push(item)
50
50
  if @items.key?(item.id)
51
- raise "item with id `#{item.id}` already exists"
51
+ raise Errors::DuplicateItemError, item.id
52
52
  else
53
53
  @items[item.id] = item
54
54
  end
@@ -60,7 +60,7 @@ module Munge
60
60
  if @items.key?(id)
61
61
  @items[id]
62
62
  else
63
- raise "item not found (#{id})"
63
+ raise Errors::ItemNotFoundError, id
64
64
  end
65
65
  end
66
66
 
@@ -19,7 +19,7 @@ module Munge
19
19
  # @param transformer [#call]
20
20
  def register_manually(name, transformer)
21
21
  if @registry.key?(name)
22
- raise "already registered transformer `#{name}`"
22
+ raise Errors::DuplicateTransformerError, name
23
23
  else
24
24
  @registry[name] = transformer
25
25
  end
@@ -44,7 +44,7 @@ module Munge
44
44
  if @registry.key?(name)
45
45
  @registry[name]
46
46
  else
47
- raise "transformer `#{name}` is not installed"
47
+ raise Errors::TransformerNotFoundError, name
48
48
  end
49
49
  end
50
50
  end
@@ -13,7 +13,7 @@ module Munge
13
13
  when :filepath
14
14
  @registries[:filepath].push(router)
15
15
  else
16
- raise "invalid router"
16
+ raise Errors::InvalidRouterError, router.type
17
17
  end
18
18
  end
19
19
 
@@ -32,7 +32,7 @@ module Munge
32
32
 
33
33
  def route_mapper(item, method_name, initial_route = nil)
34
34
  if !item.route && !initial_route
35
- raise "item `#{item.relpath}` has no route"
35
+ raise Errors::ItemHasNoRouteError, item.relpath
36
36
  end
37
37
 
38
38
  itemish = Itemish.new(item, @processor)
@@ -21,6 +21,8 @@ module Munge
21
21
 
22
22
  def read_yaml(abspath)
23
23
  YAML.load_file(abspath)
24
+ rescue
25
+ raise Munge::Errors::ConfigYmlNotFound, abspath
24
26
  end
25
27
  end
26
28
  end
data/lib/munge/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Munge
2
- VERSION = "0.12.0".freeze
2
+ VERSION = "0.13.0".freeze
3
3
  end
data/lib/munge.rb CHANGED
@@ -16,6 +16,7 @@ end
16
16
  # Core
17
17
  require "munge/version"
18
18
  require "munge/item"
19
+ require "munge/errors"
19
20
  require "munge/util/path"
20
21
  require "munge/util/symbol_hash"
21
22
  require "munge/util/config"
File without changes
File without changes
File without changes
File without changes
data/seeds/setup.rb CHANGED
@@ -1,3 +1,3 @@
1
- Dir.glob(File.join(config_path, "*.rb")).sort.each do |file_path|
1
+ Dir.glob(File.join(lib_path, "*.rb")).sort.each do |file_path|
2
2
  import(file_path)
3
3
  end
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.12.0
4
+ version: 0.13.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-07-16 00:00:00.000000000 Z
11
+ date: 2016-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -308,7 +308,7 @@ dependencies:
308
308
  - - "<"
309
309
  - !ruby/object:Gem::Version
310
310
  version: '2.0'
311
- description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.12.0/README.md
311
+ description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.13.0/README.md
312
312
  email:
313
313
  - zach.ahn@gmail.com
314
314
  executables:
@@ -330,6 +330,7 @@ files:
330
330
  - lib/munge/cli/commands/update.rb
331
331
  - lib/munge/cli/commands/view.rb
332
332
  - lib/munge/cli/dispatch.rb
333
+ - lib/munge/errors.rb
333
334
  - lib/munge/formatters/default.rb
334
335
  - lib/munge/formatters/dots.rb
335
336
  - lib/munge/go/sass.rb
@@ -371,13 +372,13 @@ files:
371
372
  - seeds/.gitignore
372
373
  - seeds/Gemfile.tt
373
374
  - seeds/config.yml
374
- - seeds/config/_asset_roots.rb
375
- - seeds/config/routing.rb
376
- - seeds/config/sass.rb
377
- - seeds/config/view_helpers.rb
378
375
  - seeds/data.yml
379
376
  - seeds/layouts/default.html.erb
380
377
  - seeds/layouts/sitemap.html.erb
378
+ - seeds/lib/_asset_roots.rb
379
+ - seeds/lib/routing.rb
380
+ - seeds/lib/sass.rb
381
+ - seeds/lib/view_helpers.rb
381
382
  - seeds/rules.rb
382
383
  - seeds/setup.rb
383
384
  - seeds/src/about.html.erb