rails-interactive 0.1.8 → 2.0.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +9 -0
  3. data/.github/workflows/main.yml +57 -57
  4. data/.rubocop.yml +9 -0
  5. data/CHANGELOG.md +7 -0
  6. data/Gemfile.lock +77 -72
  7. data/bin/console +2 -9
  8. data/lib/cli/categories.rb +18 -0
  9. data/lib/cli/commands.rb +22 -0
  10. data/lib/cli/config/categories.yml +51 -0
  11. data/lib/cli/config/commands.yml +128 -0
  12. data/lib/cli/message.rb +55 -0
  13. data/lib/cli/prompt.rb +42 -0
  14. data/lib/{rails_interactive → cli}/templates/setup_avo.rb +0 -0
  15. data/lib/cli/templates/setup_awesome_print.rb +4 -0
  16. data/lib/cli/templates/setup_better_errors.rb +8 -0
  17. data/lib/{rails_interactive → cli}/templates/setup_brakeman.rb +0 -0
  18. data/lib/cli/templates/setup_bullet.rb +7 -0
  19. data/lib/{rails_interactive → cli}/templates/setup_cancancan.rb +0 -0
  20. data/lib/{rails_interactive → cli}/templates/setup_devise.rb +0 -0
  21. data/lib/cli/templates/setup_faker.rb +5 -0
  22. data/lib/cli/templates/setup_friendly_id.rb +5 -0
  23. data/lib/{rails_interactive → cli}/templates/setup_graphql.rb +0 -0
  24. data/lib/{rails_interactive → cli}/templates/setup_haml.rb +0 -0
  25. data/lib/{rails_interactive → cli}/templates/setup_kaminari.rb +0 -0
  26. data/lib/cli/templates/setup_letter_opener.rb +15 -0
  27. data/lib/{rails_interactive → cli}/templates/setup_omniauth.rb +0 -0
  28. data/lib/{rails_interactive → cli}/templates/setup_pundit.rb +0 -0
  29. data/lib/{rails_interactive → cli}/templates/setup_rails_admin.rb +0 -0
  30. data/lib/{rails_interactive → cli}/templates/setup_rspec.rb +0 -0
  31. data/lib/{rails_interactive → cli}/templates/setup_rubocop.rb +0 -0
  32. data/lib/{rails_interactive → cli}/templates/setup_sidekiq.rb +0 -0
  33. data/lib/{rails_interactive → cli}/templates/setup_slim.rb +0 -0
  34. data/lib/{rails_interactive → cli}/templates/setup_standardrb.rb +0 -0
  35. data/lib/cli/utils.rb +48 -0
  36. data/lib/{rails_interactive → cli}/version.rb +3 -1
  37. data/lib/rails_interactive.rb +68 -81
  38. data/rails-interactive.gemspec +4 -2
  39. metadata +60 -20
  40. data/lib/rails_interactive/message.rb +0 -52
  41. data/lib/rails_interactive/prompt.rb +0 -40
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tty/prompt"
4
-
5
- module RailsInteractive
6
- # Prompt class for commands
7
- class Prompt
8
- # Create a new instance
9
- #
10
- # @param msg [String] the message to display
11
- # @param type [String] the type of prompt
12
- # @param options [Array] the options to display
13
- # @param required [Boolean] whether the prompt value is required
14
- #
15
- # @return [Interactive::Prompt] the new instance
16
- def initialize(msg, type, options = nil, required: false)
17
- @msg = msg
18
- @type = type
19
- @options = options
20
- @required = required
21
- @prompt = TTY::Prompt.new
22
- end
23
-
24
- # Perform the prompt
25
- #
26
- # @return [String] the value of the prompt
27
- def perform
28
- case @type
29
- when "ask"
30
- @prompt.ask(@msg, required: @required)
31
- when "select"
32
- @prompt.select(@msg, @options, required: @required)
33
- when "multi_select"
34
- @prompt.multi_select(@msg, @options)
35
- else
36
- puts "Invalid parameter"
37
- end
38
- end
39
- end
40
- end