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
58926759
Commit
58926759
authored
Apr 12, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run coffee and sass in watch mode when running lms or cms, and oneshot before running collectstatic
parent
291e772c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
16 deletions
+54
-16
rakefile
+54
-16
No files found.
rakefile
View file @
58926759
...
@@ -34,16 +34,42 @@ def django_admin(system, env, command, *args)
...
@@ -34,16 +34,42 @@ def django_admin(system, env, command, *args)
return
"
#{
django_admin
}
#{
command
}
--traceback --settings=
#{
system
}
.envs.
#{
env
}
--pythonpath=.
#{
args
.
join
(
' '
)
}
"
return
"
#{
django_admin
}
#{
command
}
--traceback --settings=
#{
system
}
.envs.
#{
env
}
--pythonpath=.
#{
args
.
join
(
' '
)
}
"
end
end
# Runs Process.spawn, and kills the process at the end of the rake process
# Expects the same arguments as Process.spawn
def
background_process
(
*
command
)
pid
=
Process
.
spawn
(
*
command
,
:pgroup
=>
true
)
at_exit
do
puts
"Ending process and children"
pgid
=
Process
.
getpgid
(
pid
)
begin
Timeout
.
timeout
(
5
)
do
puts
"Terminating process group
#{
pgid
}
"
Process
.
kill
(
:SIGTERM
,
-
pgid
)
puts
"Waiting on process group
#{
pgid
}
"
Process
.
wait
(
-
pgid
)
puts
"Done waiting on process group
#{
pgid
}
"
end
rescue
Timeout
::
Error
puts
"Killing process group
#{
pgid
}
"
Process
.
kill
(
:SIGKILL
,
-
pgid
)
puts
"Waiting on process group
#{
pgid
}
"
Process
.
wait
(
-
pgid
)
puts
"Done waiting on process group
#{
pgid
}
"
end
end
end
def
django_for_jasmine
(
system
,
django_reload
)
def
django_for_jasmine
(
system
,
django_reload
)
if
!
django_reload
if
!
django_reload
reload_arg
=
'--noreload'
reload_arg
=
'--noreload'
end
end
port
=
10000
+
rand
(
40000
)
port
=
10000
+
rand
(
40000
)
django_pid
=
fork
do
exec
(
*
django_admin
(
system
,
'jasmine'
,
'runserver'
,
'-v'
,
'0'
,
port
.
to_s
,
reload_arg
).
split
(
' '
))
end
jasmine_url
=
"http://localhost:
#{
port
}
/_jasmine/"
jasmine_url
=
"http://localhost:
#{
port
}
/_jasmine/"
background_process
(
*
django_admin
(
system
,
'jasmine'
,
'runserver'
,
'-v'
,
'0'
,
port
.
to_s
,
reload_arg
).
split
(
' '
))
up
=
false
up
=
false
start_time
=
Time
.
now
start_time
=
Time
.
now
until
up
do
until
up
do
...
@@ -61,16 +87,7 @@ def django_for_jasmine(system, django_reload)
...
@@ -61,16 +87,7 @@ def django_for_jasmine(system, django_reload)
sleep
(
0.5
)
sleep
(
0.5
)
end
end
end
end
begin
yield
jasmine_url
yield
jasmine_url
ensure
if
django_reload
Process
.
kill
(
:SIGKILL
,
-
Process
.
getpgid
(
django_pid
))
else
Process
.
kill
(
:SIGKILL
,
django_pid
)
end
Process
.
wait
(
django_pid
)
end
end
end
def
template_jasmine_runner
(
lib
)
def
template_jasmine_runner
(
lib
)
...
@@ -102,6 +119,25 @@ def report_dir_path(dir)
...
@@ -102,6 +119,25 @@ def report_dir_path(dir)
return
File
.
join
(
REPORT_DIR
,
dir
.
to_s
)
return
File
.
join
(
REPORT_DIR
,
dir
.
to_s
)
end
end
def
compile_assets
(
watch
=
false
)
coffee_cmd
=
"coffee
#{
watch
?
'--watch'
:
''
}
--compile */static"
sass_cmd
=
"sass --style compressed --require ./common/static/sass/bourbon/lib/bourbon.rb
#{
watch
?
'--watch'
:
'--update'
}
*/static"
if
watch
background_process
(
coffee_cmd
)
background_process
(
sass_cmd
)
else
coffee_pid
=
Process
.
spawn
(
coffee_cmd
)
puts
"Waiting for coffee to complete (pid
#{
coffee_pid
}
)"
Process
.
wait
(
coffee_pid
)
puts
"Coffee completed"
sass_pid
=
Process
.
spawn
(
sass_cmd
)
puts
"Waiting for sass to complete (pid
#{
sass_pid
}
)"
Process
.
wait
(
sass_pid
)
puts
"Sass completed"
end
end
task
:default
=>
[
:test
,
:pep8
,
:pylint
]
task
:default
=>
[
:test
,
:pep8
,
:pylint
]
directory
REPORT_DIR
directory
REPORT_DIR
...
@@ -182,7 +218,7 @@ end
...
@@ -182,7 +218,7 @@ end
# Per System tasks
# Per System tasks
desc
"Run all django tests on our djangoapps for the
#{
system
}
"
desc
"Run all django tests on our djangoapps for the
#{
system
}
"
task
"test_
#{
system
}
"
,
[
:stop_on_failure
]
=>
[
"clean_test_files"
,
"
#{
system
}
:collect
static
:test"
,
"fasttest_
#{
system
}
"
]
task
"test_
#{
system
}
"
,
[
:stop_on_failure
]
=>
[
"clean_test_files"
,
"
#{
system
}
:collect
_assets
:test"
,
"fasttest_
#{
system
}
"
]
# Have a way to run the tests without running collectstatic -- useful when debugging without
# Have a way to run the tests without running collectstatic -- useful when debugging without
# messing with static files.
# messing with static files.
...
@@ -201,6 +237,7 @@ end
...
@@ -201,6 +237,7 @@ end
desc
desc
task
system
,
[
:env
,
:options
]
=>
[
:predjango
]
do
|
t
,
args
|
task
system
,
[
:env
,
:options
]
=>
[
:predjango
]
do
|
t
,
args
|
args
.
with_defaults
(
:env
=>
'dev'
,
:options
=>
default_options
[
system
])
args
.
with_defaults
(
:env
=>
'dev'
,
:options
=>
default_options
[
system
])
compile_assets
(
watch
=
true
)
sh
(
django_admin
(
system
,
args
.
env
,
'runserver'
,
args
.
options
))
sh
(
django_admin
(
system
,
args
.
env
,
'runserver'
,
args
.
options
))
end
end
...
@@ -213,8 +250,9 @@ end
...
@@ -213,8 +250,9 @@ end
end
end
desc
"Run collectstatic in the specified environment"
desc
"Run collectstatic in the specified environment"
task
"
#{
system
}
:collectstatic:
#{
env
}
"
=>
:predjango
do
task
"
#{
system
}
:collect_assets:
#{
env
}
"
do
sh
(
"
#{
django_admin
(
system
,
env
,
'collectstatic'
,
'--noinput'
)
}
> /tmp/collectstatic.out"
)
do
|
ok
,
status
|
compile_assets
()
sh
(
"
#{
django_admin
(
system
,
env
,
'collectstatic'
,
'--noinput'
)
}
> /dev/null"
)
do
|
ok
,
status
|
if
!
ok
if
!
ok
abort
"collectstatic failed!"
abort
"collectstatic failed!"
end
end
...
...
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