mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
DEV: Apply syntax_tree formatting to lib/*
This commit is contained in:
@ -2,37 +2,47 @@
|
||||
|
||||
module EmberCli
|
||||
def self.assets
|
||||
@assets ||= begin
|
||||
assets = %w(
|
||||
discourse.js
|
||||
admin.js
|
||||
wizard.js
|
||||
ember_jquery.js
|
||||
markdown-it-bundle.js
|
||||
start-discourse.js
|
||||
vendor.js
|
||||
)
|
||||
assets += Dir.glob("app/assets/javascripts/discourse/scripts/*.js").map { |f| File.basename(f) }
|
||||
@assets ||=
|
||||
begin
|
||||
assets = %w[
|
||||
discourse.js
|
||||
admin.js
|
||||
wizard.js
|
||||
ember_jquery.js
|
||||
markdown-it-bundle.js
|
||||
start-discourse.js
|
||||
vendor.js
|
||||
]
|
||||
assets +=
|
||||
Dir.glob("app/assets/javascripts/discourse/scripts/*.js").map { |f| File.basename(f) }
|
||||
|
||||
Discourse.find_plugin_js_assets(include_disabled: true).each do |file|
|
||||
next if file.ends_with?("_extra") # these are still handled by sprockets
|
||||
assets << "#{file}.js"
|
||||
Discourse
|
||||
.find_plugin_js_assets(include_disabled: true)
|
||||
.each do |file|
|
||||
next if file.ends_with?("_extra") # these are still handled by sprockets
|
||||
assets << "#{file}.js"
|
||||
end
|
||||
|
||||
assets
|
||||
end
|
||||
|
||||
assets
|
||||
end
|
||||
end
|
||||
|
||||
def self.script_chunks
|
||||
return @@chunk_infos if defined? @@chunk_infos
|
||||
return @@chunk_infos if defined?(@@chunk_infos)
|
||||
|
||||
raw_chunk_infos = JSON.parse(File.read("#{Rails.configuration.root}/app/assets/javascripts/discourse/dist/chunks.json"))
|
||||
raw_chunk_infos =
|
||||
JSON.parse(
|
||||
File.read("#{Rails.configuration.root}/app/assets/javascripts/discourse/dist/chunks.json"),
|
||||
)
|
||||
|
||||
chunk_infos = raw_chunk_infos["scripts"].map do |info|
|
||||
logical_name = info["afterFile"][/\Aassets\/(.*)\.js\z/, 1]
|
||||
chunks = info["scriptChunks"].map { |filename| filename[/\Aassets\/(.*)\.js\z/, 1] }
|
||||
[logical_name, chunks]
|
||||
end.to_h
|
||||
chunk_infos =
|
||||
raw_chunk_infos["scripts"]
|
||||
.map do |info|
|
||||
logical_name = info["afterFile"][%r{\Aassets/(.*)\.js\z}, 1]
|
||||
chunks = info["scriptChunks"].map { |filename| filename[%r{\Aassets/(.*)\.js\z}, 1] }
|
||||
[logical_name, chunks]
|
||||
end
|
||||
.to_h
|
||||
|
||||
@@chunk_infos = chunk_infos if Rails.env.production?
|
||||
chunk_infos
|
||||
@ -45,9 +55,11 @@ module EmberCli
|
||||
end
|
||||
|
||||
def self.ember_version
|
||||
@version ||= begin
|
||||
ember_source_package_raw = File.read("#{Rails.root}/app/assets/javascripts/node_modules/ember-source/package.json")
|
||||
JSON.parse(ember_source_package_raw)["version"]
|
||||
end
|
||||
@version ||=
|
||||
begin
|
||||
ember_source_package_raw =
|
||||
File.read("#{Rails.root}/app/assets/javascripts/node_modules/ember-source/package.json")
|
||||
JSON.parse(ember_source_package_raw)["version"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user