lib/jets/commands/base.rb
# Useful for help menu when we need to have all the definitions loaded.
# Using constantize instead of require so we dont care about
# order. The eager load actually uses autoloading.
Useful for help menu when we need to have all the definitions loaded.
Using constantize instead of require so we dont care about
order. The eager load actually uses autoloading.
Useful for help menu when we need to have all the definitions loaded . Using constantize instead of require so we dont care about order . The eager load actually uses autoloading .
def eager_load!
      base_path = File.expand_path("../../", __FILE__)
      Dir.glob("#{base_path}/commands/**/*.rb").select do |path|
        next if !File.file?(path) or path =~ /templates/ or path =~ %r{/markdown/}
        class_name = path
                      .sub(/\.rb$/,'')
                      .sub(%r{.*/jets/commands}, 'jets/commands')
                      .classify
        class_name = special_class_map(class_name)
        class_name.constantize 
      end
    end
def eager_load! base_path = File . expand_path ( "../../" , __FILE__ ) Dir . glob ( "#{base_path}/commands/**/*.rb" ) . select do | path | next if ! File . file? ( path ) or path =~ / templates / or path =~ %r{ /markdown/ } class_name = path . sub ( / \. rb$ / , '' ) . sub ( %r{ .*/jets/commands } , 'jets/commands' ) . classify class_name = special_class_map ( class_name ) class_name . constantize end end
Useful for help menu when we need to have all the definitions loaded.
Useful for help menu when we need to have all the definitions loaded .
# NOTE: Weird thing where Jets::Commands::Db::Task => Thor::Command # because Task is a class available to Thor I believe. # puts "eager_load! loading path: #{path} class_name: #{class_name}" if ENV['JETS_DEBUG'] # dont have to worry about order.