foobara-type-generator 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: 5afb140653762dc42bbdfce26e1ec1abef0d578850b9d69c7947ed2ec037c0b3
4
- data.tar.gz: 49f5a55e47ad5e368e2fbd59887cd7713e0300f2955619e9366879a6753a26e5
3
+ metadata.gz: 371ff772daf8be10634ada53169fb375c2de6af3a4eff19107fe98e85649caf1
4
+ data.tar.gz: 10051cda28cf201af43a7b7a1764c950f4cb5d165c9def9949c6412934a54f2f
5
5
  SHA512:
6
- metadata.gz: 52be9b433833db56aee8fa5a7e61a646c913b4bef4b2b96077a2cd096629a030636fee5e4a7986c08f462d8d7231d689ef8c8a89254f47d31e4f20592c15ce50
7
- data.tar.gz: 8c027e98b50b988e36cdbf229922d1f5edac1b9f4cf80eb6a521a8baa785e73254ca1671338a21ebd1ebe5870e9c81bb272ee6312b0df9518b9bb613643630c7
6
+ metadata.gz: e94df421ed933c4890e1f22c54b2089a168c1ae0dfa7e03a12d6b8d04a11ac447476dee5aab388c201aed62fbe973b89642dc7e1d0077540df6039c1f24c055f
7
+ data.tar.gz: 446904fbefa29fd63375476e0cbd6e052fe1cab0ee7d426e9a3876bc17cef3e5cd26791d1afbd1c099dc811c166cc85b79a0ac37763bcee33da323d25ef409ab
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.2] - 2024-08-13
2
+
3
+ - Scope types/ under domain if one is given
4
+
1
5
  ## [0.0.1] - 2024-06-17
2
6
 
3
7
  - Add Apache-2.0 license
data/src/type_config.rb CHANGED
@@ -19,7 +19,19 @@ module Foobara
19
19
  end
20
20
 
21
21
  def module_path
22
- @module_path ||= [*organization&.split("::"), *domain&.split("::"), *name.split("::")]
22
+ @module_path ||= domain_path + post_domain_path
23
+ end
24
+
25
+ def domain_path
26
+ @domain_path ||= [*organization&.split("::"), *domain&.split("::")]
27
+ end
28
+
29
+ def post_domain_path
30
+ name.split("::")
31
+ end
32
+
33
+ def has_domain?
34
+ !domain_path.empty?
23
35
  end
24
36
  end
25
37
  end
@@ -23,15 +23,25 @@ module Foobara
23
23
  end
24
24
 
25
25
  def target_path
26
- *path, file = module_path.map { |part| Util.underscore(part) }
26
+ domain_path, post_domain_path = if has_domain?
27
+ [self.domain_path, self.post_domain_path]
28
+ else
29
+ *path, file = module_path.map { |part| Util.underscore(part) }
30
+ [path, [file]]
31
+ end
32
+
33
+ domain_path = domain_path.map { |part| Util.underscore(part) }
34
+ post_domain_path = post_domain_path.map { |part| Util.underscore(part) }
35
+
36
+ *post_domain_path, file = post_domain_path
37
+
38
+ path = ["src", *domain_path]
27
39
 
28
40
  unless path.last == "types"
29
41
  path << "types"
30
42
  end
31
43
 
32
- file = "#{file}.rb"
33
-
34
- ["src", *path, file]
44
+ [*path, *post_domain_path, "#{file}.rb"]
35
45
  end
36
46
 
37
47
  alias type_config relevant_manifest
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-type-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-18 00:00:00.000000000 Z
11
+ date: 2024-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foobara