DEV: Upgrading Discourse to Zeitwerk (#8098)

Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. 

We no longer need to use Rails "require_dependency" anywhere and instead can just use standard 
Ruby patterns to require files.

This is a far reaching change and we expect some followups here.
This commit is contained in:
Krzysztof Kotlarek
2019-10-02 14:01:53 +10:00
committed by Sam
parent 68d35b14f4
commit 427d54b2b0
496 changed files with 293 additions and 1050 deletions

View File

@ -1,8 +1,8 @@
# frozen_string_literal: true
require_dependency 'stylesheet/common'
require_dependency 'stylesheet/importer'
require_dependency 'stylesheet/functions'
require 'stylesheet/common'
require 'stylesheet/importer'
require 'stylesheet/functions'
module Stylesheet
@ -17,7 +17,7 @@ module Stylesheet
file += " @import \"#{asset}\";"
else
filename = "#{asset}.scss"
path = "#{ASSET_ROOT}/#{filename}"
path = "#{Stylesheet::Common::ASSET_ROOT}/#{filename}"
file = File.read path
end
@ -37,7 +37,7 @@ module Stylesheet
theme_id: options[:theme_id],
theme: options[:theme],
theme_field: options[:theme_field],
load_paths: [ASSET_ROOT])
load_paths: [Stylesheet::Common::ASSET_ROOT])
result = engine.render