Created
February 7, 2021 13:53
-
-
Save somenugget/64348e41ef1b28abf15cfb6cda9396ab to your computer and use it in GitHub Desktop.
Run overcommit from sublime-merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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