rails_steroids 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f2555fe6d42a3963553ceba0e1ef9b466985abe50ea9c787833ba43caea144df
4
+ data.tar.gz: d2ba659d646e05b6e99a66ec5b353823a1ba0cd9c503ea0aea6951eeb6225d37
5
+ SHA512:
6
+ metadata.gz: 36b3f7518d7ba5ca3d87e8ed55f9f44434b78e6ebddce6cc132c81bfb641d18c526ec92c34c1810ebae91ee847a7183a094a7eda6b7851388fedaed04dbfc778
7
+ data.tar.gz: 6950a24fa5226da5fc959ab2fe99961a169ed21fbfafea2d690b124dde00802857d3f28c357f101942a0cc893448239fca51d26266b52806731dc2112ac30bcf
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,7 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-01-28
4
+
5
+ - Initial release
6
+ - Support for CLI to inject steroid into your application
7
+ - Support for steroid generator to prepare new steroid recipe
@@ -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_steroids.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,237 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rails_steroids (0.1.0)
5
+ rails
6
+ railties
7
+ thor
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (7.1.3)
13
+ actionpack (= 7.1.3)
14
+ activesupport (= 7.1.3)
15
+ nio4r (~> 2.0)
16
+ websocket-driver (>= 0.6.1)
17
+ zeitwerk (~> 2.6)
18
+ actionmailbox (7.1.3)
19
+ actionpack (= 7.1.3)
20
+ activejob (= 7.1.3)
21
+ activerecord (= 7.1.3)
22
+ activestorage (= 7.1.3)
23
+ activesupport (= 7.1.3)
24
+ mail (>= 2.7.1)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ actionmailer (7.1.3)
29
+ actionpack (= 7.1.3)
30
+ actionview (= 7.1.3)
31
+ activejob (= 7.1.3)
32
+ activesupport (= 7.1.3)
33
+ mail (~> 2.5, >= 2.5.4)
34
+ net-imap
35
+ net-pop
36
+ net-smtp
37
+ rails-dom-testing (~> 2.2)
38
+ actionpack (7.1.3)
39
+ actionview (= 7.1.3)
40
+ activesupport (= 7.1.3)
41
+ nokogiri (>= 1.8.5)
42
+ racc
43
+ rack (>= 2.2.4)
44
+ rack-session (>= 1.0.1)
45
+ rack-test (>= 0.6.3)
46
+ rails-dom-testing (~> 2.2)
47
+ rails-html-sanitizer (~> 1.6)
48
+ actiontext (7.1.3)
49
+ actionpack (= 7.1.3)
50
+ activerecord (= 7.1.3)
51
+ activestorage (= 7.1.3)
52
+ activesupport (= 7.1.3)
53
+ globalid (>= 0.6.0)
54
+ nokogiri (>= 1.8.5)
55
+ actionview (7.1.3)
56
+ activesupport (= 7.1.3)
57
+ builder (~> 3.1)
58
+ erubi (~> 1.11)
59
+ rails-dom-testing (~> 2.2)
60
+ rails-html-sanitizer (~> 1.6)
61
+ activejob (7.1.3)
62
+ activesupport (= 7.1.3)
63
+ globalid (>= 0.3.6)
64
+ activemodel (7.1.3)
65
+ activesupport (= 7.1.3)
66
+ activerecord (7.1.3)
67
+ activemodel (= 7.1.3)
68
+ activesupport (= 7.1.3)
69
+ timeout (>= 0.4.0)
70
+ activestorage (7.1.3)
71
+ actionpack (= 7.1.3)
72
+ activejob (= 7.1.3)
73
+ activerecord (= 7.1.3)
74
+ activesupport (= 7.1.3)
75
+ marcel (~> 1.0)
76
+ activesupport (7.1.3)
77
+ base64
78
+ bigdecimal
79
+ concurrent-ruby (~> 1.0, >= 1.0.2)
80
+ connection_pool (>= 2.2.5)
81
+ drb
82
+ i18n (>= 1.6, < 2)
83
+ minitest (>= 5.1)
84
+ mutex_m
85
+ tzinfo (~> 2.0)
86
+ ast (2.4.2)
87
+ base64 (0.2.0)
88
+ bigdecimal (3.1.6)
89
+ builder (3.2.4)
90
+ concurrent-ruby (1.2.3)
91
+ connection_pool (2.4.1)
92
+ crass (1.0.6)
93
+ date (3.3.4)
94
+ diff-lcs (1.5.0)
95
+ drb (2.2.0)
96
+ ruby2_keywords
97
+ erubi (1.12.0)
98
+ globalid (1.2.1)
99
+ activesupport (>= 6.1)
100
+ i18n (1.14.1)
101
+ concurrent-ruby (~> 1.0)
102
+ io-console (0.7.2)
103
+ irb (1.11.1)
104
+ rdoc
105
+ reline (>= 0.4.2)
106
+ json (2.7.1)
107
+ language_server-protocol (3.17.0.3)
108
+ loofah (2.22.0)
109
+ crass (~> 1.0.2)
110
+ nokogiri (>= 1.12.0)
111
+ mail (2.8.1)
112
+ mini_mime (>= 0.1.1)
113
+ net-imap
114
+ net-pop
115
+ net-smtp
116
+ marcel (1.0.2)
117
+ mini_mime (1.1.5)
118
+ minitest (5.21.2)
119
+ mutex_m (0.2.0)
120
+ net-imap (0.4.9.1)
121
+ date
122
+ net-protocol
123
+ net-pop (0.1.2)
124
+ net-protocol
125
+ net-protocol (0.2.2)
126
+ timeout
127
+ net-smtp (0.4.0.1)
128
+ net-protocol
129
+ nio4r (2.7.0)
130
+ nokogiri (1.16.0-arm64-darwin)
131
+ racc (~> 1.4)
132
+ nokogiri (1.16.0-x86_64-linux)
133
+ racc (~> 1.4)
134
+ parallel (1.24.0)
135
+ parser (3.3.0.5)
136
+ ast (~> 2.4.1)
137
+ racc
138
+ psych (5.1.2)
139
+ stringio
140
+ racc (1.7.3)
141
+ rack (3.0.8)
142
+ rack-session (2.0.0)
143
+ rack (>= 3.0.0)
144
+ rack-test (2.1.0)
145
+ rack (>= 1.3)
146
+ rackup (2.1.0)
147
+ rack (>= 3)
148
+ webrick (~> 1.8)
149
+ rails (7.1.3)
150
+ actioncable (= 7.1.3)
151
+ actionmailbox (= 7.1.3)
152
+ actionmailer (= 7.1.3)
153
+ actionpack (= 7.1.3)
154
+ actiontext (= 7.1.3)
155
+ actionview (= 7.1.3)
156
+ activejob (= 7.1.3)
157
+ activemodel (= 7.1.3)
158
+ activerecord (= 7.1.3)
159
+ activestorage (= 7.1.3)
160
+ activesupport (= 7.1.3)
161
+ bundler (>= 1.15.0)
162
+ railties (= 7.1.3)
163
+ rails-dom-testing (2.2.0)
164
+ activesupport (>= 5.0.0)
165
+ minitest
166
+ nokogiri (>= 1.6)
167
+ rails-html-sanitizer (1.6.0)
168
+ loofah (~> 2.21)
169
+ nokogiri (~> 1.14)
170
+ railties (7.1.3)
171
+ actionpack (= 7.1.3)
172
+ activesupport (= 7.1.3)
173
+ irb
174
+ rackup (>= 1.0.0)
175
+ rake (>= 12.2)
176
+ thor (~> 1.0, >= 1.2.2)
177
+ zeitwerk (~> 2.6)
178
+ rainbow (3.1.1)
179
+ rake (13.1.0)
180
+ rdoc (6.6.2)
181
+ psych (>= 4.0.0)
182
+ regexp_parser (2.9.0)
183
+ reline (0.4.2)
184
+ io-console (~> 0.5)
185
+ rexml (3.2.6)
186
+ rspec (3.12.0)
187
+ rspec-core (~> 3.12.0)
188
+ rspec-expectations (~> 3.12.0)
189
+ rspec-mocks (~> 3.12.0)
190
+ rspec-core (3.12.2)
191
+ rspec-support (~> 3.12.0)
192
+ rspec-expectations (3.12.3)
193
+ diff-lcs (>= 1.2.0, < 2.0)
194
+ rspec-support (~> 3.12.0)
195
+ rspec-mocks (3.12.6)
196
+ diff-lcs (>= 1.2.0, < 2.0)
197
+ rspec-support (~> 3.12.0)
198
+ rspec-support (3.12.1)
199
+ rubocop (1.60.2)
200
+ json (~> 2.3)
201
+ language_server-protocol (>= 3.17.0)
202
+ parallel (~> 1.10)
203
+ parser (>= 3.3.0.2)
204
+ rainbow (>= 2.2.2, < 4.0)
205
+ regexp_parser (>= 1.8, < 3.0)
206
+ rexml (>= 3.2.5, < 4.0)
207
+ rubocop-ast (>= 1.30.0, < 2.0)
208
+ ruby-progressbar (~> 1.7)
209
+ unicode-display_width (>= 2.4.0, < 3.0)
210
+ rubocop-ast (1.30.0)
211
+ parser (>= 3.2.1.0)
212
+ ruby-progressbar (1.13.0)
213
+ ruby2_keywords (0.0.5)
214
+ stringio (3.1.0)
215
+ thor (1.3.0)
216
+ timeout (0.4.1)
217
+ tzinfo (2.0.6)
218
+ concurrent-ruby (~> 1.0)
219
+ unicode-display_width (2.5.0)
220
+ webrick (1.8.1)
221
+ websocket-driver (0.7.6)
222
+ websocket-extensions (>= 0.1.0)
223
+ websocket-extensions (0.1.5)
224
+ zeitwerk (2.6.12)
225
+
226
+ PLATFORMS
227
+ arm64-darwin-22
228
+ x86_64-linux
229
+
230
+ DEPENDENCIES
231
+ rails_steroids!
232
+ rake (~> 13.0)
233
+ rspec (~> 3.0)
234
+ rubocop (~> 1.21)
235
+
236
+ BUNDLED WITH
237
+ 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,80 @@
1
+ ---
2
+ ____ _ __ _____ __ _ __
3
+ / __ \____ _(_) /____ / ___// /____ _________ (_)___/ /____
4
+ / /_/ / __ `/ / / ___/ \__ \/ __/ _ \/ ___/ __ \/ / __ / ___/
5
+ / _, _/ /_/ / / (__ ) ___/ / /_/ __/ / / /_/ / / /_/ (__ )
6
+ /_/ |_|\__,_/_/_/____/ /____/\__/\___/_/ \____/_/\__,_/____/
7
+
8
+ ---
9
+
10
+ # RailsSteroids
11
+
12
+ Any small idea evolves when it actually starts taking shape. But most of the time, when we think of developing an idea as a POC or hobby project, we end up spending more time in setting up the project and lose the momentum. And you must have realised that many tasks that we do with a new project from scratch are quite repetitive.
13
+
14
+ Rails templates and other templating gems are a way of quickly generating an application but when it comes to adding some features in an already generated application then we need some way to do that. We have certain inbuilt generators which can be used for basic components but they need more coding over it.
15
+
16
+ So here are steroids for your application, which are actually generators with special powers. This gem contains different steroids which will setup commonly used features very quickly and reduce your coding work so that you can focus on your precious idea.
17
+
18
+ ## Installation
19
+
20
+ You can add this line to your application's Gemfile:
21
+ ```
22
+ gem 'rails_steroids', group: :development
23
+ ```
24
+ And then execute:
25
+ ```
26
+ bundle install
27
+ ```
28
+ Or the best way is to install the gem by executing:
29
+ ```
30
+ gem install rails_steroids
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ You can use the gem from command line using gem's CLI.
36
+ You can inject the steroid into your application using command like:
37
+ ```
38
+ rails_steroids inject steroid:STEROID_NAME
39
+ ```
40
+
41
+ You can check the list of available steroids using command:
42
+ ```
43
+ rails_steroids list
44
+ ```
45
+
46
+ ## Available Steroids
47
+
48
+ | Functionality | Command |
49
+ |---|---|
50
+
51
+ ## Development
52
+
53
+ 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.
54
+
55
+ ### How to develop a new steroid recipe?
56
+
57
+ The gem comes with a handy tool to scaffold a new steroid.
58
+ You can run `bin/rails_steroids prepare STEROID_NAME`
59
+ This will create a new directory `STEROID_NAME` inside `lib/generators/steroid` containing empty `templates` directory, a `STEROID_NAME_generator.rb` and a `USAGE` file.
60
+ It will also make an entry into `README.md` and array in list method.
61
+
62
+ To install this gem onto your local machine, run `bundle exec rake install`.
63
+
64
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
65
+
66
+ ## Contributing
67
+
68
+ Bug reports, feature requests and pull requests are welcome on GitHub at https://github.com/anandbait/rails_steroids. 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_steroids/blob/main/CODE_OF_CONDUCT.md).
69
+
70
+ ## Changelog
71
+
72
+ RailsSteroids is evolving with the time and awesome contributions. You can find the evolution changelog [here](https://github.com/anandbait/rails_steroids/blob/main/CHANGELOG.md)
73
+
74
+ ## License
75
+
76
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
77
+
78
+ ## Code of Conduct
79
+
80
+ Everyone interacting in the RailsSteroids project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/anandbait/rails_steroids/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]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "rails_steroids"
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__)
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ banner = <<-BANNER
4
+ ____ _ __ _____ __ _ __
5
+ / __ \____ _(_) /____ / ___// /____ _________ (_)___/ /____
6
+ / /_/ / __ `/ / / ___/ \__ \/ __/ _ \/ ___/ __ \/ / __ / ___/
7
+ / _, _/ /_/ / / (__ ) ___/ / /_/ __/ / / /_/ / / /_/ (__ )
8
+ /_/ |_|\__,_/_/_/____/ /____/\__/\___/_/ \____/_/\__,_/____/
9
+ BANNER
10
+
11
+ puts banner
12
+
13
+ File.expand_path("../lib", __dir__).tap do |lib|
14
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
15
+ end
16
+
17
+ require "rails_steroids/cli"
18
+
19
+ RailsSteroids::CLI.start(ARGV)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,47 @@
1
+ class SteroidGenerator < Rails::Generators::NamedBase
2
+
3
+ def create_steroid_generator_file
4
+ say "Preparing steroid for #{name.titlecase}", :green
5
+ create_file "lib/generators/steroid/#{name}/#{name}_generator.rb", <<~RUBY
6
+ # frozen_string_literal: true
7
+
8
+ module Steroid
9
+ class #{name.titlecase}Generator < Rails::Generators::Base
10
+ desc "Adds #{name.titlecase} to the application"
11
+ source_root File.expand_path("templates", __dir__)
12
+
13
+ def add_#{name}
14
+ say "Injecting steroid: #{name.titlecase}"
15
+ # Add your other code here or any additional methods below this method
16
+ end
17
+ end
18
+ end
19
+ RUBY
20
+ end
21
+
22
+ def create_steroid_templates_directory
23
+ empty_directory("lib/generators/steroid/#{name}/templates")
24
+ end
25
+
26
+ def create_usage_file
27
+ create_file "lib/generators/steroid/#{name}/USAGE", <<~RUBY
28
+ Description:
29
+ `steroid:#{name}` will inject #{name.titlecase} functionality.
30
+
31
+ Usage Example:
32
+ # with installed gem
33
+ rails_steroids inject steroid:#{name}
34
+ # with bundler
35
+ bin/rails g steroid:#{name}
36
+
37
+ This will create:
38
+ what/will/it/create
39
+ RUBY
40
+ end
41
+
42
+ def create_entry_in_steroids_list
43
+ insert_into_file 'lib/rails_steroids/cli.rb', " '#{name}',\n ", after: "steroid_names = [\n "
44
+ insert_into_file 'README.md', "|#{name}|`rails_steroids inject steroid:#{name}`|\n", after: "|---|---|\n"
45
+ end
46
+
47
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+ require "thor"
5
+ require_relative "../rails_steroids"
6
+
7
+ module RailsSteroids
8
+ class CLI < Thor
9
+ map %w(--version -v) => :version
10
+
11
+ desc "inject STEROID [options]", "Add steroid into the application"
12
+ def inject(generator, *options)
13
+ require_relative generator_file_path(generator)
14
+ Rails::Generators.invoke(generator, options)
15
+ end
16
+
17
+ desc "prepare STEROID", "Scaffolds steroid template for developing a new steroid recipe"
18
+ def prepare(steroid)
19
+ Rails::Generators.invoke('steroid', [steroid])
20
+ end
21
+
22
+ desc "list", "Print list of steroids"
23
+ def list
24
+ puts "RailsSteroids list"
25
+ puts "| Functionality | Command |"
26
+ puts "|---|---|"
27
+ steroid_names = [
28
+ ]
29
+ steroid_names.each do |steroid|
30
+ puts "|#{steroid.titlecase}|`rails_steroids inject steroid:#{steroid}`|"
31
+ end
32
+ # TODO: Glob all file and prepare a list of available generators
33
+ end
34
+
35
+ desc "--version, -v", "Print gem version"
36
+ def version
37
+ puts "RailsSteroids v#{RailsSteroids::VERSION}"
38
+ end
39
+
40
+ def self.exit_on_failure?
41
+ true
42
+ end
43
+
44
+ private
45
+
46
+ def generator_file_path(generator)
47
+ namespace, generator_name = generator.split(':')
48
+ raise "Invalid steroid!" if namespace != 'steroid'
49
+ "../generators/steroid/#{generator_name}/#{generator_name}_generator.rb"
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsSteroids
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rails_steroids/version"
4
+
5
+ module RailsSteroids
6
+ class Error < StandardError; end
7
+ # Your code goes here...
8
+ end
@@ -0,0 +1,4 @@
1
+ module RailsSteroids
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_steroids
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-01-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
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: thor
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: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.21'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.21'
97
+ description: This gem will be like steroids taken by athletes. It provides some commands
98
+ to quickly implement regularly used features to boost your productivity and speed
99
+ of development.
100
+ email:
101
+ - anandbait@gmail.com
102
+ executables:
103
+ - console
104
+ - rails_steroids
105
+ - setup
106
+ extensions: []
107
+ extra_rdoc_files: []
108
+ files:
109
+ - ".rspec"
110
+ - ".rubocop.yml"
111
+ - CHANGELOG.md
112
+ - CODE_OF_CONDUCT.md
113
+ - Gemfile
114
+ - Gemfile.lock
115
+ - LICENSE.txt
116
+ - README.md
117
+ - Rakefile
118
+ - bin/console
119
+ - bin/rails_steroids
120
+ - bin/setup
121
+ - lib/generators/steroid/steroid_generator.rb
122
+ - lib/rails_steroids.rb
123
+ - lib/rails_steroids/cli.rb
124
+ - lib/rails_steroids/version.rb
125
+ - sig/rails_steroids.rbs
126
+ homepage: https://github.com/anandbait/rails_steroids
127
+ licenses:
128
+ - MIT
129
+ metadata:
130
+ homepage_uri: https://github.com/anandbait/rails_steroids
131
+ source_code_uri: https://github.com/anandbait/rails_steroids
132
+ changelog_uri: https://github.com/anandbait/rails_steroids/CHANGELOG.md
133
+ post_install_message: Feel High! Feel powered!! You are on RAILS-STEROIDS!!!
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: 2.6.0
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubygems_version: 3.4.10
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: This gem provides some commands to quickly implement regularly used features.
152
+ test_files: []