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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -0
  3. data/Gemfile.lock +77 -72
  4. data/bin/console +2 -9
  5. data/lib/cli/categories.rb +18 -0
  6. data/lib/cli/commands.rb +22 -0
  7. data/lib/cli/config/categories.yml +51 -0
  8. data/lib/cli/config/commands.yml +128 -0
  9. data/lib/cli/message.rb +55 -0
  10. data/lib/cli/prompt.rb +42 -0
  11. data/lib/cli/templates/setup_avo.rb +10 -0
  12. data/lib/cli/templates/setup_awesome_print.rb +4 -0
  13. data/lib/cli/templates/setup_better_errors.rb +8 -0
  14. data/lib/cli/templates/setup_brakeman.rb +6 -0
  15. data/lib/cli/templates/setup_bullet.rb +7 -0
  16. data/lib/cli/templates/setup_cancancan.rb +7 -0
  17. data/lib/cli/templates/setup_devise.rb +10 -0
  18. data/lib/cli/templates/setup_faker.rb +5 -0
  19. data/lib/cli/templates/setup_friendly_id.rb +5 -0
  20. data/lib/cli/templates/setup_graphql.rb +10 -0
  21. data/lib/cli/templates/setup_haml.rb +18 -0
  22. data/lib/cli/templates/setup_kaminari.rb +7 -0
  23. data/lib/cli/templates/setup_letter_opener.rb +15 -0
  24. data/lib/cli/templates/setup_omniauth.rb +61 -0
  25. data/lib/cli/templates/setup_pundit.rb +15 -0
  26. data/lib/cli/templates/setup_rails_admin.rb +10 -0
  27. data/lib/cli/templates/setup_rspec.rb +13 -0
  28. data/lib/cli/templates/setup_rubocop.rb +10 -0
  29. data/lib/cli/templates/setup_sidekiq.rb +32 -0
  30. data/lib/cli/templates/setup_slim.rb +19 -0
  31. data/lib/cli/templates/setup_standardrb.rb +10 -0
  32. data/lib/cli/utils.rb +48 -0
  33. data/lib/{rails_interactive → cli}/version.rb +3 -1
  34. data/lib/rails_interactive.rb +72 -35
  35. data/rails-interactive.gemspec +4 -2
  36. metadata +59 -5
  37. data/lib/rails_interactive/message.rb +0 -54
  38. data/lib/rails_interactive/prompt.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ed0537b6d53cb2eb3f395bbde2c35b9b798c9b74361a28fd26420ff450f5088
4
- data.tar.gz: 1d41ee1c12f1979dcb372a36d340bf670ef03b2146c3b8bec781456a9284a9c4
3
+ metadata.gz: 7bbe64281e0e3224cf7ca9a041eb42c42c7e69028406b7e10d3e60a9efbae743
4
+ data.tar.gz: b69196bc79adb05559963c6f1cfee8fc2dda46fe795bf4c5449c35673080fa19
5
5
  SHA512:
6
- metadata.gz: 483c4f42d0c78380e98722b8c5f84dc4e6bdc66e041eca02b6a82ed036e138eca618cd97d43a79089c785ed969e3ec4f7b8094a910cb38c8a4a66e724a034f9b
7
- data.tar.gz: 4f847ee3dcfcaba3091121a1672c922e74e2bae30b8f5231811a24ca8b6151229b29950c287e5f7e7a91005fe84e6cbe8a2eca728bc678e3c76d7f6a632b513c
6
+ metadata.gz: f72def1e7699e42baa285164308ef728d5c118bf7611972441242486c442d154d3ee00a8c3cf05a29c3eeb6aa453bb61a05f60c406880aa4942c8c64858593d5
7
+ data.tar.gz: d53e7c764ca1ecbee3378a4304070ced64c18825b7f2ef7b53700612c442fced35128b05f8c4be6cbe12090a08784a5d9b747a0f0be4cf83f29412b30b604b8e
data/.rubocop.yml CHANGED
@@ -11,3 +11,12 @@ Style/StringLiteralsInInterpolation:
11
11
 
12
12
  Layout/LineLength:
13
13
  Max: 120
14
+
15
+ Style/Documentation:
16
+ Enabled: false
17
+
18
+ Metrics/MethodLength:
19
+ Max: 12
20
+
21
+ Metrics/CyclomaticComplexity:
22
+ Max: 25
data/Gemfile.lock CHANGED
@@ -1,73 +1,73 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-interactive (0.1.9)
4
+ rails-interactive (2.0.0)
5
5
  tty-prompt
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.2.2)
11
- actionpack (= 7.0.2.2)
12
- activesupport (= 7.0.2.2)
10
+ actioncable (7.0.3)
11
+ actionpack (= 7.0.3)
12
+ activesupport (= 7.0.3)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.2.2)
16
- actionpack (= 7.0.2.2)
17
- activejob (= 7.0.2.2)
18
- activerecord (= 7.0.2.2)
19
- activestorage (= 7.0.2.2)
20
- activesupport (= 7.0.2.2)
15
+ actionmailbox (7.0.3)
16
+ actionpack (= 7.0.3)
17
+ activejob (= 7.0.3)
18
+ activerecord (= 7.0.3)
19
+ activestorage (= 7.0.3)
20
+ activesupport (= 7.0.3)
21
21
  mail (>= 2.7.1)
22
22
  net-imap
23
23
  net-pop
24
24
  net-smtp
25
- actionmailer (7.0.2.2)
26
- actionpack (= 7.0.2.2)
27
- actionview (= 7.0.2.2)
28
- activejob (= 7.0.2.2)
29
- activesupport (= 7.0.2.2)
25
+ actionmailer (7.0.3)
26
+ actionpack (= 7.0.3)
27
+ actionview (= 7.0.3)
28
+ activejob (= 7.0.3)
29
+ activesupport (= 7.0.3)
30
30
  mail (~> 2.5, >= 2.5.4)
31
31
  net-imap
32
32
  net-pop
33
33
  net-smtp
34
34
  rails-dom-testing (~> 2.0)
35
- actionpack (7.0.2.2)
36
- actionview (= 7.0.2.2)
37
- activesupport (= 7.0.2.2)
35
+ actionpack (7.0.3)
36
+ actionview (= 7.0.3)
37
+ activesupport (= 7.0.3)
38
38
  rack (~> 2.0, >= 2.2.0)
39
39
  rack-test (>= 0.6.3)
40
40
  rails-dom-testing (~> 2.0)
41
41
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.2.2)
43
- actionpack (= 7.0.2.2)
44
- activerecord (= 7.0.2.2)
45
- activestorage (= 7.0.2.2)
46
- activesupport (= 7.0.2.2)
42
+ actiontext (7.0.3)
43
+ actionpack (= 7.0.3)
44
+ activerecord (= 7.0.3)
45
+ activestorage (= 7.0.3)
46
+ activesupport (= 7.0.3)
47
47
  globalid (>= 0.6.0)
48
48
  nokogiri (>= 1.8.5)
49
- actionview (7.0.2.2)
50
- activesupport (= 7.0.2.2)
49
+ actionview (7.0.3)
50
+ activesupport (= 7.0.3)
51
51
  builder (~> 3.1)
52
52
  erubi (~> 1.4)
53
53
  rails-dom-testing (~> 2.0)
54
54
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.2.2)
56
- activesupport (= 7.0.2.2)
55
+ activejob (7.0.3)
56
+ activesupport (= 7.0.3)
57
57
  globalid (>= 0.3.6)
58
- activemodel (7.0.2.2)
59
- activesupport (= 7.0.2.2)
60
- activerecord (7.0.2.2)
61
- activemodel (= 7.0.2.2)
62
- activesupport (= 7.0.2.2)
63
- activestorage (7.0.2.2)
64
- actionpack (= 7.0.2.2)
65
- activejob (= 7.0.2.2)
66
- activerecord (= 7.0.2.2)
67
- activesupport (= 7.0.2.2)
58
+ activemodel (7.0.3)
59
+ activesupport (= 7.0.3)
60
+ activerecord (7.0.3)
61
+ activemodel (= 7.0.3)
62
+ activesupport (= 7.0.3)
63
+ activestorage (7.0.3)
64
+ actionpack (= 7.0.3)
65
+ activejob (= 7.0.3)
66
+ activerecord (= 7.0.3)
67
+ activesupport (= 7.0.3)
68
68
  marcel (~> 1.0)
69
69
  mini_mime (>= 1.1.0)
70
- activesupport (7.0.2.2)
70
+ activesupport (7.0.3)
71
71
  concurrent-ruby (~> 1.0, >= 1.0.2)
72
72
  i18n (>= 1.6, < 2)
73
73
  minitest (>= 5.1)
@@ -75,8 +75,9 @@ GEM
75
75
  ast (2.4.2)
76
76
  builder (3.2.4)
77
77
  byebug (11.1.3)
78
+ coderay (1.1.3)
78
79
  colorize (0.8.1)
79
- concurrent-ruby (1.1.9)
80
+ concurrent-ruby (1.1.10)
80
81
  crass (1.0.6)
81
82
  diff-lcs (1.5.0)
82
83
  digest (3.1.0)
@@ -85,8 +86,7 @@ GEM
85
86
  activesupport (>= 5.0)
86
87
  i18n (1.10.0)
87
88
  concurrent-ruby (~> 1.0)
88
- io-wait (0.2.1)
89
- loofah (2.14.0)
89
+ loofah (2.18.0)
90
90
  crass (~> 1.0.2)
91
91
  nokogiri (>= 1.5.9)
92
92
  mail (2.7.1)
@@ -103,56 +103,58 @@ GEM
103
103
  digest
104
104
  net-protocol
105
105
  timeout
106
- net-protocol (0.1.2)
107
- io-wait
106
+ net-protocol (0.1.3)
108
107
  timeout
109
108
  net-smtp (0.3.1)
110
109
  digest
111
110
  net-protocol
112
111
  timeout
113
112
  nio4r (2.5.8)
114
- nokogiri (1.13.4-x86_64-darwin)
113
+ nokogiri (1.13.6-x86_64-darwin)
115
114
  racc (~> 1.4)
116
- nokogiri (1.13.4-x86_64-linux)
115
+ nokogiri (1.13.6-x86_64-linux)
117
116
  racc (~> 1.4)
118
- parallel (1.21.0)
119
- parser (3.1.1.0)
117
+ parallel (1.22.1)
118
+ parser (3.1.2.0)
120
119
  ast (~> 2.4.1)
121
120
  pastel (0.8.0)
122
121
  tty-color (~> 0.5)
122
+ pry (0.14.1)
123
+ coderay (~> 1.1)
124
+ method_source (~> 1.0)
123
125
  racc (1.6.0)
124
- rack (2.2.3)
126
+ rack (2.2.3.1)
125
127
  rack-test (1.1.0)
126
128
  rack (>= 1.0, < 3)
127
- rails (7.0.2.2)
128
- actioncable (= 7.0.2.2)
129
- actionmailbox (= 7.0.2.2)
130
- actionmailer (= 7.0.2.2)
131
- actionpack (= 7.0.2.2)
132
- actiontext (= 7.0.2.2)
133
- actionview (= 7.0.2.2)
134
- activejob (= 7.0.2.2)
135
- activemodel (= 7.0.2.2)
136
- activerecord (= 7.0.2.2)
137
- activestorage (= 7.0.2.2)
138
- activesupport (= 7.0.2.2)
129
+ rails (7.0.3)
130
+ actioncable (= 7.0.3)
131
+ actionmailbox (= 7.0.3)
132
+ actionmailer (= 7.0.3)
133
+ actionpack (= 7.0.3)
134
+ actiontext (= 7.0.3)
135
+ actionview (= 7.0.3)
136
+ activejob (= 7.0.3)
137
+ activemodel (= 7.0.3)
138
+ activerecord (= 7.0.3)
139
+ activestorage (= 7.0.3)
140
+ activesupport (= 7.0.3)
139
141
  bundler (>= 1.15.0)
140
- railties (= 7.0.2.2)
142
+ railties (= 7.0.3)
141
143
  rails-dom-testing (2.0.3)
142
144
  activesupport (>= 4.2.0)
143
145
  nokogiri (>= 1.6)
144
146
  rails-html-sanitizer (1.4.2)
145
147
  loofah (~> 2.3)
146
- railties (7.0.2.2)
147
- actionpack (= 7.0.2.2)
148
- activesupport (= 7.0.2.2)
148
+ railties (7.0.3)
149
+ actionpack (= 7.0.3)
150
+ activesupport (= 7.0.3)
149
151
  method_source
150
152
  rake (>= 12.2)
151
153
  thor (~> 1.0)
152
154
  zeitwerk (~> 2.5)
153
155
  rainbow (3.1.1)
154
156
  rake (13.0.6)
155
- regexp_parser (2.2.1)
157
+ regexp_parser (2.5.0)
156
158
  rexml (3.2.5)
157
159
  rspec (3.11.0)
158
160
  rspec-core (~> 3.11.0)
@@ -163,25 +165,25 @@ GEM
163
165
  rspec-expectations (3.11.0)
164
166
  diff-lcs (>= 1.2.0, < 2.0)
165
167
  rspec-support (~> 3.11.0)
166
- rspec-mocks (3.11.0)
168
+ rspec-mocks (3.11.1)
167
169
  diff-lcs (>= 1.2.0, < 2.0)
168
170
  rspec-support (~> 3.11.0)
169
171
  rspec-support (3.11.0)
170
- rubocop (1.26.0)
172
+ rubocop (1.30.0)
171
173
  parallel (~> 1.10)
172
174
  parser (>= 3.1.0.0)
173
175
  rainbow (>= 2.2.2, < 4.0)
174
176
  regexp_parser (>= 1.8, < 3.0)
175
- rexml
176
- rubocop-ast (>= 1.16.0, < 2.0)
177
+ rexml (>= 3.2.5, < 4.0)
178
+ rubocop-ast (>= 1.18.0, < 2.0)
177
179
  ruby-progressbar (~> 1.7)
178
180
  unicode-display_width (>= 1.4.0, < 3.0)
179
- rubocop-ast (1.16.0)
181
+ rubocop-ast (1.18.0)
180
182
  parser (>= 3.1.1.0)
181
183
  ruby-progressbar (1.11.0)
182
- strscan (3.0.1)
184
+ strscan (3.0.3)
183
185
  thor (1.2.1)
184
- timeout (0.2.0)
186
+ timeout (0.3.0)
185
187
  tty-color (0.6.0)
186
188
  tty-cursor (0.7.1)
187
189
  tty-prompt (0.23.1)
@@ -199,6 +201,7 @@ GEM
199
201
  websocket-extensions (>= 0.1.0)
200
202
  websocket-extensions (0.1.5)
201
203
  wisper (2.0.1)
204
+ yaml (0.2.0)
202
205
  zeitwerk (2.5.4)
203
206
 
204
207
  PLATFORMS
@@ -209,12 +212,14 @@ DEPENDENCIES
209
212
  bundler
210
213
  byebug (~> 11.1.2)
211
214
  colorize
215
+ pry
212
216
  rails
213
217
  rails-interactive!
214
218
  rake (~> 13.0)
215
219
  rspec (~> 3.0)
216
220
  rubocop (~> 1.7)
217
221
  tty-prompt
222
+ yaml
218
223
 
219
224
  BUNDLED WITH
220
225
  2.2.22
data/bin/console CHANGED
@@ -4,12 +4,5 @@
4
4
  require "bundler/setup"
5
5
  require "rails_interactive"
6
6
 
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start(__FILE__)
7
+ require "pry"
8
+ Pry.start
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
4
+
5
+ module RailsInteractive
6
+ class CLI
7
+ # Categories class for the interactive CLI module
8
+ class Categories
9
+ def initialize
10
+ @categories = YAML.load_file("#{__dir__}/config/categories.yml").uniq
11
+ end
12
+
13
+ def all
14
+ @categories.sort_by { |category| category["weight"] }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
4
+
5
+ module RailsInteractive
6
+ class CLI
7
+ # Commands class for the interactive CLI module
8
+ class Commands
9
+ def initialize
10
+ @commands = YAML.load_file("#{__dir__}/config/commands.yml").uniq
11
+ end
12
+
13
+ def all
14
+ @commands
15
+ end
16
+
17
+ def find_by_identifier(identifier)
18
+ @commands.find { |command| command["identifier"] == identifier }
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,51 @@
1
+ ---
2
+ -
3
+ name: authentication
4
+ weight: 1
5
+ type: "multi_select"
6
+ required: false
7
+ -
8
+ name: authorization
9
+ weight: 2
10
+ type: "select"
11
+ required: false
12
+ -
13
+ name: testing
14
+ weight: 3
15
+ type: "select"
16
+ required: false
17
+ -
18
+ name: template_engine
19
+ weight: 4
20
+ type: "select"
21
+ required: false
22
+ -
23
+ name: code_quality
24
+ weight: 5
25
+ type: "select"
26
+ required: false
27
+ -
28
+ name: background_job
29
+ weight: 6
30
+ type: "select"
31
+ required: false
32
+ -
33
+ name: security
34
+ weight: 7
35
+ type: "select"
36
+ required: false
37
+ -
38
+ name: admin_panel
39
+ weight: 8
40
+ type: "select"
41
+ required: false
42
+ -
43
+ name: features
44
+ weight: 9
45
+ type: "multi_select"
46
+ required: false
47
+ -
48
+ name: development
49
+ weight: 10
50
+ type: "multi_select"
51
+ required: false
@@ -0,0 +1,128 @@
1
+ ---
2
+ -
3
+ identifier: rubocop
4
+ name: Rubocop
5
+ category: code_quality
6
+ description: "A Ruby static code analyzer and formatter, based on the community Ruby style guide. For details: https://github.com/rubocop/rubocop"
7
+ dependencies: null
8
+ -
9
+ identifier: graphql
10
+ name: GraphQL
11
+ category: features
12
+ description: "Ruby implementation of GraphQL. For details: https://github.com/rmosolgo/graphql-ruby"
13
+ dependencies: null
14
+ -
15
+ identifier: avo
16
+ name: Avo
17
+ category: admin_panel
18
+ description: "Configuration-based, no-maintenance, extendable Ruby on Rails admin. For details: https://github.com/avo-hq/avo"
19
+ dependencies: null
20
+ -
21
+ identifier: awesome_print
22
+ name: AwesomePrint
23
+ category: development
24
+ description: "Pretty print your Ruby objects with style. For details: https://github.com/awesome-print/awesome_print"
25
+ dependencies: null
26
+ -
27
+ identifier: better_errors
28
+ name: BetterErrors
29
+ category: development
30
+ description: "Better error page for Rack apps. For details: https://github.com/BetterErrors/better_errors"
31
+ dependencies: null
32
+ -
33
+ identifier: brakeman
34
+ name: Brakeman
35
+ category: security
36
+ description: "A static analysis security vulnerability scanner for Ruby on Rails applications. For details: https://github.com/presidentbeef/brakeman"
37
+ dependencies: null
38
+ -
39
+ identifier: bullet
40
+ name: Bullet
41
+ category: development
42
+ description: "Bullet helps to solve N+1 queries and unused eager loading. For details: https://github.com/flyerhzm/bullet"
43
+ dependencies: null
44
+ -
45
+ identifier: cancancan
46
+ name: CanCanCan
47
+ category: authorization
48
+ description: "CanCanCan is an authorization library for Ruby and Ruby on Rails which restricts what resources a given user is allowed to access. For details: https://github.com/CanCanCommunity/cancancan"
49
+ dependencies: null
50
+ -
51
+ identifier: devise
52
+ name: Devise
53
+ category: authentication
54
+ description: "Flexible authentication solution for Rails with Warden. For details: https://github.com/heartcombo/devise"
55
+ dependencies: null
56
+ -
57
+ identifier: faker
58
+ name: Faker
59
+ category: development
60
+ description: "A library for generating fake data such as names, addresses, and phone numbers. For details: https://github.com/faker-ruby/faker"
61
+ dependencies: null
62
+ -
63
+ identifier: friendly_id
64
+ name: FriendlyID
65
+ category: development
66
+ description: "FriendlyId is the 'Swiss Army bulldozer' of slugging and permalink plugins for Active Record. It lets you create pretty URLs and work with human-friendly strings as if they were numeric ids. For details: https://github.com/norman/friendly_id"
67
+ dependencies: null
68
+ -
69
+ identifier: haml
70
+ name: Haml
71
+ category: template_engine
72
+ description: "HTML Abstraction Markup Language. For details: https://github.com/haml/haml"
73
+ dependencies: null
74
+ -
75
+ identifier: kaminari
76
+ name: Kaminari
77
+ category: features
78
+ description: "A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Ruby webapps. For details: https://github.com/kaminari/kaminari"
79
+ dependencies: null
80
+ -
81
+ identifier: letter_opener
82
+ name: LetterOpener
83
+ category: development
84
+ description: "Preview email in the default browser instead of sending it on development mode. For details: https://github.com/ryanb/letter_opener"
85
+ dependencies: null
86
+ -
87
+ identifier: omniauth
88
+ name: OmniAuth
89
+ category: authentication
90
+ description: "OmniAuth is a flexible authentication system utilizing Rack middleware. For details: https://github.com/omniauth/omniauth"
91
+ dependencies:
92
+ - devise
93
+ -
94
+ identifier: pundit
95
+ name: Pundit
96
+ category: authorization
97
+ description: "Minimal authorization through OO design and pure Ruby classes. For details: https://github.com/varvet/pundit"
98
+ dependencies: null
99
+ -
100
+ identifier: rails_admin
101
+ name: RailsAdmin
102
+ category: admin_panel
103
+ description: "RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data. For details: https://github.com/railsadminteam/rails_admin"
104
+ dependencies: null
105
+ -
106
+ identifier: rspec
107
+ name: RSpec
108
+ category: testing
109
+ description: "A unit test framework for the Ruby programming language. For details: https://github.com/rspec"
110
+ dependencies: null
111
+ -
112
+ identifier: sidekiq
113
+ name: Sidekiq
114
+ category: background_job
115
+ description: "Simple, efficient background processing for Ruby. For details: https://github.com/mperham/sidekiq"
116
+ dependencies: null
117
+ -
118
+ identifier: slim
119
+ name: Slim
120
+ category: template_engine
121
+ description: "Slim is a template language whose goal is to reduce the syntax to the essential parts without becoming cryptic. For details: https://github.com/slim-template/slim"
122
+ dependencies: null
123
+ -
124
+ identifier: standart_rb
125
+ name: StandartRB
126
+ category: code_quality
127
+ description: " Ruby Style Guide, with linter & automatic code fixer. For details: https://github.com/testdouble/standard"
128
+ dependencies: null
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "colorize"
4
+
5
+ module RailsInteractive
6
+ class CLI
7
+ # Utils class for the interactive CLI module
8
+ class Message
9
+ def self.greet
10
+ render_ascii
11
+ puts "Welcome to Rails Interactive CLI".colorize(:yellow)
12
+ end
13
+
14
+ def self.help
15
+ puts "bin/interactive new - Create a new Rails Project".colorize(:yellow)
16
+ puts "bin/interactive help - List all commands".colorize(:yellow)
17
+ exit
18
+ end
19
+
20
+ def self.render_ascii
21
+ # rubocop:disable Naming/HeredocDelimiterNaming
22
+ puts <<-'EOF'
23
+ _____ _ _ _____ _ _ _
24
+ | __ \ (_) | |_ _| | | | | (_)
25
+ | |__) |__ _ _| |___ | | _ __ | |_ ___ _ __ __ _ ___| |_ ___ _____
26
+ | _ // _` | | / __| | | | '_ \| __/ _ \ '__/ _` |/ __| __| \ \ / / _ \
27
+ | | \ \ (_| | | \__ \_| |_| | | | || __/ | | (_| | (__| |_| |\ V / __/
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
55
+ end
data/lib/cli/prompt.rb ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tty/prompt"
4
+
5
+ module RailsInteractive
6
+ class CLI
7
+ # Prompt class for commands
8
+ class Prompt
9
+ # Create a new instance
10
+ #
11
+ # @param msg [String] the message to display
12
+ # @param type [String] the type of prompt
13
+ # @param options [Array] the options to display
14
+ # @param required [Boolean] whether the prompt value is required
15
+ #
16
+ # @return [Interactive::Prompt] the new instance
17
+ def initialize(msg, type, options = nil, required: false)
18
+ @msg = msg
19
+ @type = type
20
+ @options = options
21
+ @required = required
22
+ @prompt = TTY::Prompt.new
23
+ end
24
+
25
+ # Perform the prompt
26
+ #
27
+ # @return [String] the value of the prompt
28
+ def perform
29
+ case @type
30
+ when "ask"
31
+ @prompt.ask(@msg, required: @required)
32
+ when "select"
33
+ @prompt.select(@msg, @options, required: @required)
34
+ when "multi_select"
35
+ @prompt.multi_select(@msg, @options)
36
+ else
37
+ puts "Invalid parameter"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ run "rails db:prepare"
4
+ run "bundle add avo"
5
+
6
+ Bundler.with_unbundled_env { run "bundle install" }
7
+
8
+ rails_command("generate avo:install")
9
+
10
+ puts "Avo is installed! You can go to http://localhost:3000/avo for next steps"
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ run 'bundle add awesome_print --group "development"'
4
+ Bundler.with_unbundled_env { run "bundle install" }
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ gem_group :development do
4
+ gem "better_errors"
5
+ gem "binding_of_caller"
6
+ end
7
+
8
+ Bundler.with_unbundled_env { run "bundle install" }
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ run 'bundle add brakeman --group "development"'
4
+ Bundler.with_unbundled_env { run "bundle install" }
5
+ run "bundle binstubs brakeman"
6
+ run "bin/brakeman"
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ run "bundle add bullet --group 'development'"
4
+
5
+ Bundler.with_unbundled_env { run "bundle install" }
6
+
7
+ run "bundle exec rails g bullet:install"
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ run "bundle add cancancan"
4
+
5
+ Bundler.with_unbundled_env { run "bundle install" }
6
+
7
+ rails_command "generate cancan:ability"