Commit b5c134e2 by Calen Pennington

Make the externally facing asset watch commands wait for user intervention, and…

Make the externally facing asset watch commands wait for user intervention, and add internal tasks that only run as long as the rake process
parent 91dce34f
......@@ -26,13 +26,17 @@ end
desc "Compile all assets"
multitask :assets => 'assets:all'
desc "Compile all assets in debug mode"
multitask 'assets:debug'
namespace :assets do
desc "Watch all assets for changes and automatically recompile"
multitask 'assets:watch'
desc "Compile all assets in debug mode"
multitask :debug
desc "Watch all assets for changes and automatically recompile"
task :watch => 'assets:_watch' do
puts "Press ENTER to terminate".red
$stdin.gets
end
namespace :assets do
{:xmodule => :install_python_prereqs,
:coffee => :install_node_prereqs,
:sass => :install_ruby_prereqs}.each_pair do |asset_type, prereq_task|
......@@ -44,7 +48,7 @@ namespace :assets do
multitask :all => asset_type
multitask :debug => "assets:#{asset_type}:debug"
multitask :watch => "assets:#{asset_type}:watch"
multitask :_watch => "assets:#{asset_type}:_watch"
namespace asset_type do
desc "Compile all #{asset_type} assets in debug mode"
......@@ -54,21 +58,31 @@ namespace :assets do
end
desc "Watch all #{asset_type} assets and compile on change"
task :watch => prereq_task do
task :watch => "assets:#{asset_type}:_watch" do
puts "Press ENTER to terminate".red
$stdin.gets
end
task :_watch => prereq_task do
cmd = send(asset_type.to_s + "_cmd", watch=true, debug=true)
background_process(cmd)
end
end
end
# In watch mode, sass doesn't immediately compile out of date files,
# so force a recompile first
task "sass:watch" => "assets:sass:debug"
multitask :sass => 'assets:xmodule'
multitask 'sass:debug' => 'assets:xmodule:debug'
namespace :sass do
# In watch mode, sass doesn't immediately compile out of date files,
# so force a recompile first
task :_watch => 'assets:sass:debug'
multitask :debug => 'assets:xmodule:debug'
end
multitask :coffee => 'assets:xmodule'
multitask 'coffee:debug' => 'assets:xmodule:debug'
namespace :coffee do
multitask :debug => 'assets:xmodule:debug'
end
end
[:lms, :cms].each do |system|
......
......@@ -20,7 +20,7 @@ end
Start the #{system} locally with the specified environment (defaults to dev).
Other useful environments are devplus (for dev testing with a real local database)
desc
task system, [:env, :options] => [:install_prereqs, 'assets:watch', :predjango] do |t, args|
task system, [:env, :options] => [:install_prereqs, 'assets:_watch', :predjango] do |t, args|
args.with_defaults(:env => 'dev', :options => default_options[system])
sh(django_admin(system, args.env, 'runserver', args.options))
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment