packs-specification 0.0.9 → 0.0.10
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 +20 -19
- data/lib/packs/rspec/support.rb +11 -5
- 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: a95a4c598305baa6990d07093e98b49f55c3289c80d384e7beb558bcafde63ca
|
4
|
+
data.tar.gz: b6f2537d04165bee29925da1d29d9613da1b0219227ab397973efc65a1e64259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cc9f93bad4fd2fe25d1d5ac32c4895d6dfcdf64de56b0f6aec31b29129a9a9f902e62f8c5820972efee538e0ecf6f45efd976f2b2bf8dcff577f2369c62d68f
|
7
|
+
data.tar.gz: 0cb00ea631d12ee411150657650da2864303e24c92ce3747471e9328a4018478d490db599f94e3b69e9b9727259e6b4fe5e2ca51e80e881c8e8ec3384b328e00
|
data/README.md
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
# packs-specification
|
2
|
+
This is a low-dependency gem that allows your production environment to query simple information about [`packs`](https://github.com/rubyatscale/packs).
|
2
3
|
|
3
|
-
Welcome to `packs-specification`! `packs` are a simple ruby specification for an extensible packaging system to help modularize Ruby applications.
|
4
4
|
|
5
|
-
|
5
|
+
## Usage
|
6
|
+
```ruby
|
6
7
|
|
7
|
-
|
8
|
-
By default, this library will look for `packs` in the folder `packs/*/package.yml` (as well as nested packs at `packs/*/*/package.yml`). To change where `packs` are located, create a `packs.yml` file:
|
9
|
-
```
|
10
|
-
pack_paths:
|
11
|
-
- "{packs,utilities,deprecated}/*" # packs with multiple roots!
|
12
|
-
- "{packs,utilities,deprecated}/*/*" # nested packs!
|
13
|
-
- gems/* # gems can be packs too!
|
14
|
-
```
|
8
|
+
require 'packs-specification'
|
15
9
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- [`code_ownership`](https://github.com/rubyatscale/code_ownership) gives your application the capability to determine the owner of a pack
|
21
|
-
- [`use_packs`](https://github.com/rubyatscale/use_packs) gives a CLI, `bin/packs`, that makes it easy to create new packs, move files between packs, and more.
|
22
|
-
- [`pack_stats`](https://github.com/rubyatscale/pack_stats) makes it easy to send metrics about pack adoption and modularization to your favorite metrics provider, such as DataDog (which has built-in support).
|
10
|
+
# Getting all packs
|
11
|
+
# Example use: adding pack paths to a list of fixture paths
|
12
|
+
# Returns a T::Array[Packs::Pack]
|
13
|
+
Packs.all
|
23
14
|
|
24
|
-
#
|
25
|
-
|
15
|
+
# Getting the pack for a specific file
|
16
|
+
# Example use: Associating a file with an owner via a pack owner
|
17
|
+
# Returns a T.nilable(Packs::Pack)
|
18
|
+
Packs.for_file('/path/to/file.rb')
|
19
|
+
Packs.for_file(Pathname.new('/path/to/file.rb')) # also works
|
20
|
+
|
21
|
+
# Getting a pack with a specific name
|
22
|
+
# Example use: Special casing certain behavior for a specific pack
|
23
|
+
# Example use: Development tools that operate on user inputted pack names
|
24
|
+
# Returns a T.nilable(Packs::Pack)
|
25
|
+
Packs.find('packs/my_pack')
|
26
|
+
```
|
data/lib/packs/rspec/support.rb
CHANGED
@@ -10,12 +10,18 @@ RSpec.configure do |config|
|
|
10
10
|
|
11
11
|
# Eventually, we could make this opt-in via metadata so someone can use this support without affecting all their tests.
|
12
12
|
config.around do |example|
|
13
|
-
|
14
|
-
tmpdir = Dir.mktmpdir(prefix)
|
15
|
-
Dir.chdir(tmpdir) do
|
13
|
+
if example.metadata[:skip_chdir_to_tmpdir]
|
16
14
|
example.run
|
15
|
+
else
|
16
|
+
begin
|
17
|
+
prefix = [File.basename($0), Process.pid].join('-') # rubocop:disable Style/SpecialGlobalVars
|
18
|
+
tmpdir = Dir.mktmpdir(prefix)
|
19
|
+
Dir.chdir(tmpdir) do
|
20
|
+
example.run
|
21
|
+
end
|
22
|
+
ensure
|
23
|
+
FileUtils.rm_rf(tmpdir)
|
24
|
+
end
|
17
25
|
end
|
18
|
-
ensure
|
19
|
-
FileUtils.rm_rf(tmpdir)
|
20
26
|
end
|
21
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packs-specification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gusto Engineers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|