Last active
July 26, 2016 08:28
-
-
Save HotFusionMan/16ad82b946961efc9e73 to your computer and use it in GitHub Desktop.
This file contains 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
# For inclusion into a Rails config/initializers/better_errors.rb file. | |
if defined?(BetterErrors) | |
if ENV['DEV_PROFILING'] == 'true' || ENV['DEV_DISABLE_ERRORS'] == 'true' | |
Rails.configuration.middleware.delete( BetterErrors::Middleware ) | |
end | |
BETTER_ERRORS_EDITORS = { 'x-mine:' => "x-mine://open?file=%{file}&line=%{line}", 'sublime:' => :sublime, 'txmt:' => :textmate, 'emacs:' => :emacs, 'mvim:' => :macvim } | |
if RUBY_PLATFORM.index( 'darwin' ) | |
unless ENV['BETTER_ERRORS_EDITOR'].blank? | |
# use `export BETTER_ERRORS_EDITOR='the-url-scheme'` to set which editor you want to use | |
BetterErrors.editor = BETTER_ERRORS_EDITORS[ENV['BETTER_ERRORS_EDITOR']] | |
else | |
url_schemes = `/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep bindings:.*:` | |
BETTER_ERRORS_EDITORS.each do |key, value| | |
if url_schemes.index(key) | |
BetterErrors.editor = value | |
break | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment