cli-kit 5.1.0 → 5.2.0

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: 2d726194921593173c9e5ddc6825b4bb450b3b5b349be39801b0178668c3e94a
4
- data.tar.gz: 3ab180c9b128bc0c6bdee63b68275273a12a938df484eb94e743f11ff81d28a2
3
+ metadata.gz: c397a745de33f27b897f8fd2048874be2f711a56db37ca17f87c5ad169e4f062
4
+ data.tar.gz: 80332fe8bd9a5dd5fb459f55d2f655a539cc95b13c4a2df174abafaaa4b7c924
5
5
  SHA512:
6
- metadata.gz: 7677c4a9ccf218206b5b31f261507f66e12e7d8148be5857025979e282c8e524546015df0c6a612c818de297d6c93157fc15394592d0914eada8b5acd17469aa
7
- data.tar.gz: 1a7882f6f3bb2a81dfa50c655c02fef3286badba79e4f5f6e384fc87a5d0953beba48b92eb83981c8124db91980c14d11c41a16d012b99eb3ef8151cc895fd86
6
+ metadata.gz: c689fdcf5ae697be38b21ce60e973874c0d6a7f5c0eeaa085b8b93e635a14cbcd3d6af229d0dcb2c7f00084ca58845c3055c687cd6e7fbd4bc8a1902a5582bd2
7
+ data.tar.gz: 153bf5c66de83e3d332944dfdc6fa9b1d52d4d5413ff80e4cac4b5aafbf0eddc888e22b2e50cf7914b43d1a90f56c23e2f41aaa7ec3987e7c51276092ad6f132
data/.rubocop.sorbet.yml CHANGED
@@ -26,6 +26,7 @@ Sorbet/EnforceSigilOrder:
26
26
 
27
27
  Sorbet/EnforceSignatures:
28
28
  Enabled: true
29
+ Style: rbs
29
30
  Exclude:
30
31
  - lib/cli/kit/sorbet_runtime_stub.rb
31
32
  - "test/**/*"
data/.rubocop.yml CHANGED
@@ -4,8 +4,7 @@ inherit_gem:
4
4
  inherit_from:
5
5
  - .rubocop.sorbet.yml
6
6
 
7
- require:
8
- - rubocop-sorbet
7
+ plugins: rubocop-sorbet
9
8
 
10
9
  AllCops:
11
10
  Exclude:
data/Gemfile CHANGED
@@ -15,7 +15,7 @@ group :development, :test do
15
15
  end
16
16
 
17
17
  group :typecheck do
18
- gem 'sorbet-static-and-runtime'
18
+ gem 'sorbet-static'
19
19
  gem 'tapioca', require: false
20
20
  end
21
21
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cli-kit (5.1.0)
4
+ cli-kit (5.2.0)
5
5
  cli-ui (~> 2.4)
6
6
 
7
7
  GEM
@@ -15,7 +15,7 @@ GEM
15
15
  cli-ui (2.4.0)
16
16
  docile (1.4.1)
17
17
  erubi (1.13.1)
18
- json (2.13.2)
18
+ json (2.15.1)
19
19
  language_server-protocol (3.17.0.5)
20
20
  lint_roller (1.1.0)
21
21
  logger (1.7.0)
@@ -33,18 +33,18 @@ GEM
33
33
  parser (3.3.9.0)
34
34
  ast (~> 2.4.1)
35
35
  racc
36
- prism (1.4.0)
36
+ prism (1.5.1)
37
37
  racc (1.8.1)
38
38
  rainbow (3.1.1)
39
39
  rake (13.3.0)
40
40
  rbi (0.3.6)
41
41
  prism (~> 1.0)
42
42
  rbs (>= 3.4.4)
43
- rbs (3.9.4)
43
+ rbs (3.9.5)
44
44
  logger
45
- regexp_parser (2.10.0)
46
- rexml (3.4.1)
47
- rubocop (1.79.0)
45
+ regexp_parser (2.11.3)
46
+ rexml (3.4.4)
47
+ rubocop (1.81.1)
48
48
  json (~> 2.3)
49
49
  language_server-protocol (~> 3.17.0.2)
50
50
  lint_roller (~> 1.1.0)
@@ -52,11 +52,10 @@ GEM
52
52
  parser (>= 3.3.0.2)
53
53
  rainbow (>= 2.2.2, < 4.0)
54
54
  regexp_parser (>= 2.9.3, < 3.0)
55
- rubocop-ast (>= 1.46.0, < 2.0)
55
+ rubocop-ast (>= 1.47.1, < 2.0)
56
56
  ruby-progressbar (~> 1.7)
57
- tsort (>= 0.2.0)
58
57
  unicode-display_width (>= 2.4.0, < 4.0)
59
- rubocop-ast (1.46.0)
58
+ rubocop-ast (1.47.1)
60
59
  parser (>= 3.3.7.2)
61
60
  prism (~> 1.4)
62
61
  rubocop-rake (0.7.1)
@@ -75,15 +74,15 @@ GEM
75
74
  simplecov_json_formatter (~> 0.1)
76
75
  simplecov-html (0.13.2)
77
76
  simplecov_json_formatter (0.1.4)
78
- sorbet (0.5.12358)
79
- sorbet-static (= 0.5.12358)
80
- sorbet-runtime (0.5.12358)
81
- sorbet-static (0.5.12358-aarch64-linux)
82
- sorbet-static (0.5.12358-universal-darwin)
83
- sorbet-static (0.5.12358-x86_64-linux)
84
- sorbet-static-and-runtime (0.5.12358)
85
- sorbet (= 0.5.12358)
86
- sorbet-runtime (= 0.5.12358)
77
+ sorbet (0.6.12627)
78
+ sorbet-static (= 0.6.12627)
79
+ sorbet-runtime (0.6.12627)
80
+ sorbet-static (0.6.12627-aarch64-linux)
81
+ sorbet-static (0.6.12627-universal-darwin)
82
+ sorbet-static (0.6.12627-x86_64-linux)
83
+ sorbet-static-and-runtime (0.6.12627)
84
+ sorbet (= 0.6.12627)
85
+ sorbet-runtime (= 0.6.12627)
87
86
  spoom (1.6.3)
88
87
  erubi (>= 1.10.0)
89
88
  prism (>= 0.28.0)
@@ -102,10 +101,9 @@ GEM
102
101
  thor (>= 1.2.0)
103
102
  yard-sorbet
104
103
  thor (1.4.0)
105
- tsort (0.2.0)
106
- unicode-display_width (3.1.4)
107
- unicode-emoji (~> 4.0, >= 4.0.4)
108
- unicode-emoji (4.0.4)
104
+ unicode-display_width (3.2.0)
105
+ unicode-emoji (~> 4.1)
106
+ unicode-emoji (4.1.0)
109
107
  yard (0.9.37)
110
108
  yard-sorbet (0.9.0)
111
109
  sorbet-runtime
@@ -131,7 +129,7 @@ DEPENDENCIES
131
129
  rubocop-shopify
132
130
  rubocop-sorbet
133
131
  simplecov
134
- sorbet-static-and-runtime
132
+ sorbet-static
135
133
  tapioca
136
134
 
137
135
  BUNDLED WITH
data/Rakefile CHANGED
@@ -2,7 +2,6 @@ $LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
2
2
  require 'rake/testtask'
3
3
  require 'rubocop/rake_task'
4
4
  require 'bundler/gem_tasks'
5
- require 'sorbet-runtime' unless ENV['BUNDLE_WITHOUT'] == 'typecheck'
6
5
 
7
6
  TEST_ROOT = File.expand_path('../test', __FILE__)
8
7
 
data/bin/testunit CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'bundler/setup'
5
- require 'sorbet-runtime' unless ENV['BUNDLE_WITHOUT'] == 'typecheck'
6
5
 
7
6
  root = File.expand_path('../..', __FILE__)
8
7
  CLI_TEST_ROOT = root + '/test'
@@ -11,7 +11,7 @@ include(CLI::Kit)
11
11
  registry = CommandRegistry.new(default: 'hello')
12
12
  registry.add(
13
13
  Class.new(BaseCommand) do
14
- sig { params(_args: T::Array[String], _name: String).void }
14
+ #: (Array[String], String) -> void
15
15
  def call(_args, _name)
16
16
  puts 'hello, world!'
17
17
  end
@@ -15,7 +15,7 @@ module Example
15
15
  Registry = CLI::Kit::CommandRegistry.new(default: 'hello')
16
16
 
17
17
  class << self
18
- sig { params(const: Symbol, cmd: String, path: String, lamda_const: T.proc.returns(Example::Command)).void }
18
+ #: (Symbol const, String cmd, String path, ^-> Example::Command lamda_const) -> void
19
19
  def register(const, cmd, path, lamda_const)
20
20
  autoload(const, path)
21
21
  Registry.add(lamda_const, cmd)
@@ -25,7 +25,8 @@ module Example
25
25
  end
26
26
 
27
27
  class Hello < Example::Command
28
- sig { override.params(_args: T::Array[String], _name: String).void }
28
+ # @override
29
+ #: (Array[String] _args, String _name) -> void
29
30
  def call(_args, _name)
30
31
  puts 'hello, world!'
31
32
  end
@@ -34,7 +35,7 @@ module Example
34
35
 
35
36
  module EntryPoint
36
37
  class << self
37
- sig { params(args: T::Array[String]).void }
38
+ #: (Array[String] args) -> void
38
39
  def call(args)
39
40
  cmd, command_name, args = Example::Resolver.call(args)
40
41
  Example::Executor.call(cmd, command_name, args)
@@ -5,11 +5,9 @@ require 'gen'
5
5
  module Gen
6
6
  module Commands
7
7
  class Help < Gen::Command
8
- extend T::Sig
9
-
10
8
  desc('Show help for a command, or this page')
11
9
 
12
- sig { params(args: T::Array[String], _name: String).void }
10
+ #: (Array[String] args, String _name) -> void
13
11
  def call(args, _name)
14
12
  Gen::Help.generate(args)
15
13
  end
@@ -5,8 +5,6 @@ require 'gen'
5
5
  module Gen
6
6
  module Commands
7
7
  class New < Gen::Command
8
- extend T::Sig
9
-
10
8
  command_name('new')
11
9
  desc('Create a new project')
12
10
  long_desc(<<~LONGDESC)
@@ -18,15 +16,13 @@ module Gen
18
16
  example('mycliapp', "create a new project called 'mycliapp'")
19
17
 
20
18
  class Opts < CLI::Kit::Opts
21
- extend(T::Sig)
22
-
23
- sig { returns(String) }
19
+ #: -> String
24
20
  def project_name
25
21
  position!
26
22
  end
27
23
  end
28
24
 
29
- sig { params(op: Opts, _name: T.untyped).returns(T.untyped) }
25
+ #: (Opts op, untyped _name) -> untyped
30
26
  def invoke(op, _name)
31
27
  Gen::Generator.run(op.project_name)
32
28
  end
@@ -4,16 +4,10 @@ require 'gen'
4
4
 
5
5
  module Gen
6
6
  module Commands
7
- extend T::Sig
8
-
9
7
  Registry = CLI::Kit::CommandRegistry.new(default: 'help')
10
8
 
11
9
  class << self
12
- extend T::Sig
13
-
14
- sig do
15
- params(const: Symbol, cmd: String, path: String, lamda_const: T.proc.returns(T.class_of(Gen::Command))).void
16
- end
10
+ #: (Symbol const, String cmd, String path, ^-> singleton(Gen::Command) lamda_const) -> void
17
11
  def register(const, cmd, path, lamda_const)
18
12
  autoload(const, path)
19
13
  Registry.add(lamda_const, cmd)
@@ -4,12 +4,8 @@ require 'gen'
4
4
 
5
5
  module Gen
6
6
  module EntryPoint
7
- extend T::Sig
8
-
9
7
  class << self
10
- extend T::Sig
11
-
12
- sig { params(args: T::Array[String]).void }
8
+ #: (Array[String] args) -> void
13
9
  def call(args)
14
10
  cmd, command_name, args = Gen::Resolver.call(args)
15
11
  Gen::Executor.call(cmd, command_name, args)
@@ -8,12 +8,8 @@ require 'tmpdir'
8
8
 
9
9
  module Gen
10
10
  class Generator
11
- extend T::Sig
12
-
13
11
  class << self
14
- extend T::Sig
15
-
16
- sig { params(project_name: String).void }
12
+ #: (String project_name) -> void
17
13
  def run(project_name)
18
14
  new(project_name).run
19
15
  end
@@ -44,7 +40,7 @@ module Gen
44
40
  }.freeze
45
41
  private_constant :BUNDLER_TRANSLATIONS
46
42
 
47
- sig { params(project_name: String).void }
43
+ #: (String project_name) -> void
48
44
  def initialize(project_name)
49
45
  raise(
50
46
  CLI::Kit::Abort,
@@ -54,7 +50,7 @@ module Gen
54
50
  @title_case_project_name = @project_name.sub(/^./, &:upcase)
55
51
  end
56
52
 
57
- sig { void }
53
+ #: -> void
58
54
  def run
59
55
  vendor = ask_vendor?
60
56
  create_project_dir
@@ -68,12 +64,12 @@ module Gen
68
64
 
69
65
  private
70
66
 
71
- sig { returns(T::Boolean) }
67
+ #: -> bool
72
68
  def ask_vendor?
73
69
  return true if ENV['DEPS'] == 'vendor'
74
70
  return false if ENV['DEPS'] == 'bundler'
75
71
 
76
- vendor = T.let(nil, T.nilable(String))
72
+ vendor = nil #: String?
77
73
  CLI::UI::Frame.open('Configuration') do
78
74
  q = 'How would you like the application to consume {{command:cli-kit}} and {{command:cli-ui}}?'
79
75
  vendor = CLI::UI::Prompt.ask(q) do |c|
@@ -84,7 +80,7 @@ module Gen
84
80
  vendor == 'vendor'
85
81
  end
86
82
 
87
- sig { void }
83
+ #: -> void
88
84
  def create_project_dir
89
85
  info(create: '')
90
86
  FileUtils.mkdir(@project_name)
@@ -92,7 +88,7 @@ module Gen
92
88
  error("directory already exists: #{@project_name}")
93
89
  end
94
90
 
95
- sig { params(translations: T::Hash[String, T.any(FalseClass, String)]).void }
91
+ #: (translations: Hash[String, (FalseClass | String)]) -> void
96
92
  def copy_files(translations:)
97
93
  each_template_file do |source_name|
98
94
  target_name = translations.fetch(source_name, source_name)
@@ -115,7 +111,7 @@ module Gen
115
111
  end
116
112
  end
117
113
 
118
- sig { void }
114
+ #: -> void
119
115
  def update_deps
120
116
  Dir.mktmpdir do |tmp|
121
117
  clone(tmp, 'cli-ui')
@@ -127,7 +123,7 @@ module Gen
127
123
  end
128
124
  end
129
125
 
130
- sig { params(dir: String, repo: String).void }
126
+ #: (String dir, String repo) -> void
131
127
  def clone(dir, repo)
132
128
  info(clone: repo)
133
129
  out, stat = Open3.capture2e('git', '-C', dir, 'clone', "https://github.com/shopify/#{repo}")
@@ -137,7 +133,7 @@ module Gen
137
133
  end
138
134
  end
139
135
 
140
- sig { params(block: T.proc.params(rel_path: String).void).void }
136
+ #: { (String rel_path) -> void } -> void
141
137
  def each_template_file(&block)
142
138
  root = Pathname.new(TEMPLATE_ROOT)
143
139
  Dir.glob("#{TEMPLATE_ROOT}/**/*").each do |f|
@@ -146,7 +142,7 @@ module Gen
146
142
  end
147
143
  end
148
144
 
149
- sig { params(s: String).returns(String) }
145
+ #: (String s) -> String
150
146
  def apply_template_variables(s)
151
147
  s
152
148
  .gsub('__app__', @project_name)
@@ -155,19 +151,19 @@ module Gen
155
151
  .gsub('__cli-ui-version__', cli_ui_version)
156
152
  end
157
153
 
158
- sig { returns(String) }
154
+ #: -> String
159
155
  def cli_kit_version
160
156
  require 'cli/kit/version'
161
157
  CLI::Kit::VERSION.to_s
162
158
  end
163
159
 
164
- sig { returns(String) }
160
+ #: -> String
165
161
  def cli_ui_version
166
162
  require 'cli/ui/version'
167
163
  CLI::UI::VERSION.to_s
168
164
  end
169
165
 
170
- sig { params(create: T.nilable(String), clone: T.nilable(String), run: T.nilable(String)).void }
166
+ #: (?create: String?, ?clone: String?, ?run: String?) -> void
171
167
  def info(create: nil, clone: nil, run: nil)
172
168
  if clone
173
169
  puts(CLI::UI.fmt("\t{{bold:{{yellow:clone}}\t#{clone}}}"))
@@ -178,7 +174,7 @@ module Gen
178
174
  end
179
175
  end
180
176
 
181
- sig { params(msg: String).void }
177
+ #: (String msg) -> void
182
178
  def error(msg)
183
179
  raise(CLI::Kit::Abort, msg)
184
180
  end
data/gen/lib/gen/help.rb CHANGED
@@ -4,12 +4,8 @@ require 'gen'
4
4
 
5
5
  module Gen
6
6
  module Help
7
- extend T::Sig
8
-
9
7
  class << self
10
- extend T::Sig
11
-
12
- sig { params(path: T::Array[String], to: IO).void }
8
+ #: (Array[String] path, ?to: IO) -> void
13
9
  def generate(path, to: STDOUT)
14
10
  case path.size
15
11
  when 0
@@ -21,7 +17,7 @@ module Gen
21
17
  end
22
18
  end
23
19
 
24
- sig { params(to: IO).void }
20
+ #: (?to: IO) -> void
25
21
  def generate_toplevel(to: STDOUT)
26
22
  to.write(CLI::UI.fmt(<<~HELP))
27
23
  {{bold:{{command:cli-kit}} generates new cli-kit apps.}}
@@ -44,7 +40,7 @@ module Gen
44
40
  end
45
41
  end
46
42
 
47
- sig { params(cmd_name: String, to: IO).void }
43
+ #: (String cmd_name, ?to: IO) -> void
48
44
  def generate_command_help(cmd_name, to: STDOUT)
49
45
  klass = Gen::Commands::Registry.resolved_commands[cmd_name]
50
46
  unless klass