Skip to content

Instantly share code, notes, and snippets.

@defulmere
Last active December 7, 2024 20:28
Show Gist options
  • Save defulmere/eefd049f02b9b27d5a72bddbcf470baf to your computer and use it in GitHub Desktop.
Save defulmere/eefd049f02b9b27d5a72bddbcf470baf to your computer and use it in GitHub Desktop.
Bootstrap a Rails project without having Rails installed first

Bootstrap a rails project without rails installed

Set GEM_HOME to an ephemeral directory then use gem exec to run rails:

export GEM_HOME=$( mktemp -d )
gem exec rails new myproject
cd myproject
bundle config set deployment true
bundle install
rm -rf $GEM_HOME
unset GEM_HOME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment