From 6570fed175e61328341d1a7c0d8a7a7077b496ab Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 30 Aug 2022 16:27:14 +0100 Subject: [PATCH] DEV: Fix Ember version lookup (#18136) The source-of-truth for our ember version is now the installed node_module. The `ember_source` gem carries an old version of Ember and so the constant is no longer useful. We'll be dropping the gem soon. --- app/models/theme.rb | 2 +- lib/ember_cli.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/theme.rb b/app/models/theme.rb index b89c7ca71a3..3c033055d37 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -157,7 +157,7 @@ class Theme < ActiveRecord::Base get_set_cache "compiler_version" do dependencies = [ BASE_COMPILER_VERSION, - Ember::VERSION, + EmberCli.ember_version, GlobalSetting.cdn_url, GlobalSetting.s3_cdn_url, GlobalSetting.s3_endpoint, diff --git a/lib/ember_cli.rb b/lib/ember_cli.rb index de450d58ee4..181dd72c791 100644 --- a/lib/ember_cli.rb +++ b/lib/ember_cli.rb @@ -49,4 +49,11 @@ module EmberCli def self.is_ember_cli_asset?(name) assets.include?(name) || name.start_with?("chunk.") 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 + end end