Skip to content

Instantly share code, notes, and snippets.

@eliotsykes
Created December 22, 2014 10:29
Show Gist options
  • Save eliotsykes/8fecb12f96bb21fcb582 to your computer and use it in GitHub Desktop.
Save eliotsykes/8fecb12f96bb21fcb582 to your computer and use it in GitHub Desktop.
Gemfile Ruby Version from .ruby-version file
source 'https://rubygems.org'
def ruby_version
version_file = ".ruby-version"
version_override = (File.exist?(version_file) && File.read(version_file).strip)
default_version = "2.1.5"
version_override || default_version
end
ruby ruby_version
# Continue with usual Gemfile:
gem 'rails', '4.2.0'
# ... etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment