pry / pry-doc

Provide MRI Core documentation and source code for the Pry REPL
https://github.com/pry/pry-doc
Other
175 stars 26 forks source link

Windows support #85

Closed banister closed 6 years ago

banister commented 6 years ago

Windows support. Requires curl and 7zip to be installed, but etags is bundled with the gem.

banister commented 6 years ago

@kyrylo any feedback or shall i just merge?

kyrylo commented 6 years ago

When I run tests locally, I get the following error:

Failures:

  1) PryDoc Pry::CInternals::CodeFetcher no tags file exists attempts to install and setup ruby
     Failure/Error: expect(described_class.ruby_source_installer).to receive(:install)

       (#<Pry::CInternals::RubySourceInstaller:0x00007fabe5156a38 @ruby_version="2_4_2", @ruby_source_folder="/Users/kyrylo/.pry.d/ruby-2_4_2", @curl_cmd="curl --fail -L https://github.com/ruby/ruby/archive/v2_4_2.tar.gz | tar xzvf - 2> /dev/null", @etag_binary="etags", @etag_cmd="find . -type f -name '*.[chy]' | etags - --no-members">).install(*(any args))
           expected: 1 time with any arguments
           received: 0 times with any arguments
     # ./spec/pry-doc_spec.rb:27:in `block (4 levels) in <top (required)>'

Finished in 0.21216 seconds (files took 0.82188 seconds to load)
40 examples, 1 failure

Any ideas? I'm on MacOS.

banister commented 6 years ago

@kyrylo it was due to data persisting between spec examples....i fixed it by reducing the amount of state i store on the class, by extracting out a new class SymbolMapBuilder and then resetting symbol_map to nil before each example

https://github.com/pry/pry-doc/pull/85/commits/22bc8da6ccf3f560ea6558ca250e390ba614b8ff

banister commented 6 years ago

@kyrylo thanks....i tried to make CFile easier to understand here https://github.com/pry/pry-doc/pull/85/commits/130fb72e2dbae4d261b01e59414f51a115ce1906

banister commented 6 years ago

renamed SymbolMapBuilder to ETagParser which is exactly what it is, also opens up possibilities of supporting other tag formats (such as ctags) in the future by swapping in a different parser