hub_kernel 0.27.0 → 0.28.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 +4 -4
- data/README.md +2 -0
- data/lib/hub_kernel/crossings.rb +7 -1
- data/lib/hub_kernel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3502ce7bf5c817ad2af27af2dedf3089f9f5fba2238e1d833058eee55b652fda
|
|
4
|
+
data.tar.gz: 465b5294ef3a4493dad58e8e7763fe2cfc64332830267d9c3382fc971c3ba747
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d131c019e052d61f4648ae09274dcf4aae9709622f67f75718681438a839c7fe238fc90a77386e7d0f0376ceaa823687a7b751a145c580e3ebcbe5d57f1b6516
|
|
7
|
+
data.tar.gz: ba18eeab7e2c11aeccbdd17736245c2e925d7699d2a56d685c26507dc8261a6f52123a2e6c92634aba41a6a17f9a4564a51793b206307aa7052295f7e85e915b
|
data/README.md
CHANGED
|
@@ -371,6 +371,8 @@ end
|
|
|
371
371
|
- By default the test reads every `.rb` and `.erb` file under `app/` and under each hub
|
|
372
372
|
folder's `app/`, helpers and services included.
|
|
373
373
|
- A constant inside another hub's class counts as naming that class.
|
|
374
|
+
- In a `.rb` file, the text of a double-quoted string names no class, so a label such as
|
|
375
|
+
`"Billing"` is not a crossing. Code interpolated into the string is still read.
|
|
374
376
|
- A name no hub owns, such as a namespace, is not a crossing, and neither is a class on
|
|
375
377
|
the `shared` list.
|
|
376
378
|
- `namespaces` gives a hub every class under a namespace, such as a hub gem's `Billing`,
|
data/lib/hub_kernel/crossings.rb
CHANGED
|
@@ -3,6 +3,9 @@ require "active_support/core_ext/string/inflections"
|
|
|
3
3
|
|
|
4
4
|
module HubKernel
|
|
5
5
|
class Crossings
|
|
6
|
+
DOUBLE_QUOTED = /"(?:[^"\\]|\\.)*"/
|
|
7
|
+
INTERPOLATED = /#\{[^}]*\}/
|
|
8
|
+
|
|
6
9
|
def initialize(owners: {}, shared: [], host_layer: nil, interfaces: {}, namespaces: {}, folder_files: [])
|
|
7
10
|
@owners = owners
|
|
8
11
|
@folder_classes = {}
|
|
@@ -16,7 +19,8 @@ module HubKernel
|
|
|
16
19
|
|
|
17
20
|
def in(path, source)
|
|
18
21
|
hub = owner_of_file(path)
|
|
19
|
-
|
|
22
|
+
code = path.end_with?(".rb") ? without_string_text(source) : source
|
|
23
|
+
code.scan(/[A-Z]\w*(?:::[A-Z]\w*)*/).filter_map { |name| owned_class_in(name) }.uniq.select { |name| crossing?(name, hub) }
|
|
20
24
|
end
|
|
21
25
|
|
|
22
26
|
def read_folders(paths)
|
|
@@ -88,5 +92,7 @@ module HubKernel
|
|
|
88
92
|
end
|
|
89
93
|
|
|
90
94
|
def owner_of_view_folder(folder) = owner_of("#{folder}Controller") || owner_of(folder) || @host_layer
|
|
95
|
+
|
|
96
|
+
def without_string_text(source) = source.gsub(DOUBLE_QUOTED) { |literal| literal.scan(INTERPOLATED).join(" ") }
|
|
91
97
|
end
|
|
92
98
|
end
|
data/lib/hub_kernel/version.rb
CHANGED