packs 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packs/pack.rb +5 -0
- data/lib/packs/rspec/fixture_helper.rb +33 -0
- data/lib/packs/rspec/support.rb +21 -0
- data/lib/packs.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e86a9d19597b2dfda0fbec5013807777eff3e36d4fee72dfd445134a87f84d5
|
4
|
+
data.tar.gz: 1720911eabcb3bba3ea855ad953778c7f25085b581a1a4f5f3bbedfcc6458c92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.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:
|
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
|