Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
d4d9a113
Unverified
Commit
d4d9a113
authored
7 years ago
by
Michael Youngstrom
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Watch assets on specific system."
parent
5b9b01b0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pavelib/assets.py
+7
-28
7 additions, 28 deletions
pavelib/assets.py
pavelib/paver_tests/test_assets.py
+0
-28
0 additions, 28 deletions
pavelib/paver_tests/test_assets.py
with
7 additions
and
56 deletions
pavelib/assets.py
+
7
−
28
View file @
d4d9a113
...
...
@@ -234,7 +234,7 @@ def get_system_sass_dirs(system):
return
dirs
def
get_watcher_dirs
(
theme_dirs
=
None
,
themes
=
None
,
system
=
None
):
def
get_watcher_dirs
(
theme_dirs
=
None
,
themes
=
None
):
"""
Return sass directories that need to be added to sass watcher.
...
...
@@ -252,43 +252,24 @@ def get_watcher_dirs(theme_dirs=None, themes=None, system=None):
'
/edx/app/edxapp/edx-platform/themes/red-theme/cms/static/sass/partials
'
,
]
>> get_watcher_dirs(
'
/edx/app/edx-platform/themes
'
, [
'
red-theme
'
], lms)
[
'
common/static
'
,
'
common/static/sass
'
,
'
lms/static/sass
'
,
'
lms/static/sass/partials
'
,
'
/edx/app/edxapp/edx-platform/themes/red-theme/lms/static/sass
'
,
'
/edx/app/edxapp/edx-platform/themes/red-theme/lms/static/sass/partials
'
,
]
Parameters:
theme_dirs (list): list of theme base directories.
themes (list): list containing names of themes.
system (str): the system for which the assets are watched.
themes (list): list containing names of themes
Returns:
(list): dirs that need to be added to sass watchers.
"""
dirs
=
[]
dirs
.
extend
(
COMMON_LOOKUP_PATHS
)
systems
=
list
(
system
)
if
system
else
ALL_SYSTEMS
if
theme_dirs
and
themes
:
# Register sass watchers for all the given themes
themes
=
get_theme_paths
(
themes
=
themes
,
theme_dirs
=
theme_dirs
)
for
theme
in
themes
:
system_dirs
=
[]
for
sys
in
systems
:
system_dirs
.
extend
(
get_sass_directories
(
sys
,
theme
))
for
_dir
in
system_dirs
:
for
_dir
in
get_sass_directories
(
'
lms
'
,
theme
)
+
get_sass_directories
(
'
cms
'
,
theme
):
dirs
.
append
(
_dir
[
'
sass_source_dir
'
])
dirs
.
extend
(
_dir
[
'
lookup_paths
'
])
# Register sass watchers for systems
system_dirs
=
[]
for
sys
in
systems
:
system_dirs
.
extend
(
get_sass_directories
(
sys
))
for
_dir
in
system_dirs
+
get_common_sass_directories
():
# Register sass watchers for lms and cms
for
_dir
in
get_sass_directories
(
'
lms
'
)
+
get_sass_directories
(
'
cms
'
)
+
get_common_sass_directories
():
dirs
.
append
(
_dir
[
'
sass_source_dir
'
])
dirs
.
extend
(
_dir
[
'
lookup_paths
'
])
...
...
@@ -899,8 +880,7 @@ def listfy(data):
(
'
background
'
,
'
b
'
,
'
Background mode
'
),
(
'
theme-dirs=
'
,
'
-td
'
,
'
The themes dir containing all themes (defaults to None)
'
),
(
'
themes=
'
,
'
-t
'
,
'
The themes to add sass watchers for (defaults to None)
'
),
(
'
wait=
'
,
'
-w
'
,
'
How long to pause between filesystem scans.
'
),
(
'
system=
'
,
'
s
'
,
'
The system to watch sass for (defaults to all)
'
)
(
'
wait=
'
,
'
-w
'
,
'
How long to pause between filesystem scans.
'
)
])
@timed
def
watch_assets
(
options
):
...
...
@@ -913,7 +893,6 @@ def watch_assets(options):
themes
=
get_parsed_option
(
options
,
'
themes
'
)
theme_dirs
=
get_parsed_option
(
options
,
'
theme_dirs
'
,
[])
system
=
get_parsed_option
(
options
,
'
system
'
)
default_wait
=
[
unicode
(
DEFAULT_OBSERVER_TIMEOUT
)]
wait
=
float
(
get_parsed_option
(
options
,
'
wait
'
,
default_wait
)[
0
])
...
...
@@ -924,7 +903,7 @@ def watch_assets(options):
else
:
theme_dirs
=
[
path
(
_dir
)
for
_dir
in
theme_dirs
]
sass_directories
=
get_watcher_dirs
(
theme_dirs
,
themes
,
system
=
system
)
sass_directories
=
get_watcher_dirs
(
theme_dirs
,
themes
)
observer
=
Observer
(
timeout
=
wait
)
CoffeeScriptWatcher
().
register
(
observer
)
...
...
This diff is collapsed.
Click to expand it.
pavelib/paver_tests/test_assets.py
+
0
−
28
View file @
d4d9a113
...
...
@@ -275,34 +275,6 @@ class TestPaverWatchAssetTasks(TestCase):
self
.
assertIsInstance
(
sass_watcher_args
[
1
],
list
)
self
.
assertItemsEqual
(
sass_watcher_args
[
1
],
self
.
expected_sass_directories
)
def
test_watch_lms_assets
(
self
):
"""
Test the Paver watch asset tasks with LMS system.
"""
expected_sass_directories
=
[
path
(
'
lms/static/sass/partials
'
),
path
(
'
lms/static/sass
'
),
path
(
'
lms/static/certificates/sass
'
)
]
with
patch
(
'
pavelib.assets.SassWatcher.register
'
)
as
mock_register
,
\
patch
(
'
pavelib.assets.Observer.start
'
),
\
patch
(
'
pavelib.assets.execute_webpack_watch
'
)
as
mock_webpack
:
call_task
(
'
pavelib.assets.watch_assets
'
,
options
=
{
"
background
"
:
True
,
"
system
"
:
'
lms
'
,
},
)
self
.
assertEqual
(
mock_register
.
call_count
,
2
)
self
.
assertEqual
(
mock_webpack
.
call_count
,
1
)
sass_watcher_args
=
mock_register
.
call_args_list
[
0
][
0
]
self
.
assertIsInstance
(
sass_watcher_args
[
0
],
Observer
)
self
.
assertIsInstance
(
sass_watcher_args
[
1
],
list
)
self
.
assertItemsEqual
(
sass_watcher_args
[
1
],
expected_sass_directories
)
@ddt.ddt
class
TestCollectAssets
(
PaverTestCase
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment