rails_interactive_generators 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dd6352f86018525f9758ba22442ecc06e4c8f07ab2d521d38d8eaa5bc5fb927c
4
+ data.tar.gz: 05c8db42ac8c312b8b4e14a26bc451189345a64ea517ba2d88d79079ba729f60
5
+ SHA512:
6
+ metadata.gz: 4dead93f055e41f042636011b2db3161a2e9ec6cef1ee6d25c814fb46da193c3c09cbe74aedefdced89aa66b589b5d63d9456495a2e328e85959339b5068a5bd
7
+ data.tar.gz: f8a08dc43a30aa9b8d7a4ee03fd61bb46a9d2cf9164c098dadca98590f848081779ec1174ee5ae84432b950593aa559aed82dfed75f63e2409e96dd20857d579
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-02-16
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in rails_interactive_generators.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,246 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rails_interactive_generators (0.1.0)
5
+ rails
6
+ tty-prompt
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (7.1.3)
12
+ actionpack (= 7.1.3)
13
+ activesupport (= 7.1.3)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ zeitwerk (~> 2.6)
17
+ actionmailbox (7.1.3)
18
+ actionpack (= 7.1.3)
19
+ activejob (= 7.1.3)
20
+ activerecord (= 7.1.3)
21
+ activestorage (= 7.1.3)
22
+ activesupport (= 7.1.3)
23
+ mail (>= 2.7.1)
24
+ net-imap
25
+ net-pop
26
+ net-smtp
27
+ actionmailer (7.1.3)
28
+ actionpack (= 7.1.3)
29
+ actionview (= 7.1.3)
30
+ activejob (= 7.1.3)
31
+ activesupport (= 7.1.3)
32
+ mail (~> 2.5, >= 2.5.4)
33
+ net-imap
34
+ net-pop
35
+ net-smtp
36
+ rails-dom-testing (~> 2.2)
37
+ actionpack (7.1.3)
38
+ actionview (= 7.1.3)
39
+ activesupport (= 7.1.3)
40
+ nokogiri (>= 1.8.5)
41
+ racc
42
+ rack (>= 2.2.4)
43
+ rack-session (>= 1.0.1)
44
+ rack-test (>= 0.6.3)
45
+ rails-dom-testing (~> 2.2)
46
+ rails-html-sanitizer (~> 1.6)
47
+ actiontext (7.1.3)
48
+ actionpack (= 7.1.3)
49
+ activerecord (= 7.1.3)
50
+ activestorage (= 7.1.3)
51
+ activesupport (= 7.1.3)
52
+ globalid (>= 0.6.0)
53
+ nokogiri (>= 1.8.5)
54
+ actionview (7.1.3)
55
+ activesupport (= 7.1.3)
56
+ builder (~> 3.1)
57
+ erubi (~> 1.11)
58
+ rails-dom-testing (~> 2.2)
59
+ rails-html-sanitizer (~> 1.6)
60
+ activejob (7.1.3)
61
+ activesupport (= 7.1.3)
62
+ globalid (>= 0.3.6)
63
+ activemodel (7.1.3)
64
+ activesupport (= 7.1.3)
65
+ activerecord (7.1.3)
66
+ activemodel (= 7.1.3)
67
+ activesupport (= 7.1.3)
68
+ timeout (>= 0.4.0)
69
+ activestorage (7.1.3)
70
+ actionpack (= 7.1.3)
71
+ activejob (= 7.1.3)
72
+ activerecord (= 7.1.3)
73
+ activesupport (= 7.1.3)
74
+ marcel (~> 1.0)
75
+ activesupport (7.1.3)
76
+ base64
77
+ bigdecimal
78
+ concurrent-ruby (~> 1.0, >= 1.0.2)
79
+ connection_pool (>= 2.2.5)
80
+ drb
81
+ i18n (>= 1.6, < 2)
82
+ minitest (>= 5.1)
83
+ mutex_m
84
+ tzinfo (~> 2.0)
85
+ ast (2.4.2)
86
+ base64 (0.2.0)
87
+ bigdecimal (3.1.6)
88
+ builder (3.2.4)
89
+ concurrent-ruby (1.2.3)
90
+ connection_pool (2.4.1)
91
+ crass (1.0.6)
92
+ date (3.3.4)
93
+ diff-lcs (1.5.1)
94
+ drb (2.2.0)
95
+ ruby2_keywords
96
+ erubi (1.12.0)
97
+ globalid (1.2.1)
98
+ activesupport (>= 6.1)
99
+ i18n (1.14.1)
100
+ concurrent-ruby (~> 1.0)
101
+ io-console (0.7.2)
102
+ irb (1.11.2)
103
+ rdoc
104
+ reline (>= 0.4.2)
105
+ json (2.7.1)
106
+ language_server-protocol (3.17.0.3)
107
+ loofah (2.22.0)
108
+ crass (~> 1.0.2)
109
+ nokogiri (>= 1.12.0)
110
+ mail (2.8.1)
111
+ mini_mime (>= 0.1.1)
112
+ net-imap
113
+ net-pop
114
+ net-smtp
115
+ marcel (1.0.2)
116
+ mini_mime (1.1.5)
117
+ minitest (5.22.2)
118
+ mutex_m (0.2.0)
119
+ net-imap (0.4.10)
120
+ date
121
+ net-protocol
122
+ net-pop (0.1.2)
123
+ net-protocol
124
+ net-protocol (0.2.2)
125
+ timeout
126
+ net-smtp (0.4.0.1)
127
+ net-protocol
128
+ nio4r (2.7.0)
129
+ nokogiri (1.16.2-arm64-darwin)
130
+ racc (~> 1.4)
131
+ parallel (1.24.0)
132
+ parser (3.3.0.5)
133
+ ast (~> 2.4.1)
134
+ racc
135
+ pastel (0.8.0)
136
+ tty-color (~> 0.5)
137
+ psych (5.1.2)
138
+ stringio
139
+ racc (1.7.3)
140
+ rack (3.0.9)
141
+ rack-session (2.0.0)
142
+ rack (>= 3.0.0)
143
+ rack-test (2.1.0)
144
+ rack (>= 1.3)
145
+ rackup (2.1.0)
146
+ rack (>= 3)
147
+ webrick (~> 1.8)
148
+ rails (7.1.3)
149
+ actioncable (= 7.1.3)
150
+ actionmailbox (= 7.1.3)
151
+ actionmailer (= 7.1.3)
152
+ actionpack (= 7.1.3)
153
+ actiontext (= 7.1.3)
154
+ actionview (= 7.1.3)
155
+ activejob (= 7.1.3)
156
+ activemodel (= 7.1.3)
157
+ activerecord (= 7.1.3)
158
+ activestorage (= 7.1.3)
159
+ activesupport (= 7.1.3)
160
+ bundler (>= 1.15.0)
161
+ railties (= 7.1.3)
162
+ rails-dom-testing (2.2.0)
163
+ activesupport (>= 5.0.0)
164
+ minitest
165
+ nokogiri (>= 1.6)
166
+ rails-html-sanitizer (1.6.0)
167
+ loofah (~> 2.21)
168
+ nokogiri (~> 1.14)
169
+ railties (7.1.3)
170
+ actionpack (= 7.1.3)
171
+ activesupport (= 7.1.3)
172
+ irb
173
+ rackup (>= 1.0.0)
174
+ rake (>= 12.2)
175
+ thor (~> 1.0, >= 1.2.2)
176
+ zeitwerk (~> 2.6)
177
+ rainbow (3.1.1)
178
+ rake (13.1.0)
179
+ rdoc (6.6.2)
180
+ psych (>= 4.0.0)
181
+ regexp_parser (2.9.0)
182
+ reline (0.4.2)
183
+ io-console (~> 0.5)
184
+ rexml (3.2.6)
185
+ rspec (3.13.0)
186
+ rspec-core (~> 3.13.0)
187
+ rspec-expectations (~> 3.13.0)
188
+ rspec-mocks (~> 3.13.0)
189
+ rspec-core (3.13.0)
190
+ rspec-support (~> 3.13.0)
191
+ rspec-expectations (3.13.0)
192
+ diff-lcs (>= 1.2.0, < 2.0)
193
+ rspec-support (~> 3.13.0)
194
+ rspec-mocks (3.13.0)
195
+ diff-lcs (>= 1.2.0, < 2.0)
196
+ rspec-support (~> 3.13.0)
197
+ rspec-support (3.13.0)
198
+ rubocop (1.60.2)
199
+ json (~> 2.3)
200
+ language_server-protocol (>= 3.17.0)
201
+ parallel (~> 1.10)
202
+ parser (>= 3.3.0.2)
203
+ rainbow (>= 2.2.2, < 4.0)
204
+ regexp_parser (>= 1.8, < 3.0)
205
+ rexml (>= 3.2.5, < 4.0)
206
+ rubocop-ast (>= 1.30.0, < 2.0)
207
+ ruby-progressbar (~> 1.7)
208
+ unicode-display_width (>= 2.4.0, < 3.0)
209
+ rubocop-ast (1.30.0)
210
+ parser (>= 3.2.1.0)
211
+ ruby-progressbar (1.13.0)
212
+ ruby2_keywords (0.0.5)
213
+ stringio (3.1.0)
214
+ thor (1.3.0)
215
+ timeout (0.4.1)
216
+ tty-color (0.6.0)
217
+ tty-cursor (0.7.1)
218
+ tty-prompt (0.23.1)
219
+ pastel (~> 0.8)
220
+ tty-reader (~> 0.8)
221
+ tty-reader (0.9.0)
222
+ tty-cursor (~> 0.7)
223
+ tty-screen (~> 0.8)
224
+ wisper (~> 2.0)
225
+ tty-screen (0.8.2)
226
+ tzinfo (2.0.6)
227
+ concurrent-ruby (~> 1.0)
228
+ unicode-display_width (2.5.0)
229
+ webrick (1.8.1)
230
+ websocket-driver (0.7.6)
231
+ websocket-extensions (>= 0.1.0)
232
+ websocket-extensions (0.1.5)
233
+ wisper (2.0.1)
234
+ zeitwerk (2.6.13)
235
+
236
+ PLATFORMS
237
+ arm64-darwin-22
238
+
239
+ DEPENDENCIES
240
+ rails_interactive_generators!
241
+ rake (~> 13.0)
242
+ rspec (~> 3.0)
243
+ rubocop (~> 1.21)
244
+
245
+ BUNDLED WITH
246
+ 2.4.10
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # RailsInteractiveGenerators
2
+
3
+ Rails comes with handy generators and they are rich in features. But to use them you will have to remember the syntax of using them or have to go through documentation. Also these features are upto a certain extent, they have some limitations as well. So mostly generators are underused. For example, generator is used for creating a migration and then developers end up writing code inside it manually.
4
+
5
+ So what if you start a generator and generator asks you questions and provides option to choose from and as per the inputs the code is generated?
6
+ Yes, that's the main idea behind this gem. It run generator in interactive way and generates code.
7
+ Using these generators is also very good for those who are learning Rails newly as you get to use generators interactively
8
+
9
+ ## Installation
10
+
11
+ You can add this line to your application's Gemfile:
12
+ ```
13
+ gem 'rails_interactive_generators', group: :development
14
+ ```
15
+ And then execute:
16
+ ```
17
+ bundle install
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ Using rails interactive generators is very similar to how you use regular rails generators.
23
+
24
+ You can use generator like:
25
+ ```
26
+ rails generate interactive:GENERATOR_NAME
27
+ ```
28
+ and then enjoy easily entering or selecting options interactively to the questions asked on terminal.
29
+
30
+ ## Available Interactive Generators
31
+
32
+ | Functionality | Command |
33
+ |---|---|
34
+ |model|`rails generate interactive:model`|
35
+
36
+ ## Development
37
+
38
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+
40
+ ## Contributing
41
+
42
+ Bug reports, feature requests and pull requests are welcome on GitHub at https://github.com/anandbait/rails_interactive_generators. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/anandbait/rails_interactive_generators/blob/main/CODE_OF_CONDUCT.md).
43
+
44
+ ## Changelog
45
+
46
+ RailsInteractiveGenerators is evolving with the time and awesome contributions. You can find the evolution changelog [here](https://github.com/anandbait/rails_interactive_generators/blob/main/CHANGELOG.md)
47
+
48
+ ## License
49
+
50
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
51
+
52
+ ## Code of Conduct
53
+
54
+ Everyone interacting in the RailsInteractiveGenerators project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/anandbait/rails_interactive_generators/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,16 @@
1
+ Description:
2
+ `interactive:model` will create Model interactively.
3
+
4
+ What will this do?:
5
+ Create new Rails model with configurations selected interactively.
6
+ Current options available to customize are:
7
+ * Model name
8
+ * Specify columns with column type and some other metadata
9
+ * Column metadata includes:
10
+ - limit for integer, string, text, binary
11
+ - precision and scale for decimal
12
+ - polymorphic for references
13
+ - index and unique index
14
+ * Skip creating migration?
15
+ * Skip created_at, updated_at timestamps?
16
+ * Skip indexes?
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Interactive
4
+ class ModelGenerator < Rails::Generators::Base
5
+ desc File.read("#{__dir__}/USAGE")
6
+ source_root File.expand_path("templates", __dir__)
7
+
8
+ def help
9
+ if ['-h', 'help', '--help'].include?(ARGV.last)
10
+ puts File.read("#{__dir__}/USAGE")
11
+ exit
12
+ end
13
+ end
14
+
15
+ def add_model
16
+ say "Starting interactive Model generator", [:bold, :magenta]
17
+ cmd = ["rails #{self.behavior == :invoke ? 'generate' : 'destroy'} model"]
18
+
19
+ model_name = prompt.ask("\nWhat is the great name of your model?", required: true) { |q| q.modify :remove }
20
+ cmd << model_name
21
+
22
+ columns = []
23
+ while prompt.select("\nWould you like to add model attributes(columns)?", boolean_choices)
24
+
25
+ column_name = prompt.ask("Specify name of column:", required: true) { |q| q.modify :remove }
26
+
27
+ column_type = prompt.select("Choose type of column:", %w(references integer decimal float boolean binary string text date time datetime primary_key digest token))
28
+
29
+ if column_type == 'references'
30
+ column_type = "#{column_type}{polymorphic}" if prompt.select("Polymorphic association?", boolean_choices)
31
+ end
32
+ if %w(integer string text binary).include?(column_type)
33
+ if prompt.select("Set limit?", boolean_choices)
34
+ limit = prompt.ask("Specify limit:", required: true) do |q|
35
+ q.modify :remove
36
+ q.convert(:int, "Invalid input! Please provide integer value.")
37
+ end
38
+ column_type = "#{column_type}{#{limit}}"
39
+ end
40
+ end
41
+ if column_type == 'decimal'
42
+ if prompt.select("Set precision & scale?", boolean_choices)
43
+ precision = prompt.ask("Specify precision:", required: true) do |q|
44
+ q.modify :remove
45
+ q.convert(:int, "Invalid input! Please provide integer value.")
46
+ end
47
+ scale = prompt.ask("Specify scale:", required: true) do |q|
48
+ q.modify :remove
49
+ q.convert(:int, "Invalid input! Please provide integer value.")
50
+ end
51
+ column_type = "'#{column_type}{#{precision},#{scale}}'"
52
+ end
53
+ end
54
+
55
+ index_option = nil
56
+ if prompt.select("Add index?", boolean_choices)
57
+ index_option = prompt.select("Unique index?", boolean_choices) ? 'uniq' : 'index'
58
+ end
59
+
60
+ columns << [column_name, column_type, index_option].compact.join(':')
61
+ end
62
+ cmd += columns
63
+
64
+ cmd << "--no-migration" if prompt.select("\nSkip migration?", boolean_choices)
65
+ cmd << "--no-timestamps" if prompt.select("\nSkip created_at, updated_at timestamps?", boolean_choices)
66
+ cmd << "--no-indexes" if prompt.select("\nSkip indexes?", boolean_choices)
67
+ run cmd.join(" ")
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,9 @@
1
+ require 'tty/prompt'
2
+
3
+ def prompt
4
+ TTY::Prompt.new
5
+ end
6
+
7
+ def boolean_choices
8
+ [{name: "yes", value: true}, {name: "no", value: false}]
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsInteractiveGenerators
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rails_interactive_generators/version"
4
+ require_relative 'rails_interactive_generators/interactive_generator_helper'
5
+
6
+ module RailsInteractiveGenerators
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
@@ -0,0 +1,4 @@
1
+ module RailsInteractiveGenerators
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_interactive_generators
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Anand Bait
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-02-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: tty-prompt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.21'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.21'
83
+ description: This gem provides rails default generators in interactive mode so as
84
+ to ease development. These interactive generators will also have some additional
85
+ functionalities which are not available in default generators. This gem is actually
86
+ a side product of gem rails_steroids
87
+ email:
88
+ - anandbait@gmail.com
89
+ executables: []
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - ".rspec"
94
+ - ".rubocop.yml"
95
+ - CHANGELOG.md
96
+ - CODE_OF_CONDUCT.md
97
+ - Gemfile
98
+ - Gemfile.lock
99
+ - LICENSE.txt
100
+ - README.md
101
+ - Rakefile
102
+ - lib/generators/interactive/model/USAGE
103
+ - lib/generators/interactive/model/model_generator.rb
104
+ - lib/rails_interactive_generators.rb
105
+ - lib/rails_interactive_generators/interactive_generator_helper.rb
106
+ - lib/rails_interactive_generators/version.rb
107
+ - sig/rails_interactive_generators.rbs
108
+ homepage: https://github.com/anandbait/rails_interactive_generators
109
+ licenses:
110
+ - MIT
111
+ metadata:
112
+ homepage_uri: https://github.com/anandbait/rails_interactive_generators
113
+ source_code_uri: https://github.com/anandbait/rails_interactive_generators
114
+ changelog_uri: https://github.com/anandbait/rails_interactive_generators/blob/main/CHANGELOG.md
115
+ post_install_message: Life is awesome when you interact! Keep interacting!!!
116
+ rdoc_options: []
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: 2.6.0
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ requirements: []
130
+ rubygems_version: 3.4.10
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: This gem provides rails default generators in interactive mode so as to ease
134
+ development.
135
+ test_files: []