use_packs 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88d0834366bd3d1591029828eab623a5781f0ed44a3b8c0b35ab92f131236377
4
- data.tar.gz: 8f3dd5181a41f8bd3ff2441fc58c73bac8ec712137a5967b7447d62b9014d653
3
+ metadata.gz: '006912f2bf892c63364fba8ae22cb6202df72e8fe9bd2a081c8cf5d3610d0fb2'
4
+ data.tar.gz: 3b4510070e1f6160d8814fe5fea8947481330f8ca05c4bb995bf075930a21454
5
5
  SHA512:
6
- metadata.gz: 3cb7be9b2014cc3c065d700e19472821acda6b9a41fe73cdf695e52d2d96ee1552aabaf2e123c8f4d4b21c1b469cb26073e8eaa650874d6ded5fbdb63c3a401e
7
- data.tar.gz: 6a6a15f8f010a10988eae52796bbbf55326c7a814bc1d0ec3a550edd860cc038fb7eb917860e7629cae1d6b2462901296b5bb163857b3cf955a7c93b6d9ffe21
6
+ metadata.gz: d685dbd8cc145544a1c5c1116f3ba39f23d9feda347701657eea97a7e44b44a57f778ad452d719d2442edf33c79a8211451a14367624c9a39f6be77d5af23e49
7
+ data.tar.gz: 25d3c0d781b77ba831ede9f7a01124fd2bdede9737e4d9b0645d2a5080c132d397dd5fcbdc60d2121a22cc556e4cb0256f38d3460e43b07ac2a12c1f09ad7ec9
data/README.md CHANGED
@@ -43,12 +43,6 @@ If no pack name is passed in, this will list out violations across all packs.
43
43
 
44
44
  This can be used to quickly modify a `package.yml` file and add a dependency. It also cleans up the list of dependencies to sort the list and remove redundant entries.
45
45
 
46
- ### Setting up Spring
47
-
48
- [Spring](https://github.com/rails/spring) is a preloader for Rails. Although `use_packs` itself does not use `Rails`, this can help speed up running commands like `bin/packs` by caching the bundle.
49
- Firstly, spring needs to know about the `bin/packs` command when spring is loading. To do that, add `require 'use_packs/spring_command'` to `config/spring.rb` in your application.
50
- Secondly, to enable Spring, first run `bin/spring binstub packs` which will "springify" the generated binstub.
51
-
52
46
  ### Releasing
53
47
  Releases happen automatically through github actions once a version update is committed to `main`.
54
48
 
@@ -7,26 +7,47 @@ module UsePacks
7
7
  extend T::Sig
8
8
 
9
9
  sig { params(prompt: TTY::Prompt, question_text: String).returns(ParsePackwerk::Package) }
10
- def self.single_pack_select(prompt, question_text: 'Please select a pack')
10
+ def self.single_pack_select(prompt, question_text: 'Please use space to select a pack')
11
11
  packs = ParsePackwerk.all.to_h { |t| [t.name, t] }
12
- prompt.select(
12
+
13
+ pack_selection = T.let(prompt.select(
13
14
  question_text,
14
15
  packs,
15
16
  filter: true,
16
17
  per_page: 10,
17
18
  show_help: :always
18
- )
19
+ ), T.nilable(ParsePackwerk::Package))
20
+
21
+ while pack_selection.nil?
22
+ prompt.error(
23
+ 'No packs were selected, please select a pack using the space key before pressing enter.'
24
+ )
25
+
26
+ pack_selection = single_pack_select(prompt, question_text: question_text)
27
+ end
28
+
29
+ pack_selection
19
30
  end
20
31
 
21
32
  sig { params(prompt: TTY::Prompt, question_text: String).returns(T::Array[ParsePackwerk::Package]) }
22
- def self.single_or_all_pack_multi_select(prompt, question_text: 'Please select one or more packs')
23
- prompt.multi_select(
33
+ def self.single_or_all_pack_multi_select(prompt, question_text: 'Please use space to select one or more packs')
34
+ pack_selection = T.let(prompt.multi_select(
24
35
  question_text,
25
36
  ParsePackwerk.all.to_h { |t| [t.name, t] },
26
37
  filter: true,
27
38
  per_page: 10,
28
39
  show_help: :always
29
- )
40
+ ), T::Array[ParsePackwerk::Package])
41
+
42
+ while pack_selection.empty?
43
+ prompt.error(
44
+ 'No packs were selected, please select one or more packs using the space key before pressing enter.'
45
+ )
46
+
47
+ pack_selection = single_or_all_pack_multi_select(prompt, question_text: question_text)
48
+ end
49
+
50
+ pack_selection
30
51
  end
31
52
  end
32
53
  end
@@ -7,27 +7,49 @@ module UsePacks
7
7
  extend T::Sig
8
8
 
9
9
  sig { params(prompt: TTY::Prompt, question_text: String).returns(CodeTeams::Team) }
10
- def self.single_select(prompt, question_text: 'Please select a team owner')
10
+ def self.single_select(prompt, question_text: 'Please use space to select a team owner')
11
11
  teams = CodeTeams.all.sort_by(&:name).to_h { |t| [t.name, t] }
12
- prompt.select(
12
+
13
+ team_selection = T.let(prompt.select(
13
14
  question_text,
14
15
  teams,
15
16
  filter: true,
16
17
  per_page: 10,
17
18
  show_help: :always
18
- )
19
+ ), T.nilable(CodeTeams::Team))
20
+
21
+ while team_selection.nil?
22
+ prompt.error(
23
+ 'No owners were selected, please select an owner using the space key before pressing enter.'
24
+ )
25
+
26
+ team_selection = single_select(prompt, question_text: question_text)
27
+ end
28
+
29
+ team_selection
19
30
  end
20
31
 
21
32
  sig { params(prompt: TTY::Prompt, question_text: String).returns(T::Array[CodeTeams::Team]) }
22
- def self.multi_select(prompt, question_text: 'Please select team owners')
33
+ def self.multi_select(prompt, question_text: 'Please use space to select team owners')
23
34
  teams = CodeTeams.all.to_h { |t| [t.name, t] }
24
- prompt.multi_select(
35
+
36
+ team_selection = T.let(prompt.multi_select(
25
37
  question_text,
26
38
  teams,
27
39
  filter: true,
28
40
  per_page: 10,
29
41
  show_help: :always
30
- )
42
+ ), T::Array[CodeTeams::Team])
43
+
44
+ while team_selection.empty?
45
+ prompt.error(
46
+ 'No owners were selected, please select one or more owners using the space key before pressing enter.'
47
+ )
48
+
49
+ team_selection = multi_select(prompt, question_text: question_text)
50
+ end
51
+
52
+ team_selection
31
53
  end
32
54
  end
33
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_packs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
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-09 00:00:00.000000000 Z
11
+ date: 2022-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_ownership
@@ -319,7 +319,6 @@ files:
319
319
  - lib/use_packs/private/packwerk_wrapper.rb
320
320
  - lib/use_packs/private/packwerk_wrapper/offenses_aggregator_formatter.rb
321
321
  - lib/use_packs/rubocop_post_processor.rb
322
- - lib/use_packs/spring_command.rb
323
322
  - lib/use_packs/user_event_logger.rb
324
323
  homepage: https://github.com/rubyatscale/use_packs
325
324
  licenses:
@@ -1,28 +0,0 @@
1
- # typed: true
2
- # frozen_string_literal: true
3
-
4
- require 'spring/commands'
5
-
6
- module UsePacks
7
- class SpringCommand
8
- def env(*)
9
- # Packwerk needs to run in a test environment, which has a set of autoload paths that are
10
- # often a superset of the dev/prod paths (for example, test/support/helpers)
11
- 'test'
12
- end
13
-
14
- def exec_name
15
- 'packs'
16
- end
17
-
18
- def gem_name
19
- 'use_packs'
20
- end
21
-
22
- def call
23
- load(Gem.bin_path(gem_name, exec_name))
24
- end
25
- end
26
-
27
- Spring.register_command('packs', SpringCommand.new)
28
- end