You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 29, 2018. It is now read-only.
Right now, script_deps creates a new process by running gem list. You can get the same results without creating a new process by running Gem::Specification which responds to #each, #map, and #all. The upside is that every member of the collection responds to #version so you don't have to parse the results of gem list. The downside is that you can have multiple versions and they appear in the collection for every installed version.
#srclib-ruby/lib/srclib-ruby/scan.rb#L116-133defscript_deps(script_code)# Get a list of all installed gemsinstalled_gems=`gem list`.split(/\n/).mapdo |line|
line.split.first.strip#TODO: Extract version numberenddeps=[]script_code.scan(/require\W["'](.*)["']/)do |required|
ifinstalled_gems.include?required[0].stripdeps << [required[0].strip,">= 0"#TODO: Should use the currently installed version number]endendreturndepsend
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Right now,
script_deps
creates a new process by runninggem list
. You can get the same results without creating a new process by runningGem::Specification
which responds to#each
,#map
, and#all
. The upside is that every member of the collection responds to#version
so you don't have to parse the results ofgem list
. The downside is that you can have multiple versions and they appear in the collection for every installed version.The text was updated successfully, but these errors were encountered: