nextgen 0.22.0 → 0.24.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 +4 -4
- data/config/generators.yml +4 -1
- data/config/rails_versions.yml +57 -0
- data/lib/nextgen/commands/create.rb +35 -58
- data/lib/nextgen/generators/dotenv.rb +7 -1
- data/lib/nextgen/generators/vite.rb +2 -1
- data/lib/nextgen/{rails.rb → rails_command.rb} +1 -15
- data/lib/nextgen/rails_options.rb +50 -47
- data/lib/nextgen/rails_version.rb +57 -0
- data/lib/nextgen/version.rb +1 -1
- data/template/.overcommit.yml.tt +2 -0
- data/template/DEPLOYMENT.md +1 -1
- data/template/bin/setup +5 -1
- data/template/lib/tasks/rubocop.rake +3 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e8c4dd4b29b2e8afac9f923b72b56daf86a73e5bae75285b2af1b604ccc45c0
|
4
|
+
data.tar.gz: 8fafac6254aa48ccc290f303e02012d906de34e947f2c32e4f9245e8d34e76d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ee5135257dfcb2096400b1ab15ce501108817606ee30b00bcfb42505106a49a3e0a8fe3fcbbe4543c3d5a01873dada585b3a40861788248b35f44bcf0cabe82
|
7
|
+
data.tar.gz: 0c9ed43018047dabb368c64190fe65136675a622c49735b1b8f156d21915cf977e3449ab57cf89c19ed67f14592a7ac82f4d5743e803f9cc73a081f9a71e634c
|
data/config/generators.yml
CHANGED
@@ -122,7 +122,9 @@ shoulda:
|
|
122
122
|
sidekiq:
|
123
123
|
prompt: "Sidekiq"
|
124
124
|
description: "Install sidekiq gem to use in production"
|
125
|
-
requires:
|
125
|
+
requires:
|
126
|
+
- active_job
|
127
|
+
- skip_solid
|
126
128
|
|
127
129
|
staging:
|
128
130
|
prompt: "Staging environment"
|
@@ -141,6 +143,7 @@ thor:
|
|
141
143
|
tomo:
|
142
144
|
prompt: "Tomo"
|
143
145
|
description: "Install tomo gem for SSH-based deployment"
|
146
|
+
requires: skip_kamal
|
144
147
|
|
145
148
|
vcr:
|
146
149
|
prompt: "VCR"
|
@@ -0,0 +1,57 @@
|
|
1
|
+
current: ¤t
|
2
|
+
args: []
|
3
|
+
label: "%%CURRENT_VERSION%%"
|
4
|
+
asset_pipelines:
|
5
|
+
sprockets: Sprockets (default)
|
6
|
+
propshaft: Propshaft
|
7
|
+
databases:
|
8
|
+
sqlite3: SQLite3 (default)
|
9
|
+
postgresql: PostgreSQL (recommended)
|
10
|
+
mysql: MySQL
|
11
|
+
trilogy: Trilogy
|
12
|
+
oracle: Oracle
|
13
|
+
sqlserver: SQLServer
|
14
|
+
jdbcmysql: JDBCMySQL
|
15
|
+
jdbcsqlite3: JDBCSQLite3
|
16
|
+
jdbcpostgresql: JDBCPostgreSQL
|
17
|
+
jdbc: JDBC
|
18
|
+
default_features:
|
19
|
+
brakeman: Brakeman
|
20
|
+
ci: GitHub Actions CI
|
21
|
+
rubocop: RuboCop
|
22
|
+
optional_features:
|
23
|
+
devcontainer: devcontainer files
|
24
|
+
|
25
|
+
edge:
|
26
|
+
<<: *current
|
27
|
+
args: ["--edge"]
|
28
|
+
label: "edge (7-2-stable)"
|
29
|
+
|
30
|
+
main:
|
31
|
+
args: ["--main"]
|
32
|
+
label: "main (%%MAIN_VERSION%%)"
|
33
|
+
asset_pipelines:
|
34
|
+
propshaft: Propshaft (default)
|
35
|
+
sprockets: Sprockets
|
36
|
+
databases:
|
37
|
+
sqlite3: SQLite3 (default)
|
38
|
+
postgresql: PostgreSQL (recommended)
|
39
|
+
mysql: MySQL
|
40
|
+
trilogy: Trilogy
|
41
|
+
oracle: Oracle
|
42
|
+
sqlserver: SQLServer
|
43
|
+
jdbcmysql: JDBCMySQL
|
44
|
+
jdbcsqlite3: JDBCSQLite3
|
45
|
+
jdbcpostgresql: JDBCPostgreSQL
|
46
|
+
jdbc: JDBC
|
47
|
+
mariadb-mysql: MariaDB-MySQL
|
48
|
+
mariadb-trilogy: MariaDB-Trilogy
|
49
|
+
default_features:
|
50
|
+
brakeman: Brakeman
|
51
|
+
ci: GitHub Actions CI
|
52
|
+
kamal: Kamal
|
53
|
+
rubocop: RuboCop
|
54
|
+
solid: Solid Cache+Queue
|
55
|
+
thruster: Thruster
|
56
|
+
optional_features:
|
57
|
+
devcontainer: devcontainer files
|
@@ -21,7 +21,6 @@ module Nextgen
|
|
21
21
|
def initialize(app_path, _options)
|
22
22
|
@app_path = File.expand_path(app_path)
|
23
23
|
@app_name = File.basename(@app_path).gsub(/\W/, "_").squeeze("_").camelize
|
24
|
-
@rails_opts = RailsOptions.new
|
25
24
|
end
|
26
25
|
|
27
26
|
def run # rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
|
@@ -39,13 +38,15 @@ module Nextgen
|
|
39
38
|
|
40
39
|
continue_if "Ready to start?"
|
41
40
|
|
42
|
-
ask_rails_version
|
41
|
+
rails_version = ask_rails_version
|
42
|
+
@rails_opts = RailsOptions.new(version: rails_version)
|
43
|
+
|
43
44
|
ask_database
|
44
45
|
ask_full_stack_or_api
|
45
46
|
ask_frontend_management unless rails_opts.api?
|
46
47
|
ask_css unless rails_opts.api? || rails_opts.skip_asset_pipeline?
|
47
48
|
ask_javascript unless rails_opts.api? || rails_opts.skip_asset_pipeline?
|
48
|
-
|
49
|
+
ask_rails_features
|
49
50
|
ask_rails_frameworks
|
50
51
|
ask_test_framework
|
51
52
|
ask_system_testing if rails_opts.frontend? && rails_opts.test_framework?
|
@@ -78,9 +79,9 @@ module Nextgen
|
|
78
79
|
|
79
80
|
create_initial_commit_message
|
80
81
|
copy_package_json if node?
|
81
|
-
Nextgen::
|
82
|
+
Nextgen::RailsCommand.run "new", *rails_new_args
|
82
83
|
Dir.chdir(app_path) do
|
83
|
-
Nextgen::
|
84
|
+
Nextgen::RailsCommand.run "app:template", "LOCATION=#{write_generators_script}"
|
84
85
|
end
|
85
86
|
|
86
87
|
say <<~DONE.gsub(/^/, " ")
|
@@ -88,7 +89,7 @@ module Nextgen
|
|
88
89
|
|
89
90
|
#{green("Done!")}
|
90
91
|
|
91
|
-
A Rails #{
|
92
|
+
A Rails #{rails_opts.version_label} app was generated in #{cyan(app_path)}.
|
92
93
|
Run #{yellow("bin/setup")} in that directory to get started.
|
93
94
|
|
94
95
|
|
@@ -118,31 +119,17 @@ module Nextgen
|
|
118
119
|
)
|
119
120
|
end
|
120
121
|
|
121
|
-
def rails_version
|
122
|
-
rails_opts.edge? ? "edge (#{Rails.edge_branch} branch)" : Rails.version
|
123
|
-
end
|
124
|
-
|
125
122
|
def ask_rails_version
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
)
|
131
|
-
rails_opts.edge! if selected == :edge
|
123
|
+
options = %i[current edge main].to_h do |key|
|
124
|
+
version = RailsVersion.public_send(key)
|
125
|
+
[version.label, version]
|
126
|
+
end
|
127
|
+
prompt.select("What version of Rails will you use?", options)
|
132
128
|
end
|
133
129
|
|
134
130
|
def ask_database
|
135
|
-
common_databases =
|
136
|
-
|
137
|
-
"PostgreSQL (recommended)" => "postgresql",
|
138
|
-
"MySQL" => "mysql"
|
139
|
-
}
|
140
|
-
all_databases = common_databases.merge(
|
141
|
-
%w[MySQL Trilogy Oracle SQLServer JDBCMySQL JDBCSQLite3 JDBCPostgreSQL JDBC].to_h do |name|
|
142
|
-
[name, name.downcase]
|
143
|
-
end,
|
144
|
-
"None (disable Active Record)" => nil
|
145
|
-
)
|
131
|
+
common_databases = rails_opts.databases.slice(:sqlite3, :postgresql, :mysql).invert
|
132
|
+
all_databases = rails_opts.databases.invert.merge("None (disable Active Record)" => nil)
|
146
133
|
rails_opts.database =
|
147
134
|
prompt_select("Which database?", common_databases.merge("More options..." => false)) ||
|
148
135
|
prompt_select("Which database?", all_databases)
|
@@ -158,12 +145,8 @@ module Nextgen
|
|
158
145
|
end
|
159
146
|
|
160
147
|
def ask_frontend_management
|
161
|
-
|
162
|
-
|
163
|
-
"Sprockets (default)" => "sprockets",
|
164
|
-
"Propshaft" => "propshaft",
|
165
|
-
"Vite" => :vite
|
166
|
-
)
|
148
|
+
options = rails_opts.asset_pipelines.invert.merge("Vite" => :vite)
|
149
|
+
frontend = prompt_select("How will you manage frontend assets?", options)
|
167
150
|
|
168
151
|
if frontend == :vite
|
169
152
|
rails_opts.vite!
|
@@ -196,15 +179,9 @@ module Nextgen
|
|
196
179
|
)
|
197
180
|
end
|
198
181
|
|
199
|
-
def
|
200
|
-
opt_out =
|
201
|
-
|
202
|
-
"GitHub Actions CI" => "ci",
|
203
|
-
"RuboCop" => "rubocop"
|
204
|
-
}
|
205
|
-
opt_in = {
|
206
|
-
"devcontainer files" => "devcontainer"
|
207
|
-
}
|
182
|
+
def ask_rails_features
|
183
|
+
opt_out = rails_opts.default_features.invert
|
184
|
+
opt_in = rails_opts.optional_features.invert
|
208
185
|
|
209
186
|
answers = prompt.multi_select(
|
210
187
|
"Rails can preinstall the following. Which do you need?",
|
@@ -212,27 +189,27 @@ module Nextgen
|
|
212
189
|
default: opt_out.keys.reverse
|
213
190
|
)
|
214
191
|
|
215
|
-
|
216
|
-
(
|
192
|
+
(opt_out.values - answers).each { rails_opts.skip_default_feature!(_1) }
|
193
|
+
(opt_in.values & answers).each { rails_opts.enable_optional_feature!(_1) }
|
217
194
|
end
|
218
195
|
|
219
196
|
def ask_rails_frameworks
|
220
197
|
frameworks = {
|
221
|
-
"JBuilder" =>
|
222
|
-
"Action Mailer" =>
|
223
|
-
"Active Job" =>
|
224
|
-
"Action Cable" =>
|
198
|
+
"JBuilder" => :jbuilder,
|
199
|
+
"Action Mailer" => :action_mailer,
|
200
|
+
"Active Job" => :active_job,
|
201
|
+
"Action Cable" => :action_cable
|
225
202
|
}
|
226
203
|
|
227
204
|
unless rails_opts.api? || rails_opts.skip_javascript?
|
228
|
-
frameworks = {"Hotwire" =>
|
205
|
+
frameworks = {"Hotwire" => :hotwire}.merge(frameworks)
|
229
206
|
end
|
230
207
|
|
231
208
|
unless rails_opts.skip_active_record?
|
232
209
|
frameworks.merge!(
|
233
|
-
"Active Storage" =>
|
234
|
-
"Action Text" =>
|
235
|
-
"Action Mailbox" =>
|
210
|
+
"Active Storage" => :active_storage,
|
211
|
+
"Action Text" => :action_text,
|
212
|
+
"Action Mailbox" => :action_mailbox
|
236
213
|
)
|
237
214
|
end
|
238
215
|
|
@@ -242,14 +219,14 @@ module Nextgen
|
|
242
219
|
default: frameworks.keys.reverse
|
243
220
|
)
|
244
221
|
|
245
|
-
(frameworks.values - answers).each { rails_opts.
|
222
|
+
(frameworks.values - answers).each { rails_opts.skip_default_feature!(_1) }
|
246
223
|
end
|
247
224
|
|
248
225
|
def ask_test_framework
|
249
226
|
rails_opts.test_framework = prompt_select(
|
250
227
|
"Which test framework will you use?",
|
251
|
-
"Minitest (default)" =>
|
252
|
-
"RSpec" =>
|
228
|
+
"Minitest (default)" => :minitest,
|
229
|
+
"RSpec" => :rspec,
|
253
230
|
"None" => nil
|
254
231
|
)
|
255
232
|
end
|
@@ -277,7 +254,7 @@ module Nextgen
|
|
277
254
|
path = File.join(app_path, "tmp", "initial_nextgen_commit")
|
278
255
|
FileUtils.mkdir_p(File.dirname(path))
|
279
256
|
File.write(path, <<~COMMIT)
|
280
|
-
Init project with `rails new` (#{
|
257
|
+
Init project with `rails new` (#{rails_opts.version_label})
|
281
258
|
|
282
259
|
Nextgen generated this project with the following `rails new` options:
|
283
260
|
|
@@ -289,10 +266,10 @@ module Nextgen
|
|
289
266
|
|
290
267
|
def rails_new_args
|
291
268
|
[app_path, "--no-rc", *rails_opts.to_args].tap do |args|
|
292
|
-
# Work around a Rails bug where --edge
|
269
|
+
# Work around a Rails bug where --edge and --main cause --no-rc to get ignored.
|
293
270
|
# Specifying --rc= with a non-existent file has the same effect as --no-rc.
|
294
271
|
@rc_token ||= SecureRandom.hex(8)
|
295
|
-
args << "--rc=#{@rc_token}" if
|
272
|
+
args << "--rc=#{@rc_token}" if args.intersect?(%w[--edge --main])
|
296
273
|
end
|
297
274
|
end
|
298
275
|
|
@@ -1,5 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
# kamal is incompatible with the latest version of dotenv, so fall back
|
4
|
+
# to using the legacy dotenv-rails gem in that case.
|
5
|
+
if File.read("Gemfile.lock").match?(/\bkamal\b/)
|
6
|
+
install_gem "dotenv-rails", group: %i[development test]
|
7
|
+
else
|
8
|
+
install_gem "dotenv", version: ">= 3.0", group: %i[development test]
|
9
|
+
end
|
4
10
|
copy_file ".env.sample"
|
5
11
|
gitignore "/.env*", "!/.env.sample"
|
@@ -117,7 +117,8 @@ say_git "Remove sprockets"
|
|
117
117
|
remove_file "config/initializers/assets.rb"
|
118
118
|
comment_lines "config/environments/development.rb", /^\s*config\.assets\./
|
119
119
|
comment_lines "config/environments/production.rb", /^\s*config\.assets\./
|
120
|
-
gsub_file "app/views/layouts/application.html.erb", /^.*<%=
|
120
|
+
gsub_file "app/views/layouts/application.html.erb", /^.*<%= javascript_include_tag.*\n/, ""
|
121
|
+
gsub_file "app/views/layouts/application.html.erb", /^.*<%= stylesheet_link_tag.*\n/, ""
|
121
122
|
remove_gem "sprockets-rails"
|
122
123
|
|
123
124
|
if File.exist?(".github/workflows/ci.yml")
|
@@ -1,22 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "rails/version"
|
4
|
-
|
5
3
|
module Nextgen
|
6
|
-
module
|
4
|
+
module RailsCommand
|
7
5
|
class << self
|
8
|
-
def version
|
9
|
-
::Rails.version
|
10
|
-
end
|
11
|
-
|
12
|
-
def edge_branch
|
13
|
-
if version.match?(/[a-z]/i)
|
14
|
-
"main"
|
15
|
-
else
|
16
|
-
version[/^\d+\.\d+/].tr(".", "-") + "-stable"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
6
|
def run(*args, raise_on_error: true)
|
21
7
|
command = "rails", *args
|
22
8
|
say_status :run, *command.join(" ")
|
@@ -1,52 +1,44 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "forwardable"
|
4
|
+
|
3
5
|
module Nextgen
|
4
6
|
class RailsOptions
|
5
|
-
|
6
|
-
postgresql
|
7
|
-
mysql
|
8
|
-
trilogy
|
9
|
-
sqlite3
|
10
|
-
oracle
|
11
|
-
sqlserver
|
12
|
-
jdbcmysql
|
13
|
-
jdbcsqlite3
|
14
|
-
jdbcpostgresql
|
15
|
-
jdbc
|
16
|
-
].freeze
|
17
|
-
|
18
|
-
TEST_FRAMEWORKS = %w[minitest rspec].freeze
|
7
|
+
extend Forwardable
|
19
8
|
|
20
|
-
|
9
|
+
TEST_FRAMEWORKS = %i[minitest rspec].freeze
|
21
10
|
|
22
|
-
|
11
|
+
FRAMEWORKS = %i[
|
23
12
|
action_mailer
|
24
13
|
action_mailbox
|
25
14
|
action_text
|
26
15
|
active_job
|
27
16
|
active_storage
|
28
17
|
action_cable
|
29
|
-
brakeman
|
30
|
-
ci
|
31
18
|
hotwire
|
32
19
|
jbuilder
|
33
|
-
rubocop
|
34
20
|
].freeze
|
35
21
|
|
36
22
|
attr_reader :asset_pipeline, :css, :javascript, :database, :test_framework
|
37
23
|
|
38
|
-
|
24
|
+
def_delegators :version, :asset_pipelines, :databases, :default_features, :optional_features
|
25
|
+
|
26
|
+
def initialize(version:)
|
27
|
+
@version = version
|
39
28
|
@api = false
|
40
|
-
@edge = false
|
41
29
|
@vite = false
|
42
|
-
@
|
30
|
+
@enable_features = []
|
43
31
|
@skip_features = []
|
44
32
|
@skip_system_test = false
|
45
|
-
@test_framework =
|
33
|
+
@test_framework = :minitest
|
34
|
+
end
|
35
|
+
|
36
|
+
def version_label
|
37
|
+
version.label
|
46
38
|
end
|
47
39
|
|
48
40
|
def asset_pipeline=(pipeline)
|
49
|
-
raise ArgumentError, "Unknown asset pipeline: #{pipeline}" unless [nil, *
|
41
|
+
raise ArgumentError, "Unknown asset pipeline: #{pipeline}" unless [nil, *asset_pipelines.keys].include?(pipeline)
|
50
42
|
|
51
43
|
@asset_pipeline = pipeline
|
52
44
|
end
|
@@ -80,7 +72,7 @@ module Nextgen
|
|
80
72
|
end
|
81
73
|
|
82
74
|
def database=(db)
|
83
|
-
raise ArgumentError, "Unknown database: #{db}" unless [nil, *
|
75
|
+
raise ArgumentError, "Unknown database: #{db}" unless [nil, *databases.keys].include?(db)
|
84
76
|
|
85
77
|
@database = db
|
86
78
|
end
|
@@ -99,14 +91,6 @@ module Nextgen
|
|
99
91
|
!!@test_framework
|
100
92
|
end
|
101
93
|
|
102
|
-
def edge!
|
103
|
-
@edge = true
|
104
|
-
end
|
105
|
-
|
106
|
-
def edge?
|
107
|
-
@edge
|
108
|
-
end
|
109
|
-
|
110
94
|
def devcontainer!
|
111
95
|
@devcontainer = true
|
112
96
|
end
|
@@ -131,15 +115,15 @@ module Nextgen
|
|
131
115
|
end
|
132
116
|
|
133
117
|
def minitest?
|
134
|
-
@test_framework ==
|
118
|
+
@test_framework == :minitest
|
135
119
|
end
|
136
120
|
|
137
121
|
def rspec?
|
138
|
-
@test_framework ==
|
122
|
+
@test_framework == :rspec
|
139
123
|
end
|
140
124
|
|
141
125
|
def rubocop?
|
142
|
-
!
|
126
|
+
!skip_default_feature?(:rubocop)
|
143
127
|
end
|
144
128
|
|
145
129
|
def active_record?
|
@@ -163,7 +147,7 @@ module Nextgen
|
|
163
147
|
end
|
164
148
|
|
165
149
|
def skip_test?
|
166
|
-
defined?(@test_framework) && [nil,
|
150
|
+
defined?(@test_framework) && [nil, :rspec].include?(@test_framework)
|
167
151
|
end
|
168
152
|
|
169
153
|
def system_testing?
|
@@ -171,28 +155,43 @@ module Nextgen
|
|
171
155
|
end
|
172
156
|
|
173
157
|
def action_mailer?
|
174
|
-
!
|
158
|
+
!skip_default_feature?(:action_mailer)
|
175
159
|
end
|
176
160
|
|
177
161
|
def active_job?
|
178
|
-
!
|
162
|
+
!skip_default_feature?(:active_job)
|
179
163
|
end
|
180
164
|
|
181
|
-
def
|
182
|
-
|
165
|
+
def skip_kamal?
|
166
|
+
# Depending on the Rails version, kamal may not exist, in which case we can consider it "skipped".
|
167
|
+
!skippable_features.include?(:kamal) || skip_default_feature?(:kamal)
|
168
|
+
end
|
169
|
+
|
170
|
+
def skip_solid?
|
171
|
+
!skippable_features.include?(:solid) || skip_default_feature?(:solid)
|
172
|
+
end
|
173
|
+
|
174
|
+
def enable_optional_feature!(feature)
|
175
|
+
raise ArgumentError, "Unknown feature: #{feature}" unless optional_features.include?(feature)
|
176
|
+
|
177
|
+
enable_features << feature
|
178
|
+
end
|
179
|
+
|
180
|
+
def skip_default_feature!(feature)
|
181
|
+
raise ArgumentError, "Unknown feature: #{feature}" unless skippable_features.include?(feature)
|
183
182
|
|
184
183
|
skip_features << feature
|
185
184
|
end
|
186
185
|
|
187
|
-
def
|
188
|
-
raise ArgumentError, "Unknown feature: #{feature}" unless
|
186
|
+
def skip_default_feature?(feature)
|
187
|
+
raise ArgumentError, "Unknown feature: #{feature}" unless skippable_features.include?(feature)
|
189
188
|
|
190
189
|
skip_features.include?(feature)
|
191
190
|
end
|
192
191
|
|
193
192
|
def to_args # rubocop:disable Metrics/PerceivedComplexity
|
194
193
|
[].tap do |args|
|
195
|
-
args
|
194
|
+
args.push(*version.args)
|
196
195
|
args << "--api" if api?
|
197
196
|
args << "--skip-active-record" if skip_active_record?
|
198
197
|
args << "--skip-asset-pipeline" if skip_asset_pipeline?
|
@@ -203,13 +202,17 @@ module Nextgen
|
|
203
202
|
args << "--database=#{database}" if database
|
204
203
|
args << "--css=#{css}" if css
|
205
204
|
args << "--javascript=#{javascript}" if javascript
|
206
|
-
args
|
207
|
-
args.push(*skip_features.map { "--skip-#{_1.tr("_", "-")}" })
|
205
|
+
args.push(*enable_features.map { "--#{_1.to_s.tr("_", "-")}" })
|
206
|
+
args.push(*skip_features.map { "--skip-#{_1.to_s.tr("_", "-")}" })
|
208
207
|
end
|
209
208
|
end
|
210
209
|
|
211
210
|
private
|
212
211
|
|
213
|
-
attr_reader :skip_features
|
212
|
+
attr_reader :enable_features, :skip_features, :version
|
213
|
+
|
214
|
+
def skippable_features
|
215
|
+
FRAMEWORKS + default_features.keys
|
216
|
+
end
|
214
217
|
end
|
215
218
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "open-uri"
|
4
|
+
require "rails/version"
|
5
|
+
require "yaml"
|
6
|
+
|
7
|
+
module Nextgen
|
8
|
+
RailsVersion = Struct.new(
|
9
|
+
:args,
|
10
|
+
:label,
|
11
|
+
:asset_pipelines,
|
12
|
+
:databases,
|
13
|
+
:default_features,
|
14
|
+
:optional_features,
|
15
|
+
keyword_init: true
|
16
|
+
)
|
17
|
+
|
18
|
+
class << RailsVersion
|
19
|
+
def current
|
20
|
+
from_yaml(:current) do |version|
|
21
|
+
version.label.sub!("%%CURRENT_VERSION%%") { ::Rails.version }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def edge
|
26
|
+
from_yaml(:edge)
|
27
|
+
end
|
28
|
+
|
29
|
+
def main
|
30
|
+
from_yaml(:main) do |version|
|
31
|
+
version.label.sub!("%%MAIN_VERSION%%") { main_version }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def from_yaml(key)
|
38
|
+
@yaml ||= begin
|
39
|
+
yaml_path = File.expand_path("../../config/rails_versions.yml", __dir__)
|
40
|
+
YAML.load_file(yaml_path, aliases: true, symbolize_names: true)
|
41
|
+
end
|
42
|
+
new(**@yaml.fetch(key)).tap do |version|
|
43
|
+
yield(version) if block_given?
|
44
|
+
end.freeze
|
45
|
+
end
|
46
|
+
|
47
|
+
def main_version
|
48
|
+
@main_version ||= begin
|
49
|
+
version_rb = URI.open("https://raw.githubusercontent.com/rails/rails/main/version.rb").read
|
50
|
+
version_pattern = /\s+MAJOR\s+= (\d+)\n\s*MINOR\s+= (\d+)\n\s*TINY\s+= (\d+)\n\s*PRE\s+= "(\w+)"/
|
51
|
+
version_rb.match(version_pattern)&.captures&.join(".")
|
52
|
+
rescue OpenURI::HTTPError
|
53
|
+
"unknown"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/nextgen/version.rb
CHANGED
data/template/.overcommit.yml.tt
CHANGED
data/template/DEPLOYMENT.md
CHANGED
@@ -8,4 +8,4 @@ These environment variables affect how the app functions when deployed in produc
|
|
8
8
|
- `RAILS_ENV` **REQUIRED** - "production"
|
9
9
|
- `RAILS_MAX_THREADS` - Number of threads per Puma process (default: 3)
|
10
10
|
- `SECRET_KEY_BASE` **REQUIRED** - Unique, secret key used to encrypt and sign cookies and other sensitive data
|
11
|
-
- `WEB_CONCURRENCY` - Number of Puma processes (default:
|
11
|
+
- `WEB_CONCURRENCY` - Number of Puma processes (default: 1)
|
data/template/bin/setup
CHANGED
@@ -11,7 +11,7 @@ def setup!
|
|
11
11
|
run "bin/rails db:prepare" if database_present?
|
12
12
|
run "yarn install --check-files" if yarn_needed?
|
13
13
|
run "bin/rails tmp:create" if tmp_missing?
|
14
|
-
run "bin/rails restart"
|
14
|
+
run "bin/rails restart" if pid_present?
|
15
15
|
|
16
16
|
if git_safe_needed?
|
17
17
|
say_status :notice,
|
@@ -56,6 +56,10 @@ def tmp_missing?
|
|
56
56
|
!Dir.exist?("tmp/pids")
|
57
57
|
end
|
58
58
|
|
59
|
+
def pid_present?
|
60
|
+
Dir["tmp/pids/*.pid"].any?
|
61
|
+
end
|
62
|
+
|
59
63
|
def git_safe_needed?
|
60
64
|
ENV["PATH"].include?(".git/safe/../../bin") && !Dir.exist?(".git/safe")
|
61
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nextgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brictson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- LICENSE.txt
|
93
93
|
- README.md
|
94
94
|
- config/generators.yml
|
95
|
+
- config/rails_versions.yml
|
95
96
|
- exe/nextgen
|
96
97
|
- lib/nextgen.rb
|
97
98
|
- lib/nextgen/actions.rb
|
@@ -139,8 +140,9 @@ files:
|
|
139
140
|
- lib/nextgen/generators/tomo.rb
|
140
141
|
- lib/nextgen/generators/vcr.rb
|
141
142
|
- lib/nextgen/generators/vite.rb
|
142
|
-
- lib/nextgen/
|
143
|
+
- lib/nextgen/rails_command.rb
|
143
144
|
- lib/nextgen/rails_options.rb
|
145
|
+
- lib/nextgen/rails_version.rb
|
144
146
|
- lib/nextgen/thor_extensions.rb
|
145
147
|
- lib/nextgen/tidy_gemfile.rb
|
146
148
|
- lib/nextgen/version.rb
|