packs 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packs/private/configuration.rb +35 -0
- data/lib/packs/private.rb +2 -0
- data/lib/packs.rb +14 -7
- metadata +3 -3
- data/lib/packs/configuration.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f911f00f2059f8b472edbfbe099fe0ee0586bb8426c8593d002fb7a0f4e9924
|
4
|
+
data.tar.gz: fc62651af9566195f83822938122f418ed7dd5cab115a3a27ee91fb4416724f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a39af86905f7d639e98938eb83fd45d898a60991cae834d48365da60785dd1dc75b935eced72fa02da1f766382c5cbf817e4337047fbc7b5df66a1ca4853326
|
7
|
+
data.tar.gz: d66b67aa6a4b35bccf554390aa5dc23d9ac109dfba0fffe0100ac7d35152afbc6974034c3bbde61d6bcf3278e2a05f28266ea1f3d44614659629beb381704983
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# typed: strict
|
2
|
+
|
3
|
+
module Packs
|
4
|
+
module Private
|
5
|
+
class Configuration < T::Struct
|
6
|
+
extend T::Sig
|
7
|
+
DEFAULT_PACK_PATHS = T.let([
|
8
|
+
'packs/*',
|
9
|
+
'packs/*/*',
|
10
|
+
], T::Array[String])
|
11
|
+
|
12
|
+
prop :pack_paths, T::Array[String]
|
13
|
+
|
14
|
+
sig { returns(Configuration) }
|
15
|
+
def self.fetch
|
16
|
+
configuration_path = Pathname.new('packs.yml')
|
17
|
+
config_hash = configuration_path.exist? ? YAML.load_file('packs.yml') : {}
|
18
|
+
|
19
|
+
new(
|
20
|
+
pack_paths: pack_paths(config_hash),
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
sig { params(config_hash: T::Hash[T.untyped, T.untyped]).returns(T::Array[String]) }
|
25
|
+
def self.pack_paths(config_hash)
|
26
|
+
specified_pack_paths = config_hash['pack_paths']
|
27
|
+
if specified_pack_paths.nil?
|
28
|
+
DEFAULT_PACK_PATHS.dup
|
29
|
+
else
|
30
|
+
Array(specified_pack_paths)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/packs/private.rb
CHANGED
data/lib/packs.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'sorbet-runtime'
|
5
5
|
require 'packs/pack'
|
6
|
-
require 'packs/configuration'
|
7
6
|
require 'packs/private'
|
8
7
|
|
9
8
|
module Packs
|
@@ -38,6 +37,17 @@ module Packs
|
|
38
37
|
@for_file = nil
|
39
38
|
end
|
40
39
|
|
40
|
+
sig { returns(Private::Configuration) }
|
41
|
+
def config
|
42
|
+
@config = T.let(@config, T.nilable(Private::Configuration))
|
43
|
+
@config ||= Private::Configuration.fetch
|
44
|
+
end
|
45
|
+
|
46
|
+
sig { params(blk: T.proc.params(arg0: Private::Configuration).void).void }
|
47
|
+
def configure(&blk)
|
48
|
+
yield(config)
|
49
|
+
end
|
50
|
+
|
41
51
|
private
|
42
52
|
|
43
53
|
sig { returns(T::Hash[String, Pack]) }
|
@@ -56,12 +66,9 @@ module Packs
|
|
56
66
|
|
57
67
|
sig { returns(T::Array[Pathname]) }
|
58
68
|
def package_glob_patterns
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
*absolute_root.glob("*/#{PACKAGE_FILE}"),
|
63
|
-
*absolute_root.glob("*/*/#{PACKAGE_FILE}")
|
64
|
-
]
|
69
|
+
absolute_root = Private.root
|
70
|
+
config.pack_paths.flat_map do |pack_path|
|
71
|
+
Pathname.glob(absolute_root.join(pack_path).join(PACKAGE_FILE))
|
65
72
|
end
|
66
73
|
end
|
67
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gusto Engineers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
@@ -118,9 +118,9 @@ extra_rdoc_files: []
|
|
118
118
|
files:
|
119
119
|
- README.md
|
120
120
|
- lib/packs.rb
|
121
|
-
- lib/packs/configuration.rb
|
122
121
|
- lib/packs/pack.rb
|
123
122
|
- lib/packs/private.rb
|
123
|
+
- lib/packs/private/configuration.rb
|
124
124
|
homepage: https://github.com/rubyatscale/packs
|
125
125
|
licenses:
|
126
126
|
- MIT
|
data/lib/packs/configuration.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# typed: strict
|
2
|
-
|
3
|
-
module Packs
|
4
|
-
class Configuration
|
5
|
-
extend T::Sig
|
6
|
-
|
7
|
-
sig { params(roots: T::Array[String]).void }
|
8
|
-
attr_writer :roots
|
9
|
-
|
10
|
-
sig { void }
|
11
|
-
def initialize
|
12
|
-
@roots = T.let(ROOTS, T::Array[String])
|
13
|
-
end
|
14
|
-
|
15
|
-
sig { returns(T::Array[Pathname]) }
|
16
|
-
def roots
|
17
|
-
@roots.map do |root|
|
18
|
-
Pathname.new(root)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class << self
|
24
|
-
extend T::Sig
|
25
|
-
|
26
|
-
sig { returns(Configuration) }
|
27
|
-
def config
|
28
|
-
@config = T.let(@config, T.nilable(Configuration))
|
29
|
-
@config ||= Configuration.new
|
30
|
-
end
|
31
|
-
|
32
|
-
sig { params(blk: T.proc.params(arg0: Configuration).void).void }
|
33
|
-
def configure(&blk)
|
34
|
-
yield(config)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|