packs-specification 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -19
  3. data/lib/packs/rspec/support.rb +11 -5
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c88728f832e53f87f6c8ff27cfec4418ed91f7887a0c79ff48ff99621b1e9a3
4
- data.tar.gz: c765f94b52e2a7d96ab74a12791d6aa9bb95122fb902ec6bd96fc6c083e9c5fb
3
+ metadata.gz: a95a4c598305baa6990d07093e98b49f55c3289c80d384e7beb558bcafde63ca
4
+ data.tar.gz: b6f2537d04165bee29925da1d29d9613da1b0219227ab397973efc65a1e64259
5
5
  SHA512:
6
- metadata.gz: 1dcae4f9561fb74c5e272beaa7030766d52398e3b709cb890858245990ded777b56e7c6dfc028706c3796aeb88c7f2d39e4b622fd2e9f2e6894fa7454296242a
7
- data.tar.gz: b1a6ad713dd92015b1c6f32d0f8a9cd5e89d1a707817a8f739a8aba0f0ec7bffd28bbd9d01c9c168c6e93a59c05455f724362b1b3ae3e9be179d2dcac123cba6
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
- A `pack` (short for `package`) is a folder of Ruby code with a `package.yml` at the root that is intended to represent a well-modularized domain, and the rest of the [rubyatscale](https://github.com/rubyatscale) ecosystem is intended to help make the boundaries between a pack and any other more clear.
5
+ ## Usage
6
+ ```ruby
6
7
 
7
- # Configuration
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
- Here are some example integrations with `packs`:
17
- - [`packs-rails`](https://github.com/rubyatscale/packs-rails) can be used to integrate `packs` into your `rails` application
18
- - [`rubocop-packs`](https://github.com/rubyatscale/rubocop-packs) contains cops to improve boundaries around `packs`
19
- - [`packwerk`](https://github.com/Shopify/packwerk) and [`packwerk-extensions`](https://github.com/rubyatscale/packwerk-extensions) help you describe and constrain your package graph in terms of dependencies between packs and pack public API
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
- # How is a pack different from a gem?
25
- A ruby [`gem`](https://guides.rubygems.org/what-is-a-gem/) is the Ruby community solution for packaging and distributing Ruby code. A gem is a great place to start new projects, and a great end state for code that's been extracted from an existing codebase. `packs` are intended to help gradually modularize an application that has some conceptual boundaries, but is not yet ready to be factored into gems.
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
+ ```
@@ -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
- prefix = [File.basename($0), Process.pid].join('-') # rubocop:disable Style/SpecialGlobalVars
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.9
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-10 00:00:00.000000000 Z
11
+ date: 2023-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime