I have Linux as my main Rails dev platform, but I also have Rails installed and working on my Windows pc. All my apps are synced between the two computers, so a change on Linux will reflect on Windows.
I’m wanting to use postgresql on Linux, but sqlite3 on Windows. Is there a way to distinguish certain gem sets to load (Gemfile) based on which platform I’m using?
Bundler docs does mentions about
:platformoption that you can use to specify which gems you want to install on certain platform.There’s another solution(I learned from other Ruby developers and online tutorials) is to wrap your gemset inside a group eg:
Then run:
After you run this command, bundler will install gems that are not listed inside option group. You can set option to be either windows or linux. Hence the way to distinguish certain platform is solved.
Happy coding!