Commit b10c71d8 by Ben Patterson Committed by Brian Jacobel

Let settings flow through.

parent 1778c1fc
......@@ -704,16 +704,16 @@ def execute_compile_sass(args):
)
def execute_webpack(prod):
def execute_webpack(prod, settings=None):
sh(cmd("NODE_ENV={node_env} STATIC_ROOT={static_root} $(npm bin)/webpack".format(
node_env="production" if prod else "development",
static_root=Env.get_django_setting("STATIC_ROOT", "lms")
static_root=Env.get_django_setting("STATIC_ROOT", "lms", settings=settings)
)))
def execute_webpack_watch():
def execute_webpack_watch(settings=None):
run_background_process("STATIC_ROOT={static_root} $(npm bin)/webpack --watch --watch-poll=200".format(
static_root=Env.get_django_setting("STATIC_ROOT", "lms")
static_root=Env.get_django_setting("STATIC_ROOT", "lms", settings=settings)
))
......@@ -786,7 +786,7 @@ def watch_assets(options):
# We only want Webpack to re-run on changes to its own entry points, not all JS files, so we use its own watcher
# instead of subclassing from Watchdog like the other watchers do
execute_webpack_watch()
execute_webpack_watch(settings='devstack')
if not getattr(options, 'background', False):
# when running as a separate process, the main thread needs to loop
......@@ -848,7 +848,7 @@ def update_assets(args):
process_xmodule_assets()
process_npm_assets()
compile_coffeescript()
execute_webpack(prod=(args.settings != "devstack"))
execute_webpack(prod=(args.settings != "devstack"), settings=args.settings)
# Compile sass for themes and system
execute_compile_sass(args)
......
......@@ -42,7 +42,7 @@ EXPECTED_INDEX_COURSE_COMMAND = (
u"python manage.py {system} --settings={settings} reindex_course --setup"
)
EXPECTED_PRINT_SETTINGS_COMMAND = (
u"python manage.py {system} --settings=aws print_settings STATIC_ROOT --format=value 2>/dev/null"
u"python manage.py {system} --settings={settings} print_settings STATIC_ROOT --format=value 2>/dev/null"
)
EXPECTED_WEBPACK_COMMAND = (
u"NODE_ENV={node_env} STATIC_ROOT={static_root} $(npm bin)/webpack"
......@@ -240,7 +240,10 @@ class TestPaverServerTasks(PaverTestCase):
expected_messages.append(u"xmodule_assets common/static/xmodule")
expected_messages.append(u"install npm_assets")
expected_messages.append(EXPECTED_COFFEE_COMMAND.format(platform_root=self.platform_root))
expected_messages.append(EXPECTED_PRINT_SETTINGS_COMMAND.format(system="lms"))
expected_messages.append(EXPECTED_PRINT_SETTINGS_COMMAND.format(
system="lms",
settings=expected_asset_settings
))
expected_messages.append(EXPECTED_WEBPACK_COMMAND.format(
node_env="production" if expected_asset_settings != "devstack" else "development",
static_root=None
......@@ -282,7 +285,7 @@ class TestPaverServerTasks(PaverTestCase):
expected_messages.append(u"xmodule_assets common/static/xmodule")
expected_messages.append(u"install npm_assets")
expected_messages.append(EXPECTED_COFFEE_COMMAND.format(platform_root=self.platform_root))
expected_messages.append(EXPECTED_PRINT_SETTINGS_COMMAND.format(system="lms"))
expected_messages.append(EXPECTED_PRINT_SETTINGS_COMMAND.format(system="lms", settings=expected_asset_settings))
expected_messages.append(EXPECTED_WEBPACK_COMMAND.format(
node_env="production" if expected_asset_settings != "devstack" else "development",
static_root=None
......
......@@ -174,14 +174,20 @@ class Env(object):
SERVICE_VARIANT = 'lms'
@classmethod
def get_django_setting(self, django_setting, system):
def get_django_setting(self, django_setting, system, settings=None):
"""
Interrogate Django environment for specific settings values
:param django_setting: the django setting to get
:param system: the django app to use when asking for the setting (lms | cms)
:param settings: the settings file to use when asking for the value
:return: unicode value of the django setting
"""
if not settings:
settings = os.environ.get("EDX_PLATFORM_SETTINGS", "aws")
value = sh(
django_cmd(
system,
os.environ.get("EDX_PLATFORM_SETTINGS", "aws"),
settings,
"print_settings {django_setting} --format=value 2>/dev/null".format(
django_setting=django_setting
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment