packs 0.0.4 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7080a6fa5987fd5e6526b429e393cf5a8c0880f949dc5ebcd7a151479f1b3683
4
- data.tar.gz: bd4c0fe1047832ba6ecd4277368f7b3effd5f1f97143155ff0f2b3f0d472816d
3
+ metadata.gz: 6e86a9d19597b2dfda0fbec5013807777eff3e36d4fee72dfd445134a87f84d5
4
+ data.tar.gz: 1720911eabcb3bba3ea855ad953778c7f25085b581a1a4f5f3bbedfcc6458c92
5
5
  SHA512:
6
- metadata.gz: 6ee749052a37b250094beba396462274948e7a8964267eccbd76a256390a50af7ee3be33b1e1bf391ace03b2007175b51a35a4d99e6f3c407c354ff889ac2803
7
- data.tar.gz: adeb079802b6711e84f6b9860d3d128aee2d805c801f09c26eeed9d8836e8216302c0d03abb7a2f201ee96556c0c717af294e270ea72cc4d67b68bb742286d2b
6
+ metadata.gz: d96c70a719cb28a36dd7f3cc2e4a8c1b4fa0e827ef77a28a8aeab90e877a55208d12483c7e9465c605ffe997243ed1cbdaf0f1ebd593baf2f0da4ad489417272
7
+ data.tar.gz: d047fa7748598d907a70fa314aefd6943130999992266c2b28699cd522f45ee661be3b7afd7674edb11cf35cad83b8ae3e3654d905673bb37b73ba8a0b68f0a2
data/lib/packs/pack.rb CHANGED
@@ -35,6 +35,11 @@ module Packs
35
35
  relative_path.basename.to_s
36
36
  end
37
37
 
38
+ sig { returns(T::Boolean) }
39
+ def is_gem?
40
+ @is_gem ||= T.let(relative_path.glob('*.gemspec').any?, T.nilable(T::Boolean))
41
+ end
42
+
38
43
  sig { returns(T::Hash[T.untyped, T.untyped]) }
39
44
  def metadata
40
45
  raw_hash['metadata'] || {}
@@ -0,0 +1,33 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module FixtureHelper
5
+ extend T::Sig
6
+
7
+ sig { params(path: String, content: String).returns(String) }
8
+ def write_file(path, content = '')
9
+ pathname = Pathname.pwd.join(path)
10
+ FileUtils.mkdir_p(pathname.dirname)
11
+ pathname.write(content)
12
+ path
13
+ end
14
+
15
+ sig do
16
+ params(
17
+ pack_name: String,
18
+ config: T::Hash[T.untyped, T.untyped]
19
+ ).void
20
+ end
21
+ def write_pack(
22
+ pack_name,
23
+ config = {}
24
+ )
25
+ path = Pathname.pwd.join(pack_name).join('package.yml')
26
+ write_file(path.to_s, YAML.dump(config))
27
+ end
28
+
29
+ sig { params(path: String).void }
30
+ def delete_app_file(path)
31
+ File.delete(path)
32
+ end
33
+ end
@@ -0,0 +1,21 @@
1
+ require_relative 'fixture_helper'
2
+
3
+ RSpec.configure do |config|
4
+ config.include FixtureHelper
5
+
6
+ config.before do
7
+ # We bust_cache always because each test may write its own packs
8
+ Packs.bust_cache!
9
+ end
10
+
11
+ # Eventually, we could make this opt-in via metadata so someone can use this support without affecting all their tests.
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
16
+ example.run
17
+ end
18
+ ensure
19
+ FileUtils.rm_rf(tmpdir)
20
+ end
21
+ end
data/lib/packs.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # typed: strict
2
2
 
3
3
  require 'yaml'
4
+ require 'pathname'
4
5
  require 'sorbet-runtime'
5
6
  require 'packs/pack'
6
7
  require 'packs/private'
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
4
+ version: 0.0.6
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-29 00:00:00.000000000 Z
11
+ date: 2023-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -121,6 +121,8 @@ files:
121
121
  - lib/packs/pack.rb
122
122
  - lib/packs/private.rb
123
123
  - lib/packs/private/configuration.rb
124
+ - lib/packs/rspec/fixture_helper.rb
125
+ - lib/packs/rspec/support.rb
124
126
  homepage: https://github.com/rubyatscale/packs
125
127
  licenses:
126
128
  - MIT