rubyworks / backload Goto Github PK
View Code? Open in Web Editor NEWShouldn't loading have a callback?
License: Other
Shouldn't loading have a callback?
License: Other
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
While looking into #2 I noticed that (of course) the callback for a require
is only fired after all the require
s 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?
backload/lib/backload/require_relative.rb
Lines 10 to 11 in 44a1966
is missing a second param that could be filled here:
backload/lib/backload/require_relative.rb
Lines 44 to 45 in 44a1966
Just wanted to drop a quick "Thank you" as I had the problem that I had to understand what features were require
d and require_relative
d 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 :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.