mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Add windows? to Pry::Helpers::BaseHelpers.
Move (what I found) /mswin|mingw/ to windows? Signed-off-by: Jordon Bedwell <jordon@envygeeks.com>
This commit is contained in:
parent
b5d7e4a129
commit
dbaa4b0aef
4 changed files with 10 additions and 5 deletions
|
@ -159,7 +159,7 @@ require "optparse"
|
|||
require "slop"
|
||||
require "rbconfig"
|
||||
|
||||
if defined? JRUBY_VERSION
|
||||
if Pry::Helpers::BaseHelpers.jruby?
|
||||
begin
|
||||
require 'ffi'
|
||||
rescue LoadError
|
||||
|
@ -167,7 +167,7 @@ if defined? JRUBY_VERSION
|
|||
end
|
||||
end
|
||||
|
||||
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
||||
if Pry::Helpers::BaseHelpers.windows?
|
||||
begin
|
||||
require 'win32console'
|
||||
rescue LoadError
|
||||
|
|
|
@ -91,6 +91,11 @@ class Pry
|
|||
27
|
||||
end
|
||||
|
||||
# have fun on the Windows platform.
|
||||
def windows?
|
||||
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
||||
end
|
||||
|
||||
# are we on Jruby platform?
|
||||
def jruby?
|
||||
defined? JRUBY_VERSION
|
||||
|
|
|
@ -187,7 +187,7 @@ class Pry
|
|||
# Return the syntax for a given editor for starting the editor
|
||||
# and moving to a particular line within that file
|
||||
def start_line_syntax_for_editor(file_name, line_number)
|
||||
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
||||
if Helpers::BaseHelpers.windows?
|
||||
file_name = file_name.gsub(/\//, '\\')
|
||||
end
|
||||
|
||||
|
@ -204,7 +204,7 @@ class Pry
|
|||
when /^jedit/
|
||||
"#{file_name} +line:#{line_number}"
|
||||
else
|
||||
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
||||
if Helpers::BaseHelpers.windows?
|
||||
"#{file_name}"
|
||||
else
|
||||
"+#{line_number} #{file_name}"
|
||||
|
|
|
@ -195,7 +195,7 @@ class Pry
|
|||
return ENV['VISUAL'] if ENV['VISUAL'] and not ENV['VISUAL'].empty?
|
||||
return ENV['EDITOR'] if ENV['EDITOR'] and not ENV['EDITOR'].empty?
|
||||
|
||||
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
||||
if Helpers::BaseHelpers.windows?
|
||||
'notepad'
|
||||
else
|
||||
case true
|
||||
|
|
Loading…
Reference in a new issue