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
3a647662
Commit
3a647662
authored
Jun 24, 2016
by
Ben Patterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update based on feedback.
parent
383de2e2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
14 deletions
+16
-14
pavelib/assets.py
+7
-7
pavelib/paver_tests/test_assets.py
+1
-1
pavelib/paver_tests/test_servers.py
+6
-4
pavelib/servers.py
+2
-2
No files found.
pavelib/assets.py
View file @
3a647662
...
@@ -641,22 +641,23 @@ def restart_django_servers():
...
@@ -641,22 +641,23 @@ def restart_django_servers():
))
))
def
collect_assets
(
systems
,
settings
,
debug
_dict
):
def
collect_assets
(
systems
,
settings
,
debug
=
None
,
collectstatic_log
=
None
):
"""
"""
Collect static assets, including Django pipeline processing.
Collect static assets, including Django pipeline processing.
`systems` is a list of systems (e.g. 'lms' or 'studio' or both)
`systems` is a list of systems (e.g. 'lms' or 'studio' or both)
`settings` is the Django settings module to use.
`settings` is the Django settings module to use.
`debug_dict` is describes where to pipe collectstatic output
`debug` and `collectstatic_log` are used for determining where to
pipe collectstatic logging.
"""
"""
# unless specified, collectstatic (which can be very verbose) pipes to /dev/null
# unless specified, collectstatic (which can be very verbose) pipes to /dev/null
collectstatic_stdout_str
=
"> /dev/null"
collectstatic_stdout_str
=
"> /dev/null"
if
debug
_dict
[
"debug"
]
:
if
debug
:
# pipe to console
# pipe to console
collectstatic_stdout_str
=
""
collectstatic_stdout_str
=
""
if
debug_dict
[
"collect_log"
]
:
if
collectstatic_log
:
# pipe to specified file
# pipe to specified file
collectstatic_stdout_str
=
"> {output_file}"
.
format
(
output_file
=
debug_dict
[
"collect_log"
]
)
collectstatic_stdout_str
=
"> {output_file}"
.
format
(
output_file
=
collectstatic_log
)
for
sys
in
systems
:
for
sys
in
systems
:
sh
(
django_cmd
(
sys
,
settings
,
"collectstatic --noinput {logfile_str}"
.
format
(
sh
(
django_cmd
(
sys
,
settings
,
"collectstatic --noinput {logfile_str}"
.
format
(
...
@@ -790,9 +791,8 @@ def update_assets(args):
...
@@ -790,9 +791,8 @@ def update_assets(args):
# Compile sass for themes and system
# Compile sass for themes and system
execute_compile_sass
(
args
)
execute_compile_sass
(
args
)
collectstatic_debug_dict
=
{
"debug"
:
args
.
debug
,
"collect_log"
:
args
.
collect_log_file
}
if
args
.
collect
:
if
args
.
collect
:
collect_assets
(
args
.
system
,
args
.
settings
,
collectstatic_debug_dict
)
collect_assets
(
args
.
system
,
args
.
settings
,
debug
=
args
.
debug
,
collectstatic_log
=
args
.
collect_log_file
)
if
args
.
watch
:
if
args
.
watch
:
call_task
(
call_task
(
...
...
pavelib/paver_tests/test_assets.py
View file @
3a647662
...
@@ -212,5 +212,5 @@ class test_collect_assets(PaverTestCase):
...
@@ -212,5 +212,5 @@ class test_collect_assets(PaverTestCase):
pass
pass
def
test_collect_assets_debug
(
self
):
def
test_collect_assets_debug
(
self
):
debug_tuple
=
{
"debug"
:
False
,
"collect_log"
:
None
}
collect_assets
(
"foo"
,
"bar"
,
debug
=
True
)
# TODO
# TODO
pavelib/paver_tests/test_servers.py
View file @
3a647662
...
@@ -33,7 +33,7 @@ EXPECTED_PREPROCESS_ASSETS_COMMAND = (
...
@@ -33,7 +33,7 @@ EXPECTED_PREPROCESS_ASSETS_COMMAND = (
u" {system}/static/sass/*.scss {system}/static/themed_sass"
u" {system}/static/sass/*.scss {system}/static/themed_sass"
)
)
EXPECTED_COLLECT_STATIC_COMMAND
=
(
EXPECTED_COLLECT_STATIC_COMMAND
=
(
u"python manage.py {system} --settings={asset_settings} collectstatic --noinput
> /dev/null
"
u"python manage.py {system} --settings={asset_settings} collectstatic --noinput
{log_string}
"
)
)
EXPECTED_CELERY_COMMAND
=
(
EXPECTED_CELERY_COMMAND
=
(
u"python manage.py lms --settings={settings} celery worker --beat --loglevel=INFO --pythonpath=."
u"python manage.py lms --settings={settings} celery worker --beat --loglevel=INFO --pythonpath=."
...
@@ -197,6 +197,7 @@ class TestPaverServerTasks(PaverTestCase):
...
@@ -197,6 +197,7 @@ class TestPaverServerTasks(PaverTestCase):
"""
"""
Verify the output of a server task.
Verify the output of a server task.
"""
"""
log_string
=
options
.
get
(
"log_string"
,
"> /dev/null"
)
settings
=
options
.
get
(
"settings"
,
None
)
settings
=
options
.
get
(
"settings"
,
None
)
asset_settings
=
options
.
get
(
"asset-settings"
,
None
)
asset_settings
=
options
.
get
(
"asset-settings"
,
None
)
is_optimized
=
options
.
get
(
"optimized"
,
False
)
is_optimized
=
options
.
get
(
"optimized"
,
False
)
...
@@ -242,7 +243,7 @@ class TestPaverServerTasks(PaverTestCase):
...
@@ -242,7 +243,7 @@ class TestPaverServerTasks(PaverTestCase):
expected_messages
.
extend
(
self
.
expected_sass_commands
(
system
=
system
,
asset_settings
=
expected_asset_settings
))
expected_messages
.
extend
(
self
.
expected_sass_commands
(
system
=
system
,
asset_settings
=
expected_asset_settings
))
if
expected_collect_static
:
if
expected_collect_static
:
expected_messages
.
append
(
EXPECTED_COLLECT_STATIC_COMMAND
.
format
(
expected_messages
.
append
(
EXPECTED_COLLECT_STATIC_COMMAND
.
format
(
system
=
system
,
asset_settings
=
expected_asset_settings
system
=
system
,
asset_settings
=
expected_asset_settings
,
log_string
=
log_string
))
))
expected_run_server_command
=
EXPECTED_RUN_SERVER_COMMAND
.
format
(
expected_run_server_command
=
EXPECTED_RUN_SERVER_COMMAND
.
format
(
system
=
system
,
system
=
system
,
...
@@ -258,6 +259,7 @@ class TestPaverServerTasks(PaverTestCase):
...
@@ -258,6 +259,7 @@ class TestPaverServerTasks(PaverTestCase):
"""
"""
Verify the output of a server task.
Verify the output of a server task.
"""
"""
log_string
=
options
.
get
(
"log_string"
,
"> /dev/null"
)
settings
=
options
.
get
(
"settings"
,
None
)
settings
=
options
.
get
(
"settings"
,
None
)
asset_settings
=
options
.
get
(
"asset_settings"
,
None
)
asset_settings
=
options
.
get
(
"asset_settings"
,
None
)
is_optimized
=
options
.
get
(
"optimized"
,
False
)
is_optimized
=
options
.
get
(
"optimized"
,
False
)
...
@@ -284,10 +286,10 @@ class TestPaverServerTasks(PaverTestCase):
...
@@ -284,10 +286,10 @@ class TestPaverServerTasks(PaverTestCase):
expected_messages
.
extend
(
self
.
expected_sass_commands
(
asset_settings
=
expected_asset_settings
))
expected_messages
.
extend
(
self
.
expected_sass_commands
(
asset_settings
=
expected_asset_settings
))
if
expected_collect_static
:
if
expected_collect_static
:
expected_messages
.
append
(
EXPECTED_COLLECT_STATIC_COMMAND
.
format
(
expected_messages
.
append
(
EXPECTED_COLLECT_STATIC_COMMAND
.
format
(
system
=
"lms"
,
asset_settings
=
expected_asset_settings
system
=
"lms"
,
asset_settings
=
expected_asset_settings
,
log_string
=
log_string
))
))
expected_messages
.
append
(
EXPECTED_COLLECT_STATIC_COMMAND
.
format
(
expected_messages
.
append
(
EXPECTED_COLLECT_STATIC_COMMAND
.
format
(
system
=
"cms"
,
asset_settings
=
expected_asset_settings
system
=
"cms"
,
asset_settings
=
expected_asset_settings
,
log_string
=
log_string
))
))
expected_messages
.
append
(
expected_messages
.
append
(
EXPECTED_RUN_SERVER_COMMAND
.
format
(
EXPECTED_RUN_SERVER_COMMAND
.
format
(
...
...
pavelib/servers.py
View file @
3a647662
...
@@ -213,8 +213,8 @@ def run_all_servers(options):
...
@@ -213,8 +213,8 @@ def run_all_servers(options):
# means that the optimized assets are ignored, so we skip collectstatic in that
# means that the optimized assets are ignored, so we skip collectstatic in that
# case to save time.
# case to save time.
if
settings
!=
DEFAULT_SETTINGS
:
if
settings
!=
DEFAULT_SETTINGS
:
collect_assets
([
'lms'
],
asset_settings_lms
,
"/dev/null"
)
collect_assets
([
'lms'
],
asset_settings_lms
,
collectstatic_log
=
"/dev/null"
)
collect_assets
([
'studio'
],
asset_settings_cms
,
"/dev/null"
)
collect_assets
([
'studio'
],
asset_settings_cms
,
collectstatic_log
=
"/dev/null"
)
# Install an asset watcher to regenerate files that change
# Install an asset watcher to regenerate files that change
call_task
(
'pavelib.assets.watch_assets'
,
options
=
{
'background'
:
True
})
call_task
(
'pavelib.assets.watch_assets'
,
options
=
{
'background'
:
True
})
...
...
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