Skip to content

Refactor complex dependency related code #35

Description

@edubkendo

The code for loading dependencies is extremely complex and hairy. It should be possible to dramatically simplify it by just checking a projects Gemfile.lock with something like this:

lockfile = Bundler::LockfileParser.new(Bundler.read_file(Pathname.new("~/tmp/cool/Gemfile.lock").expand_path.to_s))
names = lockfile.dependencies.map {|d| d.name}

names.map do |n|
  { name: n, path: Bundler.rubygems.find_name(n).first.full_gem_path }
end

Should be able to remove huge globs of code in the following files:

https://github.com/rsense/rsense-server/blob/master/lib/rsense/server/command.rb
https://github.com/rsense/rsense-server/blob/master/lib/rsense/server/load_path.rb
https://github.com/rsense/rsense-server/blob/master/lib/rsense/server/gem_path.rb
https://github.com/rsense/rsense-server/blob/master/lib/rsense/server/command/preload.rb

Getting this done might even remove the problems we currently have with loading larger projects like Rails apps.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions