Skip to content

Commit 1f38bf2

Browse files
committed
Add a simple template for Rails 8.0
1 parent bc020dc commit 1f38bf2

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

files/rails/8.0.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# JRuby template for `rails new --template ...`
2+
3+
# 1. We let Rails generate the default Gemfile first.
4+
# 2. We use an after_bundle block or direct manipulation to swap it before bundling completes.
5+
6+
# Replace database driver gem with activerecord-jbdbc-adapter
7+
case options[:database]
8+
when "sqlite3"
9+
gsub_file "Gemfile", /gem "sqlite3".*$/, 'gem "activerecord-jdbcsqlite3-adapter", "80.0.pre1"'
10+
when "mysql"
11+
gsub_file "Gemfile", /gem "mysql2".*$/, 'gem "activerecord-jdbcmysql-adapter", "80.0.pre1"'
12+
when "postgresql"
13+
gsub_file "Gemfile", /gem "pg".*$/, 'gem "activerecord-jdbcpostgresql-adapter", "80.0.pre1"'
14+
else
15+
say "Unsupported database: #{options[:database]}", :red
16+
exit 1
17+
end
18+
19+
after_bundle do
20+
say "Gemfile customized for JDBC and dependencies bundled successfully!", :green
21+
end
22+

0 commit comments

Comments
 (0)