rails_steroids 0.1.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2555fe6d42a3963553ceba0e1ef9b466985abe50ea9c787833ba43caea144df
4
- data.tar.gz: d2ba659d646e05b6e99a66ec5b353823a1ba0cd9c503ea0aea6951eeb6225d37
3
+ metadata.gz: 9f5e93f888c24de4450bf54d2a25c44513f6fddd8317fb30146b59747f48618d
4
+ data.tar.gz: f79e2908e77ac7d91b2b1a9b958b822174cb689059186c37f4218ba7fe167291
5
5
  SHA512:
6
- metadata.gz: 36b3f7518d7ba5ca3d87e8ed55f9f44434b78e6ebddce6cc132c81bfb641d18c526ec92c34c1810ebae91ee847a7183a094a7eda6b7851388fedaed04dbfc778
7
- data.tar.gz: 6950a24fa5226da5fc959ab2fe99961a169ed21fbfafea2d690b124dde00802857d3f28c357f101942a0cc893448239fca51d26266b52806731dc2112ac30bcf
6
+ metadata.gz: ee6ab8134d86c2656fbcaddc5a22c47fb3b15c63681b9e50e6de95e119d8d65fda59a4ac938bb210763fe3f0219f9c882de17863b69dbb40ce81fdc53cc03ef6
7
+ data.tar.gz: 1eb85242e872a6c98112dd25f8e8a9668bed939e617476b5810751f61048faf6b31564f244757dcc0d35cdd2b7a397a3633fe13cef652f03a19496a60f0e1308
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2024-02-05
4
+
5
+ - Improvement in steroid recipe new_project : Use of TTY-prompt for better interaction
6
+
7
+ ## [0.2.0] - 2024-02-04
8
+
9
+ - New steroid recipe: new_project (create new Rails project interactively)
10
+
3
11
  ## [0.1.0] - 2024-01-28
4
12
 
5
13
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,10 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_steroids (0.1.0)
4
+ rails_steroids (0.2.0)
5
5
  rails
6
- railties
7
- thor
6
+ tty-prompt
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
@@ -135,6 +134,8 @@ GEM
135
134
  parser (3.3.0.5)
136
135
  ast (~> 2.4.1)
137
136
  racc
137
+ pastel (0.8.0)
138
+ tty-color (~> 0.5)
138
139
  psych (5.1.2)
139
140
  stringio
140
141
  racc (1.7.3)
@@ -214,6 +215,16 @@ GEM
214
215
  stringio (3.1.0)
215
216
  thor (1.3.0)
216
217
  timeout (0.4.1)
218
+ tty-color (0.6.0)
219
+ tty-cursor (0.7.1)
220
+ tty-prompt (0.23.1)
221
+ pastel (~> 0.8)
222
+ tty-reader (~> 0.8)
223
+ tty-reader (0.9.0)
224
+ tty-cursor (~> 0.7)
225
+ tty-screen (~> 0.8)
226
+ wisper (~> 2.0)
227
+ tty-screen (0.8.2)
217
228
  tzinfo (2.0.6)
218
229
  concurrent-ruby (~> 1.0)
219
230
  unicode-display_width (2.5.0)
@@ -221,6 +232,7 @@ GEM
221
232
  websocket-driver (0.7.6)
222
233
  websocket-extensions (>= 0.1.0)
223
234
  websocket-extensions (0.1.5)
235
+ wisper (2.0.1)
224
236
  zeitwerk (2.6.12)
225
237
 
226
238
  PLATFORMS
data/README.md CHANGED
@@ -47,6 +47,7 @@ rails_steroids list
47
47
 
48
48
  | Functionality | Command |
49
49
  |---|---|
50
+ |new_project|`rails_steroids inject steroid:new_project`|
50
51
 
51
52
  ## Development
52
53
 
@@ -0,0 +1,26 @@
1
+ Description:
2
+ `steroid:new_project` will inject New Project functionality.
3
+
4
+ Usage Example:
5
+ # with installed gem
6
+ rails_steroids inject steroid:new_project
7
+ # with bundler
8
+ bin/rails g steroid:new_project
9
+
10
+ What will this do?:
11
+ Create new Rails application with configurations selected interactively.
12
+ Current options available to customize are:
13
+ * Ruby version
14
+ * Rails version
15
+ * Database: mysql, trilogy, postgresql, sqlite3, oracle, sqlserver, jdbcmysql, jdbcsqlite3, jdbcpostgresql, jdbc
16
+ * Asset Pipeline: sprockets, propshaft
17
+ * CSS Processor: tailwind, bootstrap, bulma, postcss, sass
18
+ * Javascript Approach: importmap, bun, webpack, esbuild, rollup
19
+ * API only mode
20
+ * Skip Jbuilder
21
+ * Skip git init, .gitignore and .gitattributes
22
+ * Skip Dockerfile, .dockerignore and bin/docker-entrypoint
23
+ * Skip Action Cable files
24
+ * Skip Hotwire integration
25
+ * Skip test files
26
+ * Skip system test files
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tty/prompt'
4
+
5
+ module Steroid
6
+ class NewProjectGenerator < Rails::Generators::Base
7
+ desc "Adds New Project to the application"
8
+ source_root File.expand_path("templates", __dir__)
9
+
10
+ def add_new_project
11
+ say "Injecting steroid: New Project"
12
+ prompt = TTY::Prompt.new
13
+ project_name = prompt.ask("What is the great name of your Rails project?") do |q|
14
+ q.required true
15
+ q.modify :remove
16
+ end
17
+ empty_directory project_name
18
+
19
+ ruby_version = prompt.ask("Which Ruby version would you like to use?") do |q|
20
+ q.required true
21
+ q.modify :remove
22
+ end
23
+ create_file "#{project_name}/.ruby-version" do
24
+ ruby_version
25
+ end
26
+
27
+ cmd = ["rails"]
28
+ current_rails_version = `rails --version`.gsub('Rails ', '').strip
29
+ rails_version = prompt.ask("Which Rails version would you like to use? You can find Rails version from https://rubygems.org/gems/rails/versions.", default: current_rails_version)
30
+ cmd << "_#{rails_version}_"
31
+ cmd << "new"
32
+ cmd << project_name
33
+
34
+ database_options = %w(mysql trilogy postgresql sqlite3 oracle sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc)
35
+ database_name = prompt.select("Choose your database:", database_options)
36
+ cmd << "--database #{database_name}"
37
+
38
+ asset_pipeline = prompt.select("Choose your asset pipeline:", %w(sprockets propshaft))
39
+ cmd << "--asset-pipeline #{asset_pipeline}"
40
+
41
+ css = prompt.select("Choose CSS processor:", %w(tailwind bootstrap bulma postcss sass))
42
+ cmd << "--css #{css}"
43
+
44
+ js = prompt.select("Choose JavaScript approach:", %w(importmap bun webpack esbuild rollup))
45
+ cmd << "--javascript #{js}"
46
+
47
+ boolean_choices = choices = [{name: "yes", value: true}, {name: "no", value: false}]
48
+ cmd << "--api" if prompt.select("API only application?", choices)
49
+ cmd << "--skip-jbuilder" if prompt.select("Skip jbuilder?", choices)
50
+ cmd << "--skip-git" if prompt.select("Skip git init, .gitignore and .gitattributes?", choices)
51
+ cmd << "--skip-docker" if prompt.select("Skip Dockerfile, .dockerignore and bin/docker-entrypoint?", choices)
52
+ cmd << "--skip-action-cable" if prompt.select("Skip Action Cable files?", choices)
53
+ cmd << "--skip-hotwire" if prompt.select("Skip Hotwire integration?", choices)
54
+ cmd << "--skip-test" if prompt.select("Skip test files?", choices)
55
+ cmd << "--skip-system-test" if prompt.select("Skip system test files?", choices)
56
+ cmd << "--no-rc"
57
+ run cmd.join(" ")
58
+ end
59
+ end
60
+ end
@@ -6,12 +6,12 @@ class SteroidGenerator < Rails::Generators::NamedBase
6
6
  # frozen_string_literal: true
7
7
 
8
8
  module Steroid
9
- class #{name.titlecase}Generator < Rails::Generators::Base
9
+ class #{name.camelize}Generator < Rails::Generators::Base
10
10
  desc "Adds #{name.titlecase} to the application"
11
11
  source_root File.expand_path("templates", __dir__)
12
12
 
13
13
  def add_#{name}
14
- say "Injecting steroid: #{name.titlecase}"
14
+ say "Injecting steroid: #{name.titlecase}", :green
15
15
  # Add your other code here or any additional methods below this method
16
16
  end
17
17
  end
@@ -25,6 +25,7 @@ module RailsSteroids
25
25
  puts "| Functionality | Command |"
26
26
  puts "|---|---|"
27
27
  steroid_names = [
28
+ 'new_project',
28
29
  ]
29
30
  steroid_names.each do |steroid|
30
31
  puts "|#{steroid.titlecase}|`rails_steroids inject steroid:#{steroid}`|"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsSteroids
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,31 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_steroids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anand Bait
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-30 00:00:00.000000000 Z
11
+ date: 2024-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
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
14
+ name: rails
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
@@ -39,7 +25,7 @@ dependencies:
39
25
  - !ruby/object:Gem::Version
40
26
  version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
- name: rails
28
+ name: tty-prompt
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ">="
@@ -118,6 +104,8 @@ files:
118
104
  - bin/console
119
105
  - bin/rails_steroids
120
106
  - bin/setup
107
+ - lib/generators/steroid/new_project/USAGE
108
+ - lib/generators/steroid/new_project/new_project_generator.rb
121
109
  - lib/generators/steroid/steroid_generator.rb
122
110
  - lib/rails_steroids.rb
123
111
  - lib/rails_steroids/cli.rb