Skip to content

Instantly share code, notes, and snippets.

@somenugget
Created February 7, 2021 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save somenugget/64348e41ef1b28abf15cfb6cda9396ab to your computer and use it in GitHub Desktop.
Save somenugget/64348e41ef1b28abf15cfb6cda9396ab to your computer and use it in GitHub Desktop.
Run overcommit from sublime-merge
encoding_env_vars = 'LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8'
required_ruby_version = File.open('.ruby-version').read.chomp
env_ruby_version = ENV['RUBY_VERSION'].chomp
project_path = File.expand_path("#{File.dirname(__FILE__)}/../..")
if required_ruby_version != env_ruby_version
require 'pty'
PTY.spawn("#{encoding_env_vars} rvm in #{project_path} do #{__FILE__}") do |stdout, stdin, pid|
while !stdout.eof?
puts stdout.gets
end
Process.wait(pid)
end
exit $?.exitstatus
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment