Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
b10c71d8
Commit
b10c71d8
authored
May 01, 2017
by
Ben Patterson
Committed by
Brian Jacobel
May 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let settings flow through.
parent
1778c1fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
pavelib/assets.py
+6
-6
pavelib/paver_tests/test_servers.py
+6
-3
pavelib/utils/envs.py
+8
-2
No files found.
pavelib/assets.py
View file @
b10c71d8
...
...
@@ -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
)
...
...
pavelib/paver_tests/test_servers.py
View file @
b10c71d8
...
...
@@ -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
...
...
pavelib/utils/envs.py
View file @
b10c71d8
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment