make globalLookups a module to extend, not a stub
refs FOO-2498 flag=none [pin-commit-multiple_root_accounts=5bd07698db01843f784622d0a99277bbd7be0dc1] the stub pattern won't work with zeitwerk TEST PLAN: 1) specs pass with plugins migrated to autoextension of GL Change-Id: I29c7249e38d06e54d4fc111f8a845d4e94ea70f3 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276301 Reviewed-by: Jacob Burroughs <jburroughs@instructure.com> Tested-by: Ethan Vizitei <evizitei@instructure.com> QA-Review: Ethan Vizitei <evizitei@instructure.com> Product-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
parent
fdc3b44241
commit
c656c0d60e
|
@ -18,17 +18,11 @@
|
|||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
module GlobalLookups
|
||||
unless singleton_class.method_defined?(:enabled?)
|
||||
def self.enabled?
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
module DevUtils
|
||||
unless singleton_class.method_defined?(:initialize_ddb_for_development!)
|
||||
def self.initialize_ddb_for_development!
|
||||
puts("Nothing to do for global lookups stub")
|
||||
end
|
||||
end
|
||||
# this is a bit convoluted, but it makes it simpler
|
||||
# to have a module-level interface like this that
|
||||
# can be overidden easily in plugins by having
|
||||
# modules prepend themselves to override what "Config" does.
|
||||
def self.enabled?
|
||||
GlobalLookups::Config.new.enabled?
|
||||
end
|
||||
end
|
|
@ -0,0 +1,28 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# Copyright (C) 2021 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
module GlobalLookups
|
||||
# This class is just a stub for overriding in
|
||||
# plugins in cases where that's useful.
|
||||
class Config
|
||||
def enabled?
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,34 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# Copyright (C) 2021 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
module GlobalLookups
|
||||
class DevUtils
|
||||
# this is a bit convoluted, but it makes it simpler
|
||||
# to have a module-level interface like this that
|
||||
# can be overidden easily in plugins by having
|
||||
# modules prepend themselves to override what "DevUtils" does.
|
||||
def initialize_ddb_for_development!(recreate: false)
|
||||
puts("Nothing to do for global lookups stub")
|
||||
end
|
||||
|
||||
def self.initialize_ddb_for_development!(recreate: false)
|
||||
GlobalLookups::DevUtils.new.initialize_ddb_for_development!(recreate: recreate)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue