File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments