gorails 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -1
  3. data/Gemfile.lock +1 -1
  4. data/bin/update-deps +95 -0
  5. data/exe/gorails +3 -2
  6. data/lib/gorails/commands/railsbytes.rb +10 -10
  7. data/lib/gorails/commands.rb +1 -4
  8. data/lib/gorails/version.rb +1 -1
  9. data/lib/gorails.rb +11 -20
  10. data/vendor/deps/cli-kit/REVISION +1 -0
  11. data/vendor/deps/cli-kit/lib/cli/kit/args/definition.rb +301 -0
  12. data/vendor/deps/cli-kit/lib/cli/kit/args/evaluation.rb +237 -0
  13. data/vendor/deps/cli-kit/lib/cli/kit/args/parser/node.rb +131 -0
  14. data/vendor/deps/cli-kit/lib/cli/kit/args/parser.rb +128 -0
  15. data/vendor/deps/cli-kit/lib/cli/kit/args/tokenizer.rb +132 -0
  16. data/vendor/deps/cli-kit/lib/cli/kit/args.rb +15 -0
  17. data/vendor/deps/cli-kit/lib/cli/kit/base_command.rb +29 -0
  18. data/vendor/deps/cli-kit/lib/cli/kit/command_help.rb +256 -0
  19. data/vendor/deps/cli-kit/lib/cli/kit/command_registry.rb +141 -0
  20. data/vendor/deps/cli-kit/lib/cli/kit/config.rb +137 -0
  21. data/vendor/deps/cli-kit/lib/cli/kit/core_ext.rb +30 -0
  22. data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +165 -0
  23. data/vendor/deps/cli-kit/lib/cli/kit/executor.rb +99 -0
  24. data/vendor/deps/cli-kit/lib/cli/kit/ini.rb +94 -0
  25. data/vendor/deps/cli-kit/lib/cli/kit/levenshtein.rb +89 -0
  26. data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +95 -0
  27. data/vendor/deps/cli-kit/lib/cli/kit/opts.rb +284 -0
  28. data/vendor/deps/cli-kit/lib/cli/kit/resolver.rb +67 -0
  29. data/vendor/deps/cli-kit/lib/cli/kit/sorbet_runtime_stub.rb +142 -0
  30. data/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +253 -0
  31. data/vendor/deps/cli-kit/lib/cli/kit/support.rb +10 -0
  32. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +350 -0
  33. data/vendor/deps/cli-kit/lib/cli/kit/util.rb +133 -0
  34. data/vendor/deps/cli-kit/lib/cli/kit/version.rb +7 -0
  35. data/vendor/deps/cli-kit/lib/cli/kit.rb +151 -0
  36. data/vendor/deps/cli-ui/REVISION +1 -0
  37. data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +180 -0
  38. data/vendor/deps/cli-ui/lib/cli/ui/color.rb +98 -0
  39. data/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +216 -0
  40. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +116 -0
  41. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +176 -0
  42. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +149 -0
  43. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +112 -0
  44. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +300 -0
  45. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +92 -0
  46. data/vendor/deps/cli-ui/lib/cli/ui/os.rb +58 -0
  47. data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +72 -0
  48. data/vendor/deps/cli-ui/lib/cli/ui/progress.rb +102 -0
  49. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +534 -0
  50. data/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +36 -0
  51. data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +354 -0
  52. data/vendor/deps/cli-ui/lib/cli/ui/sorbet_runtime_stub.rb +143 -0
  53. data/vendor/deps/cli-ui/lib/cli/ui/spinner/async.rb +46 -0
  54. data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +292 -0
  55. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +82 -0
  56. data/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +264 -0
  57. data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +53 -0
  58. data/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +107 -0
  59. data/vendor/deps/cli-ui/lib/cli/ui/version.rb +6 -0
  60. data/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +37 -0
  61. data/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +75 -0
  62. data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +91 -0
  63. data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +63 -0
  64. data/vendor/deps/cli-ui/lib/cli/ui.rb +356 -0
  65. metadata +57 -1
@@ -0,0 +1,356 @@
1
+ # typed: true
2
+
3
+ unless defined?(T)
4
+ require('cli/ui/sorbet_runtime_stub')
5
+ end
6
+
7
+ module CLI
8
+ module UI
9
+ extend T::Sig
10
+
11
+ autoload :ANSI, 'cli/ui/ansi'
12
+ autoload :Glyph, 'cli/ui/glyph'
13
+ autoload :Color, 'cli/ui/color'
14
+ autoload :Frame, 'cli/ui/frame'
15
+ autoload :OS, 'cli/ui/os'
16
+ autoload :Printer, 'cli/ui/printer'
17
+ autoload :Progress, 'cli/ui/progress'
18
+ autoload :Prompt, 'cli/ui/prompt'
19
+ autoload :Terminal, 'cli/ui/terminal'
20
+ autoload :Truncater, 'cli/ui/truncater'
21
+ autoload :Formatter, 'cli/ui/formatter'
22
+ autoload :Spinner, 'cli/ui/spinner'
23
+ autoload :Widgets, 'cli/ui/widgets'
24
+ autoload :Wrap, 'cli/ui/wrap'
25
+
26
+ # Convenience accessor to +CLI::UI::Spinner::SpinGroup+
27
+ SpinGroup = Spinner::SpinGroup
28
+
29
+ Colorable = T.type_alias { T.any(Symbol, String, CLI::UI::Color) }
30
+ FrameStylable = T.type_alias { T.any(Symbol, String, CLI::UI::Frame::FrameStyle) }
31
+ IOLike = T.type_alias { T.any(IO, StringIO) }
32
+
33
+ # Glyph resolution using +CLI::UI::Glyph.lookup+
34
+ # Look at the method signature for +Glyph.lookup+ for more details
35
+ #
36
+ # ==== Attributes
37
+ #
38
+ # * +handle+ - handle of the glyph to resolve
39
+ #
40
+ sig { params(handle: String).returns(Glyph) }
41
+ def self.glyph(handle)
42
+ CLI::UI::Glyph.lookup(handle)
43
+ end
44
+
45
+ # Color resolution using +CLI::UI::Color.lookup+
46
+ # Will lookup using +Color.lookup+ unless it's already a CLI::UI::Color (or nil)
47
+ #
48
+ # ==== Attributes
49
+ #
50
+ # * +input+ - color to resolve
51
+ #
52
+ sig { params(input: Colorable).returns(CLI::UI::Color) }
53
+ def self.resolve_color(input)
54
+ case input
55
+ when CLI::UI::Color
56
+ input
57
+ else
58
+ CLI::UI::Color.lookup(input)
59
+ end
60
+ end
61
+
62
+ # Frame style resolution using +CLI::UI::Frame::FrameStyle.lookup+.
63
+ # Will lookup using +FrameStyle.lookup+ unless it's already a CLI::UI::Frame::FrameStyle(or nil)
64
+ #
65
+ # ==== Attributes
66
+ #
67
+ # * +input+ - frame style to resolve
68
+ sig { params(input: FrameStylable).returns(CLI::UI::Frame::FrameStyle) }
69
+ def self.resolve_style(input)
70
+ case input
71
+ when CLI::UI::Frame::FrameStyle
72
+ input
73
+ else
74
+ CLI::UI::Frame::FrameStyle.lookup(input.to_s)
75
+ end
76
+ end
77
+
78
+ # Convenience Method for +CLI::UI::Prompt.confirm+
79
+ #
80
+ # ==== Attributes
81
+ #
82
+ # * +question+ - question to confirm
83
+ #
84
+ sig { params(question: String, default: T::Boolean).returns(T::Boolean) }
85
+ def self.confirm(question, default: true)
86
+ CLI::UI::Prompt.confirm(question, default: default)
87
+ end
88
+
89
+ # Convenience Method for +CLI::UI::Prompt.ask+
90
+ sig do
91
+ params(
92
+ question: String,
93
+ options: T.nilable(T::Array[String]),
94
+ default: T.nilable(T.any(String, T::Array[String])),
95
+ is_file: T::Boolean,
96
+ allow_empty: T::Boolean,
97
+ multiple: T::Boolean,
98
+ filter_ui: T::Boolean,
99
+ select_ui: T::Boolean,
100
+ options_proc: T.nilable(T.proc.params(handler: Prompt::OptionsHandler).void)
101
+ ).returns(T.any(String, T::Array[String]))
102
+ end
103
+ def self.ask(
104
+ question,
105
+ options: nil,
106
+ default: nil,
107
+ is_file: false,
108
+ allow_empty: true,
109
+ multiple: false,
110
+ filter_ui: true,
111
+ select_ui: true,
112
+ &options_proc
113
+ )
114
+ CLI::UI::Prompt.ask(
115
+ question,
116
+ options: options,
117
+ default: default,
118
+ is_file: is_file,
119
+ allow_empty: allow_empty,
120
+ multiple: multiple,
121
+ filter_ui: filter_ui,
122
+ select_ui: select_ui,
123
+ &options_proc
124
+ )
125
+ end
126
+
127
+ # Convenience Method to resolve text using +CLI::UI::Formatter.format+
128
+ # Check +CLI::UI::Formatter::SGR_MAP+ for available formatting options
129
+ #
130
+ # ==== Attributes
131
+ #
132
+ # * +input+ - input to format
133
+ # * +truncate_to+ - number of characters to truncate the string to (or nil)
134
+ #
135
+ sig { params(input: String, truncate_to: T.nilable(Integer)).returns(String) }
136
+ def self.resolve_text(input, truncate_to: nil)
137
+ formatted = CLI::UI::Formatter.new(input).format
138
+ return formatted unless truncate_to
139
+
140
+ CLI::UI::Truncater.call(formatted, truncate_to)
141
+ end
142
+
143
+ # Convenience Method to format text using +CLI::UI::Formatter.format+
144
+ # Check +CLI::UI::Formatter::SGR_MAP+ for available formatting options
145
+ #
146
+ # https://user-images.githubusercontent.com/3074765/33799827-6d0721a2-dd01-11e7-9ab5-c3d455264afe.png
147
+ # https://user-images.githubusercontent.com/3074765/33799847-9ec03fd0-dd01-11e7-93f7-5f5cc540e61e.png
148
+ #
149
+ # ==== Attributes
150
+ #
151
+ # * +input+ - input to format
152
+ #
153
+ # ==== Options
154
+ #
155
+ # * +enable_color+ - should color be used? default to true unless output is redirected.
156
+ #
157
+ sig { params(input: String, enable_color: T::Boolean).returns(String) }
158
+ def self.fmt(input, enable_color: enable_color?)
159
+ CLI::UI::Formatter.new(input).format(enable_color: enable_color)
160
+ end
161
+
162
+ sig { params(input: String).returns(String) }
163
+ def self.wrap(input)
164
+ CLI::UI::Wrap.new(input).wrap
165
+ end
166
+
167
+ # Convenience Method for +CLI::UI::Printer.puts+
168
+ #
169
+ # ==== Attributes
170
+ #
171
+ # * +msg+ - Message to print
172
+ # * +kwargs+ - keyword arguments for +Printer.puts+
173
+ #
174
+ sig do
175
+ params(
176
+ msg: String,
177
+ frame_color: T.nilable(Colorable),
178
+ to: IOLike,
179
+ encoding: Encoding,
180
+ format: T::Boolean,
181
+ graceful: T::Boolean,
182
+ wrap: T::Boolean
183
+ ).void
184
+ end
185
+ def self.puts(
186
+ msg,
187
+ frame_color: nil,
188
+ to: $stdout,
189
+ encoding: Encoding::UTF_8,
190
+ format: true,
191
+ graceful: true,
192
+ wrap: true
193
+ )
194
+ CLI::UI::Printer.puts(
195
+ msg,
196
+ frame_color: frame_color,
197
+ to: to,
198
+ encoding: encoding,
199
+ format: format,
200
+ graceful: graceful,
201
+ wrap: wrap,
202
+ )
203
+ end
204
+
205
+ # Convenience Method for +CLI::UI::Frame.open+
206
+ #
207
+ # ==== Attributes
208
+ #
209
+ # * +args+ - arguments for +Frame.open+
210
+ # * +block+ - block for +Frame.open+
211
+ #
212
+ sig do
213
+ type_parameters(:T).params(
214
+ text: String,
215
+ color: T.nilable(Colorable),
216
+ failure_text: T.nilable(String),
217
+ success_text: T.nilable(String),
218
+ timing: T.any(T::Boolean, Numeric),
219
+ frame_style: FrameStylable,
220
+ block: T.nilable(T.proc.returns(T.type_parameter(:T)))
221
+ ).returns(T.nilable(T.type_parameter(:T)))
222
+ end
223
+ def self.frame(
224
+ text,
225
+ color: Frame::DEFAULT_FRAME_COLOR,
226
+ failure_text: nil,
227
+ success_text: nil,
228
+ timing: block_given?,
229
+ frame_style: Frame.frame_style,
230
+ &block
231
+ )
232
+ CLI::UI::Frame.open(
233
+ text,
234
+ color: color,
235
+ failure_text: failure_text,
236
+ success_text: success_text,
237
+ timing: timing,
238
+ frame_style: frame_style,
239
+ &block
240
+ )
241
+ end
242
+
243
+ # Convenience Method for +CLI::UI::Spinner.spin+
244
+ #
245
+ # ==== Attributes
246
+ #
247
+ # * +args+ - arguments for +Spinner.open+
248
+ # * +block+ - block for +Spinner.open+
249
+ #
250
+ sig do
251
+ params(title: String, auto_debrief: T::Boolean, block: T.proc.params(task: Spinner::SpinGroup::Task).void)
252
+ .returns(T::Boolean)
253
+ end
254
+ def self.spinner(title, auto_debrief: true, &block)
255
+ CLI::UI::Spinner.spin(title, auto_debrief: auto_debrief, &block)
256
+ end
257
+
258
+ # Convenience Method to override frame color using +CLI::UI::Frame.with_frame_color+
259
+ #
260
+ # ==== Attributes
261
+ #
262
+ # * +color+ - color to override to
263
+ # * +block+ - block for +Frame.with_frame_color_override+
264
+ #
265
+ sig do
266
+ type_parameters(:T)
267
+ .params(color: Colorable, block: T.proc.returns(T.type_parameter(:T)))
268
+ .returns(T.type_parameter(:T))
269
+ end
270
+ def self.with_frame_color(color, &block)
271
+ CLI::UI::Frame.with_frame_color_override(color, &block)
272
+ end
273
+
274
+ # Duplicate output to a file path
275
+ #
276
+ # ==== Attributes
277
+ #
278
+ # * +path+ - path to duplicate output to
279
+ #
280
+ sig do
281
+ type_parameters(:T)
282
+ .params(path: String, block: T.proc.returns(T.type_parameter(:T)))
283
+ .returns(T.type_parameter(:T))
284
+ end
285
+ def self.log_output_to(path, &block)
286
+ if CLI::UI::StdoutRouter.duplicate_output_to
287
+ raise 'multiple logs not allowed'
288
+ end
289
+
290
+ CLI::UI::StdoutRouter.duplicate_output_to = File.open(path, 'w')
291
+ yield
292
+ ensure
293
+ if (file_descriptor = CLI::UI::StdoutRouter.duplicate_output_to)
294
+ begin
295
+ file_descriptor.close
296
+ rescue IOError
297
+ nil
298
+ end
299
+ CLI::UI::StdoutRouter.duplicate_output_to = nil
300
+ end
301
+ end
302
+
303
+ # Disable all framing within a block
304
+ #
305
+ # ==== Attributes
306
+ #
307
+ # * +block+ - block in which to disable frames
308
+ #
309
+ sig { type_parameters(:T).params(block: T.proc.returns(T.type_parameter(:T))).returns(T.type_parameter(:T)) }
310
+ def self.raw(&block)
311
+ prev = Thread.current[:no_cliui_frame_inset]
312
+ Thread.current[:no_cliui_frame_inset] = true
313
+ yield
314
+ ensure
315
+ Thread.current[:no_cliui_frame_inset] = prev
316
+ end
317
+
318
+ # Check whether colour is enabled in Formatter output. By default, colour
319
+ # is enabled when STDOUT is a TTY; that is, when output has not been
320
+ # redirected to another program or to a file.
321
+ #
322
+ sig { returns(T::Boolean) }
323
+ def self.enable_color?
324
+ @enable_color
325
+ end
326
+
327
+ # Turn colour output in Formatter on or off.
328
+ #
329
+ # ==== Attributes
330
+ #
331
+ # * +bool+ - true or false; enable or disable colour.
332
+ #
333
+ sig { params(bool: T::Boolean).void }
334
+ def self.enable_color=(bool)
335
+ @enable_color = !!bool
336
+ end
337
+
338
+ self.enable_color = $stdout.tty?
339
+
340
+ # Set the default frame style.
341
+ # Convenience method for setting the default frame style with +CLI::UI::Frame.frame_style=+
342
+ #
343
+ # Raises ArgumentError if +frame_style+ is not valid
344
+ #
345
+ # ==== Attributes
346
+ #
347
+ # * +symbol+ - the default frame style to use for frames
348
+ #
349
+ sig { params(frame_style: FrameStylable).void }
350
+ def self.frame_style=(frame_style)
351
+ Frame.frame_style = frame_style
352
+ end
353
+ end
354
+ end
355
+
356
+ require 'cli/ui/stdout_router'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
@@ -69,6 +69,7 @@ files:
69
69
  - Rakefile
70
70
  - bin/console
71
71
  - bin/setup
72
+ - bin/update-deps
72
73
  - exe/gorails
73
74
  - gorails.gemspec
74
75
  - lib/gorails.rb
@@ -82,6 +83,61 @@ files:
82
83
  - lib/gorails/entry_point.rb
83
84
  - lib/gorails/version.rb
84
85
  - sig/gorails.rbs
86
+ - vendor/deps/cli-kit/REVISION
87
+ - vendor/deps/cli-kit/lib/cli/kit.rb
88
+ - vendor/deps/cli-kit/lib/cli/kit/args.rb
89
+ - vendor/deps/cli-kit/lib/cli/kit/args/definition.rb
90
+ - vendor/deps/cli-kit/lib/cli/kit/args/evaluation.rb
91
+ - vendor/deps/cli-kit/lib/cli/kit/args/parser.rb
92
+ - vendor/deps/cli-kit/lib/cli/kit/args/parser/node.rb
93
+ - vendor/deps/cli-kit/lib/cli/kit/args/tokenizer.rb
94
+ - vendor/deps/cli-kit/lib/cli/kit/base_command.rb
95
+ - vendor/deps/cli-kit/lib/cli/kit/command_help.rb
96
+ - vendor/deps/cli-kit/lib/cli/kit/command_registry.rb
97
+ - vendor/deps/cli-kit/lib/cli/kit/config.rb
98
+ - vendor/deps/cli-kit/lib/cli/kit/core_ext.rb
99
+ - vendor/deps/cli-kit/lib/cli/kit/error_handler.rb
100
+ - vendor/deps/cli-kit/lib/cli/kit/executor.rb
101
+ - vendor/deps/cli-kit/lib/cli/kit/ini.rb
102
+ - vendor/deps/cli-kit/lib/cli/kit/levenshtein.rb
103
+ - vendor/deps/cli-kit/lib/cli/kit/logger.rb
104
+ - vendor/deps/cli-kit/lib/cli/kit/opts.rb
105
+ - vendor/deps/cli-kit/lib/cli/kit/resolver.rb
106
+ - vendor/deps/cli-kit/lib/cli/kit/sorbet_runtime_stub.rb
107
+ - vendor/deps/cli-kit/lib/cli/kit/support.rb
108
+ - vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb
109
+ - vendor/deps/cli-kit/lib/cli/kit/system.rb
110
+ - vendor/deps/cli-kit/lib/cli/kit/util.rb
111
+ - vendor/deps/cli-kit/lib/cli/kit/version.rb
112
+ - vendor/deps/cli-ui/REVISION
113
+ - vendor/deps/cli-ui/lib/cli/ui.rb
114
+ - vendor/deps/cli-ui/lib/cli/ui/ansi.rb
115
+ - vendor/deps/cli-ui/lib/cli/ui/color.rb
116
+ - vendor/deps/cli-ui/lib/cli/ui/formatter.rb
117
+ - vendor/deps/cli-ui/lib/cli/ui/frame.rb
118
+ - vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb
119
+ - vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb
120
+ - vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb
121
+ - vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb
122
+ - vendor/deps/cli-ui/lib/cli/ui/glyph.rb
123
+ - vendor/deps/cli-ui/lib/cli/ui/os.rb
124
+ - vendor/deps/cli-ui/lib/cli/ui/printer.rb
125
+ - vendor/deps/cli-ui/lib/cli/ui/progress.rb
126
+ - vendor/deps/cli-ui/lib/cli/ui/prompt.rb
127
+ - vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb
128
+ - vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb
129
+ - vendor/deps/cli-ui/lib/cli/ui/sorbet_runtime_stub.rb
130
+ - vendor/deps/cli-ui/lib/cli/ui/spinner.rb
131
+ - vendor/deps/cli-ui/lib/cli/ui/spinner/async.rb
132
+ - vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb
133
+ - vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb
134
+ - vendor/deps/cli-ui/lib/cli/ui/terminal.rb
135
+ - vendor/deps/cli-ui/lib/cli/ui/truncater.rb
136
+ - vendor/deps/cli-ui/lib/cli/ui/version.rb
137
+ - vendor/deps/cli-ui/lib/cli/ui/widgets.rb
138
+ - vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb
139
+ - vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb
140
+ - vendor/deps/cli-ui/lib/cli/ui/wrap.rb
85
141
  homepage: https://github.com/excid3/gorails-ruby
86
142
  licenses:
87
143
  - MIT