rails-interactive 1.0.0 → 2.1.1
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 +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +9 -0
- data/Gemfile.lock +77 -72
- data/README.md +1 -1
- data/bin/console +2 -9
- data/lib/cli/category.rb +18 -0
- data/lib/cli/command.rb +29 -0
- data/lib/cli/command_handler.rb +50 -0
- data/lib/cli/config/categories.yml +51 -0
- data/lib/cli/config/commands.yml +142 -0
- data/lib/cli/message.rb +55 -0
- data/lib/cli/prompt.rb +42 -0
- data/lib/cli/templates/setup_active_admin.rb +8 -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_sassc_rails.rb +4 -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 +38 -0
- data/lib/{rails_interactive → cli}/version.rb +3 -1
- data/lib/rails_interactive.rb +80 -32
- data/rails-interactive.gemspec +4 -2
- metadata +62 -5
- data/lib/rails_interactive/message.rb +0 -54
- data/lib/rails_interactive/prompt.rb +0 -40
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-interactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oguzhan Ince
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05
|
11
|
+
date: 2022-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yaml
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: tty-prompt
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,10 +163,39 @@ files:
|
|
135
163
|
- bin/console
|
136
164
|
- bin/rails-interactive
|
137
165
|
- bin/setup
|
166
|
+
- lib/cli/category.rb
|
167
|
+
- lib/cli/command.rb
|
168
|
+
- lib/cli/command_handler.rb
|
169
|
+
- lib/cli/config/categories.yml
|
170
|
+
- lib/cli/config/commands.yml
|
171
|
+
- lib/cli/message.rb
|
172
|
+
- lib/cli/prompt.rb
|
173
|
+
- lib/cli/templates/setup_active_admin.rb
|
174
|
+
- lib/cli/templates/setup_avo.rb
|
175
|
+
- lib/cli/templates/setup_awesome_print.rb
|
176
|
+
- lib/cli/templates/setup_better_errors.rb
|
177
|
+
- lib/cli/templates/setup_brakeman.rb
|
178
|
+
- lib/cli/templates/setup_bullet.rb
|
179
|
+
- lib/cli/templates/setup_cancancan.rb
|
180
|
+
- lib/cli/templates/setup_devise.rb
|
181
|
+
- lib/cli/templates/setup_faker.rb
|
182
|
+
- lib/cli/templates/setup_friendly_id.rb
|
183
|
+
- lib/cli/templates/setup_graphql.rb
|
184
|
+
- lib/cli/templates/setup_haml.rb
|
185
|
+
- lib/cli/templates/setup_kaminari.rb
|
186
|
+
- lib/cli/templates/setup_letter_opener.rb
|
187
|
+
- lib/cli/templates/setup_omniauth.rb
|
188
|
+
- lib/cli/templates/setup_pundit.rb
|
189
|
+
- lib/cli/templates/setup_rails_admin.rb
|
190
|
+
- lib/cli/templates/setup_rspec.rb
|
191
|
+
- lib/cli/templates/setup_rubocop.rb
|
192
|
+
- lib/cli/templates/setup_sassc_rails.rb
|
193
|
+
- lib/cli/templates/setup_sidekiq.rb
|
194
|
+
- lib/cli/templates/setup_slim.rb
|
195
|
+
- lib/cli/templates/setup_standardrb.rb
|
196
|
+
- lib/cli/utils.rb
|
197
|
+
- lib/cli/version.rb
|
138
198
|
- lib/rails_interactive.rb
|
139
|
-
- lib/rails_interactive/message.rb
|
140
|
-
- lib/rails_interactive/prompt.rb
|
141
|
-
- lib/rails_interactive/version.rb
|
142
199
|
- rails-interactive.gemspec
|
143
200
|
homepage: https://github.com/oguzsh/rails-interactive
|
144
201
|
licenses:
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "colorize"
|
4
|
-
|
5
|
-
module RailsInteractive
|
6
|
-
# Utils class for the interactive CLI module
|
7
|
-
class Message
|
8
|
-
def self.greet
|
9
|
-
render_ascii
|
10
|
-
puts "Welcome to Rails Interactive CLI".colorize(:yellow)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.help
|
14
|
-
puts "bin/interactive new - Create a new Rails Project".colorize(:yellow)
|
15
|
-
puts "bin/interactive help - List all commands".colorize(:yellow)
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.render_ascii
|
20
|
-
# rubocop:disable Naming/HeredocDelimiterNaming
|
21
|
-
puts <<-'EOF'
|
22
|
-
_____ _ _ _____ _ _ _
|
23
|
-
| __ \ (_) | |_ _| | | | | (_)
|
24
|
-
| |__) |__ _ _| |___ | | _ __ | |_ ___ _ __ __ _ ___| |_ ___ _____
|
25
|
-
| _ // _` | | / __| | | | '_ \| __/ _ \ '__/ _` |/ __| __| \ \ / / _ \
|
26
|
-
| | \ \ (_| | | \__ \_| |_| | | | || __/ | | (_| | (__| |_| |\ V / __/
|
27
|
-
|_| \_\__,_|_|_|___/_____|_| |_|\__\___|_| \__,_|\___|\__|_| \_/ \___|
|
28
|
-
|
29
|
-
|
30
|
-
EOF
|
31
|
-
# rubocop:enable Naming/HeredocDelimiterNaming
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.prepare
|
35
|
-
puts ""
|
36
|
-
puts "Project created successfully ✅".colorize(:green)
|
37
|
-
puts "Go to your project folder and ready to go 🎉".colorize(:green)
|
38
|
-
rails_commands
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.rails_commands
|
42
|
-
puts "You can run several commands:".colorize(:green)
|
43
|
-
|
44
|
-
puts "Starts the webpack development server".colorize(:cyan)
|
45
|
-
puts "> bin/webpack-dev-server".colorize(:yellow)
|
46
|
-
|
47
|
-
puts "Starts the rails server".colorize(:cyan)
|
48
|
-
puts "> bin/rails s or bin/rails server".colorize(:yellow)
|
49
|
-
|
50
|
-
puts "Starts the rails console".colorize(:cyan)
|
51
|
-
puts "> bin/rails c or bin/rails console".colorize(:yellow)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -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
|