rails-interactive 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/Gemfile.lock +77 -72
- data/bin/console +2 -9
- data/lib/cli/categories.rb +18 -0
- data/lib/cli/commands.rb +22 -0
- data/lib/cli/config/categories.yml +51 -0
- data/lib/cli/config/commands.yml +128 -0
- data/lib/cli/message.rb +55 -0
- data/lib/cli/prompt.rb +42 -0
- data/lib/cli/templates/setup_avo.rb +10 -0
- data/lib/cli/templates/setup_awesome_print.rb +4 -0
- data/lib/cli/templates/setup_better_errors.rb +8 -0
- data/lib/cli/templates/setup_brakeman.rb +6 -0
- data/lib/cli/templates/setup_bullet.rb +7 -0
- data/lib/cli/templates/setup_cancancan.rb +7 -0
- data/lib/cli/templates/setup_devise.rb +10 -0
- data/lib/cli/templates/setup_faker.rb +5 -0
- data/lib/cli/templates/setup_friendly_id.rb +5 -0
- data/lib/cli/templates/setup_graphql.rb +10 -0
- data/lib/cli/templates/setup_haml.rb +18 -0
- data/lib/cli/templates/setup_kaminari.rb +7 -0
- data/lib/cli/templates/setup_letter_opener.rb +15 -0
- data/lib/cli/templates/setup_omniauth.rb +61 -0
- data/lib/cli/templates/setup_pundit.rb +15 -0
- data/lib/cli/templates/setup_rails_admin.rb +10 -0
- data/lib/cli/templates/setup_rspec.rb +13 -0
- data/lib/cli/templates/setup_rubocop.rb +10 -0
- data/lib/cli/templates/setup_sidekiq.rb +32 -0
- data/lib/cli/templates/setup_slim.rb +19 -0
- data/lib/cli/templates/setup_standardrb.rb +10 -0
- data/lib/cli/utils.rb +48 -0
- data/lib/{rails_interactive → cli}/version.rb +3 -1
- data/lib/rails_interactive.rb +72 -35
- data/rails-interactive.gemspec +4 -2
- metadata +59 -5
- data/lib/rails_interactive/message.rb +0 -54
- 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
|