Skip to content

Source of require, tree of requires with indentation? #2

Description

@janpio

I am using your gem to output a list of the require and require_relative "activity" in my app now:

require_relative 'fastlane_core/globals' (C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/fastlane-2.105.2/fastlane_core/lib) 
require_relative 'fastlane_core/core_ext/string' (C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/fastlane-2.105.2/fastlane_core/lib)
require 'logger'
require 'colored'
require_relative 'cursor/version' (C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/tty-cursor-0.6.0/lib/tty)
require 'tty/cursor'
require 'tty-cursor'
require_relative 'spinner/version' (C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/tty-spinner-0.8.0/lib/tty)
require_relative 'spinner/formats' (C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/tty-spinner-0.8.0/lib/tty)
require_relative 'tty/spinner' (C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/tty-spinner-0.8.0/lib)

via

require 'backload'
require 'backload/require_relative'
def Kernel.backloaded(feature, options={})
  if options[:require]
      if rel = options[:relative]
        puts "require_relative '#{feature}' (#{rel})"
      else
        puts "require '#{feature}'"
      end
  end
end

That by itself is awesome, but of course I want more now 💯

Any idea how I would go about transforming this simple list into something that helps me undertand what files are requiring what, which then require other stuff?

In the best case this would be presented as a tree like structure, comparable to what tree returns:

├───bin                             
├───cert                            
│   └───lib                         
│       └───cert                    
├───credentials_manager             
│   └───lib                         
│       └───credentials_manager     
├───deliver                         
│   └───lib                         
│       ├───assets                  
│       └───deliver                 
├───fastlane                        
│   ├───lib                         

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions