lib/jets/core.rb in jets-1.6.1 vs lib/jets/core.rb in jets-1.6.2

- old
+ new

@@ -16,18 +16,14 @@ # Load all application base classes and project classes def boot(options={}) Jets::Booter.boot!(options) end - # Ensures trailing slash - # Useful for appending a './' in front of a path or leaving it alone. - # Returns: '/path/with/trailing/slash/' or './' def root # Do not memoize this method. Turbo mode can change it root = ENV['JETS_ROOT'].to_s - root = '.' if root == '' - root = "#{root}/" unless root.ends_with?('/') + root = Dir.pwd if root == '' Pathname.new(root) end def env env = ENV['JETS_ENV'] || 'development' @@ -108,18 +104,18 @@ map[class_name] || class_name end # Eager load user's application def eager_load_app - Dir.glob("#{Jets.root}app/**/*.rb").select do |path| + Dir.glob("#{Jets.root}/app/**/*.rb").select do |path| next if !File.file?(path) or path =~ %r{/javascript/} or path =~ %r{/views/} next if path.include?('app/functions') || path.include?('app/shared/functions') || path.include?('app/internal/functions') class_name = path .sub(/\.rb$/,'') # remove .rb .sub(%{^\./},'') # remove ./ - .sub(Jets.root.to_s,'') + .sub("#{Jets.root}/",'') .sub(%r{app/shared/\w+/},'') # remove shared/resources or shared/extensions .sub(%r{app/\w+/},'') # remove app/controllers or app/jobs etc class_name = class_name.classify class_name.constantize # use constantize instead of require so dont have to worry about order. end @@ -148,10 +144,10 @@ def project_namespace [config.project_name, config.short_env, config.env_extra].compact.join('-').gsub('_','-') end def rack? - path = "#{Jets.root}rack" + path = "#{Jets.root}/rack" File.exist?(path) || File.symlink?(path) end def poly_only? return true if ENV['JETS_POLY_ONLY'] # bypass to allow rapid development of handlers