Giter Club home page Giter Club logo

backload's People

Contributors

trans avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

backload's Issues

Source of `require`, tree of `require`s with indentation?

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                         

Output when require happens, not after

While looking into #2 I noticed that (of course) the callback for a require is only fired after all the requires inside are taken care of.

Is there a way to execute something when the require starts, so it is easier to understand in what order things are required?

Thanks!

Just wanted to drop a quick "Thank you" as I had the problem that I had to understand what features were required and require_relatived in the app I am working on.

Google and Stack Overflow only brought me to simple "just overload require and require_relative answers, but as you know it's not that simple.

So one gem install backload and using your adapted sample code, I have it working :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.