marauders_map 0.1.0 → 0.1.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +13 -5
- data/lib/marauders_map/version.rb +1 -1
- data/lib/marauders_map.rb +0 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b5350a422c83ead48c283c856ddb180f115e3e052025bb44b8e61e1f42d561e
|
4
|
+
data.tar.gz: c236874489a968a9d56382f15ad18c0decb43d87d025001f1121a5882bc4ec56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f43d008a89c95c1dd2a192d12c4424dcc1b07de92e3492897c5cecf97bbffe13c0f10fd556f1d66fd18997378e9cd71bc2f65c44fe91725cdc007cc1dc986060
|
7
|
+
data.tar.gz: ffc585b713625a02da930c3a8710a34efbc4b298eb6c58597e324dd1225fdc9eb59046caf5f758ce39aa4f22f6f174579a9ad275c53b3e5e54675c8142a35495
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Marauder's Map
|
2
2
|
|
3
|
-
|
3
|
+
Define your Rails routes along side all your other Domain Driven stuff.
|
4
4
|
|
5
5
|
|
6
|
+
[](https://buildkite.com/wellware/marauders-map)
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -22,7 +23,7 @@ Or install it yourself as:
|
|
22
23
|
|
23
24
|
## Usage
|
24
25
|
|
25
|
-
|
26
|
+
#### Create an initializer, `config/initializers/marauders_map.rb`, with the following code:
|
26
27
|
|
27
28
|
``` ruby
|
28
29
|
MaraudersMap.pledge("I solemnly swear that I am up to no good.")
|
@@ -31,7 +32,7 @@ MaraudersMap.pledge("I solemnly swear that I am up to no good.")
|
|
31
32
|
Failure to recite this pledge, _verbatim_, will render Marauder's Map inoperable. Note that it is *not* necessary to declare 'Mischief managed' upon application shutdown.
|
32
33
|
|
33
34
|
|
34
|
-
|
35
|
+
#### Update `config/routes.rb` to include this:
|
35
36
|
|
36
37
|
``` ruby
|
37
38
|
MaraudersMap.reveal_routes!
|
@@ -39,7 +40,7 @@ MaraudersMap.reveal_routes!
|
|
39
40
|
|
40
41
|
This will throw an exception if the pledge has not been recited, and your routes will not be revealed.
|
41
42
|
|
42
|
-
|
43
|
+
#### Define your routes in the same place you manage your domains. For example, in `app/domains/sorting_hat/routes.rb`:
|
43
44
|
|
44
45
|
``` ruby
|
45
46
|
MaraudersMap.draw(:sorting_hat) do
|
@@ -55,6 +56,13 @@ end
|
|
55
56
|
The routing DSL is exactly the same as the one you use in your traditional routes files.
|
56
57
|
|
57
58
|
|
59
|
+
## TODO:
|
60
|
+
|
61
|
+
- [ ] Investigate potential issue when routes are autoloaded (as opposed to eager loaded)
|
62
|
+
|
63
|
+
- [ ] Easily examine generated routes (filter by domain)
|
64
|
+
|
65
|
+
|
58
66
|
## Development
|
59
67
|
|
60
68
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -63,7 +71,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
63
71
|
|
64
72
|
## Contributing
|
65
73
|
|
66
|
-
Bug reports and pull requests are welcome
|
74
|
+
Bug reports and pull requests are welcome at https://code.wellware.dev/leemachin/marauders_map.
|
67
75
|
|
68
76
|
## License
|
69
77
|
|
data/lib/marauders_map.rb
CHANGED
@@ -6,21 +6,7 @@ require 'active_support/core_ext/module/attribute_accessors_per_thread'
|
|
6
6
|
module MaraudersMap
|
7
7
|
extend self
|
8
8
|
|
9
|
-
UnrecitedPledgeError = Class.new(StandardError)
|
10
|
-
|
11
|
-
PLEDGE = 'I solemnly swear that I am up to no good.'
|
12
|
-
|
13
|
-
def pledge(statement)
|
14
|
-
self.statement = statement
|
15
|
-
end
|
16
|
-
|
17
9
|
def reveal_routes!
|
18
|
-
raise UnrecitedPledgeError, <<~MSG unless pledge_recited?
|
19
|
-
In order to use Marauder's Map you must recite the pledge. Do so by adding the following to your code.
|
20
|
-
|
21
|
-
MaraudersMap.pledge("#{PLEDGE}")
|
22
|
-
MSG
|
23
|
-
|
24
10
|
routes.each do |(_name, route)|
|
25
11
|
app.routes.append(&route)
|
26
12
|
end
|
@@ -40,10 +26,6 @@ module MaraudersMap
|
|
40
26
|
Rails.application
|
41
27
|
end
|
42
28
|
|
43
|
-
def pledge_recited?
|
44
|
-
statement == PLEDGE
|
45
|
-
end
|
46
|
-
|
47
29
|
def append_route(name, &definition)
|
48
30
|
self.routes ||= {}
|
49
31
|
routes[name] = definition
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marauders_map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Machin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|