Skip to content

Commit

Permalink
Merge pull request #87 from sue445/pry-0.12.0-deprecation-warning
Browse files Browse the repository at this point in the history
Fixed deprecation warning for pry v0.12.0
  • Loading branch information
kyrylo committed Nov 6, 2018
2 parents 870a968 + 4501774 commit 459ed87
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
10 changes: 9 additions & 1 deletion lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb
Expand Up @@ -44,14 +44,22 @@ def source_location_for(symbol, line_number)
end

def full_path_for(file_name)
if Pry::Platform.windows?
if windows?
# windows etags already has the path expanded, wtf
file_name
else
File.join(ruby_source_folder, @file_name)
end
end

def windows?
if Gem::Version.new(Pry::VERSION) < Gem::Version.new("0.12.0")
Pry::Platform.windows?
else
Pry::Helpers::Platform.windows?
end
end

def symbol_type_for(symbol)
if symbol =~ /#\s*define/
:macro
Expand Down
Expand Up @@ -25,18 +25,34 @@ def install
private

def set_platform_specific_commands
if Pry::Platform.windows?
if windows?
self.curl_cmd = "curl -k --fail -L -O https://github.com/ruby/ruby/archive/v#{ruby_version}.zip " +
"& 7z -y x v#{ruby_version}.zip"
self.etag_binary = File.join(PryDoc.root, "libexec/windows/etags")
self.etag_cmd = %{dir /b /s *.c *.h *.y | "#{etag_binary}" - --no-members}
else
self.curl_cmd = "curl --fail -L https://github.com/ruby/ruby/archive/v#{ruby_version}.tar.gz | tar xzvf - 2> /dev/null"
self.etag_binary = Pry::Platform.linux? ? File.join(PryDoc.root, "libexec/linux/etags-#{arch}") : "etags"
self.etag_binary = linux? ? File.join(PryDoc.root, "libexec/linux/etags-#{arch}") : "etags"
self.etag_cmd = "find . -type f -name '*.[chy]' | #{etag_binary} - --no-members"
end
end

def windows?
if Gem::Version.new(Pry::VERSION) < Gem::Version.new("0.12.0")
Pry::Platform.windows?
else
Pry::Helpers::Platform.windows?
end
end

def linux?
if Gem::Version.new(Pry::VERSION) < Gem::Version.new("0.12.0")
Pry::Platform.linux?
else
Pry::Helpers::Platform.linux?
end
end

def ask_for_install
print "Identifier not found - do you want to install CRuby sources to attempt to resolve the identifier there?" +
"\nThis allows the lookup of C internals Y/N "
Expand Down

0 comments on commit 459ed87

Please sign in to comment.