New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed deprecation warning for pry v0.12.0 #87

Merged
merged 2 commits into from Nov 6, 2018

Conversation

Projects
None yet
2 participants
@sue445
Contributor

sue445 commented Nov 5, 2018

c.f. https://github.com/pry/pry/blob/master/CHANGELOG.md#v0120-november-5-2018

Now (pry v0.12.0 + pry-doc v0.13.4)

$ bundle exec rspec
/Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/ruby_source_installer.rb:28: warning: constant Pry::Platform is deprecated
/Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/ruby_source_installer.rb:35: warning: constant Pry::Platform is deprecated

Building Sample Gem with C Extensions for testing..
creating Makefile
compiling sample.c
linking shared-object sample.bundle

Testing pry-doc version 0.13.4...
Ruby version: 2.5.1

Randomized with seed 14933
Scanning and caching *.c files...
......../Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
./Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
...../Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
.../Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
...../Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
..................

Finished in 0.56493 seconds (files took 3.31 seconds to load)
40 examples, 0 failures

Randomized with seed 14933

After (pry v0.12.0 + pry-doc my branch)

$ bundle exec rspec

Building Sample Gem with C Extensions for testing..
creating Makefile
linking shared-object sample.bundle

Testing pry-doc version 0.13.4...
Ruby version: 2.5.1

Randomized with seed 14605
Scanning and caching *.c files...
........................................

Finished in 0.19723 seconds (files took 0.73212 seconds to load)
40 examples, 0 failures

Randomized with seed 14605

After (pry v0.11.3 + pry-doc my branch)

$ bundle exec rspec

Building Sample Gem with C Extensions for testing..
creating Makefile
linking shared-object sample.bundle

Testing pry-doc version 0.13.4...
Ruby version: 2.5.1

Randomized with seed 3241
Scanning and caching *.c files...
........................................

Finished in 0.1765 seconds (files took 0.56779 seconds to load)
40 examples, 0 failures

Randomized with seed 3241
@sue445

This comment has been minimized.

Contributor

sue445 commented Nov 5, 2018

https://travis-ci.org/pry/pry-doc/builds/450772228
Test is failed only Ruby 2.0. So I fixed at #88

Fixed deprecation warning for pry v0.12.0
c.f. https://github.com/pry/pry/blob/master/CHANGELOG.md#v0120-november-5-2018

```
$ bundle exec rspec
/Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/ruby_source_installer.rb:28: warning: constant Pry::Platform is deprecated
/Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/ruby_source_installer.rb:35: warning: constant Pry::Platform is deprecated

Building Sample Gem with C Extensions for testing..
creating Makefile
compiling sample.c
linking shared-object sample.bundle

Testing pry-doc version 0.13.4...
Ruby version: 2.5.1

Randomized with seed 14933
Scanning and caching *.c files...
......../Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
./Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
...../Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
.../Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
...../Users/sue445/workspace/github.com/pry/pry-doc/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb:47: warning: constant Pry::Platform is deprecated
..................

Finished in 0.56493 seconds (files took 3.31 seconds to load)
40 examples, 0 failures

Randomized with seed 14933
```
@sue445

This comment has been minimized.

Contributor

sue445 commented Nov 6, 2018

I rebased this branch from latest master

@kyrylo

It makes sense to release pry-doc with this patch. However, this code will be removed when the next Pry version is ready to be released (since these checks are really nasty), so we don't keep these hacks forever.

I only have a minor comment and then I'm happy to merge.

# 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.create(Pry::VERSION) < Gem::Version.create("0.12.0")

This comment has been minimized.

@kyrylo

kyrylo Nov 6, 2018

Member

Let's use Gem::Version.new since we pass a string, and this is what it expects (create allows passing nil and other stuff). http://ruby-doc.org/stdlib-2.5.0/libdoc/rubygems/rdoc/Gem/Version.html#method-c-new

This comment has been minimized.

@sue445

sue445 Nov 6, 2018

Contributor

Fixed at 4501774

Use Gem::Version.new intead of Gem::Version.create
`Gem::Version.create(nil)` returns nil, but `Gem::Version.new(nil)` not

```
irb(main):001:0> RUBY_VERSION
=> "2.5.3"
irb(main):002:0> Gem::Version.new(nil)
=> #<Gem::Version "">
irb(main):003:0> Gem::Version.create(nil)
=> nil
```

@kyrylo kyrylo merged commit 459ed87 into pry:master Nov 6, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@sue445 sue445 deleted the sue445:pry-0.12.0-deprecation-warning branch Nov 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment