Skip to content

Instantly share code, notes, and snippets.

@harshalbhakta
Created March 23, 2020 15:28
Show Gist options
  • Select an option

  • Save harshalbhakta/344c4eb34a6f391a31628dc9978953d8 to your computer and use it in GitHub Desktop.

Select an option

Save harshalbhakta/344c4eb34a6f391a31628dc9978953d8 to your computer and use it in GitHub Desktop.
macOS Catalina 10.15.3 /usr/bin/rails
#!/usr/bin/ruby
# Stub rails command to load rails from Gems or print an error if not installed.
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
begin
gem 'railties', version or raise
rescue Exception
puts 'Rails is not currently installed on this system. To get the latest version, simply type:'
puts
puts ' $ sudo gem install rails'
puts
puts 'You can then rerun your "rails" command.'
exit 0
end
load Gem.bin_path('railties', 'rails', version)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment