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
383de2e2
Commit
383de2e2
authored
Jun 22, 2016
by
Ben Patterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consider debug switch in how we decide what to do with logs
parent
9e49a7b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
pavelib/assets.py
+18
-6
pavelib/paver_tests/test_assets.py
+12
-0
No files found.
pavelib/assets.py
View file @
383de2e2
...
...
@@ -641,15 +641,26 @@ def restart_django_servers():
))
def
collect_assets
(
systems
,
settings
,
output_file
):
def
collect_assets
(
systems
,
settings
,
debug_dict
):
"""
Collect static assets, including Django pipeline processing.
`systems` is a list of systems (e.g. 'lms' or 'studio' or both)
`settings` is the Django settings module to use.
`debug_dict` is describes where to pipe collectstatic output
"""
# unless specified, collectstatic (which can be very verbose) pipes to /dev/null
collectstatic_stdout_str
=
"> /dev/null"
if
debug_dict
[
"debug"
]:
# pipe to console
collectstatic_stdout_str
=
""
if
debug_dict
[
"collect_log"
]:
# pipe to specified file
collectstatic_stdout_str
=
"> {output_file}"
.
format
(
output_file
=
debug_dict
[
"collect_log"
])
for
sys
in
systems
:
sh
(
django_cmd
(
sys
,
settings
,
"collectstatic --noinput
> {logfile
}"
.
format
(
logfile
=
output_file
sh
(
django_cmd
(
sys
,
settings
,
"collectstatic --noinput
{logfile_str
}"
.
format
(
logfile
_str
=
collectstatic_stdout_str
)))
print
(
"
\t\t
Finished collecting {} assets."
.
format
(
sys
))
...
...
@@ -766,8 +777,8 @@ def update_assets(args):
help
=
"list of themes to compile sass for"
,
)
parser
.
add_argument
(
'--collect-log'
,
dest
=
'collect_log_file'
,
default
=
"/dev/null"
,
help
=
"When running collectstatic, direct output to
this
log file"
,
'--collect-log'
,
dest
=
'collect_log_file'
,
default
=
None
,
help
=
"When running collectstatic, direct output to
specified
log file"
,
)
args
=
parser
.
parse_args
(
args
)
...
...
@@ -779,8 +790,9 @@ def update_assets(args):
# Compile sass for themes and system
execute_compile_sass
(
args
)
collectstatic_debug_dict
=
{
"debug"
:
args
.
debug
,
"collect_log"
:
args
.
collect_log_file
}
if
args
.
collect
:
collect_assets
(
args
.
system
,
args
.
settings
,
args
.
collect_log_file
)
collect_assets
(
args
.
system
,
args
.
settings
,
collectstatic_debug_dict
)
if
args
.
watch
:
call_task
(
...
...
pavelib/paver_tests/test_assets.py
View file @
383de2e2
...
...
@@ -3,6 +3,7 @@
import
ddt
import
os
from
unittest
import
TestCase
from
pavelib.assets
import
collect_assets
from
paver.easy
import
call_task
,
path
from
mock
import
patch
from
watchdog.observers.polling
import
PollingObserver
...
...
@@ -202,3 +203,14 @@ class TestPaverWatchAssetTasks(TestCase):
self
.
assertIsInstance
(
sass_watcher_args
[
0
],
PollingObserver
)
self
.
assertIsInstance
(
sass_watcher_args
[
1
],
list
)
self
.
assertItemsEqual
(
sass_watcher_args
[
1
],
self
.
expected_sass_directories
)
class
test_collect_assets
(
PaverTestCase
):
"""
Test the collectstatic process call
"""
def
setUp
(
self
):
pass
def
test_collect_assets_debug
(
self
):
debug_tuple
=
{
"debug"
:
False
,
"collect_log"
:
None
}
# TODO
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