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 ...@@ -26,13 +26,17 @@ end
desc "Compile all assets" desc "Compile all assets"
multitask :assets => 'assets:all' multitask :assets => 'assets:all'
desc "Compile all assets in debug mode" namespace :assets do
multitask 'assets:debug'
desc "Watch all assets for changes and automatically recompile" desc "Compile all assets in debug mode"
multitask 'assets:watch' 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, {:xmodule => :install_python_prereqs,
:coffee => :install_node_prereqs, :coffee => :install_node_prereqs,
:sass => :install_ruby_prereqs}.each_pair do |asset_type, prereq_task| :sass => :install_ruby_prereqs}.each_pair do |asset_type, prereq_task|
...@@ -44,7 +48,7 @@ namespace :assets do ...@@ -44,7 +48,7 @@ namespace :assets do
multitask :all => asset_type multitask :all => asset_type
multitask :debug => "assets:#{asset_type}:debug" multitask :debug => "assets:#{asset_type}:debug"
multitask :watch => "assets:#{asset_type}:watch" multitask :_watch => "assets:#{asset_type}:_watch"
namespace asset_type do namespace asset_type do
desc "Compile all #{asset_type} assets in debug mode" desc "Compile all #{asset_type} assets in debug mode"
...@@ -54,21 +58,31 @@ namespace :assets do ...@@ -54,21 +58,31 @@ namespace :assets do
end end
desc "Watch all #{asset_type} assets and compile on change" 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) cmd = send(asset_type.to_s + "_cmd", watch=true, debug=true)
background_process(cmd) background_process(cmd)
end end
end end
end end
multitask :sass => 'assets:xmodule'
namespace :sass do
# In watch mode, sass doesn't immediately compile out of date files, # In watch mode, sass doesn't immediately compile out of date files,
# so force a recompile first # so force a recompile first
task "sass:watch" => "assets:sass:debug" task :_watch => 'assets:sass:debug'
multitask :debug => 'assets:xmodule:debug'
end
multitask :sass => 'assets:xmodule'
multitask 'sass:debug' => 'assets:xmodule:debug'
multitask :coffee => 'assets:xmodule' multitask :coffee => 'assets:xmodule'
multitask 'coffee:debug' => 'assets:xmodule:debug' namespace :coffee do
multitask :debug => 'assets:xmodule:debug'
end
end end
[:lms, :cms].each do |system| [:lms, :cms].each do |system|
......
...@@ -20,7 +20,7 @@ end ...@@ -20,7 +20,7 @@ end
Start the #{system} locally with the specified environment (defaults to dev). Start the #{system} locally with the specified environment (defaults to dev).
Other useful environments are devplus (for dev testing with a real local database) Other useful environments are devplus (for dev testing with a real local database)
desc 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]) args.with_defaults(:env => 'dev', :options => default_options[system])
sh(django_admin(system, args.env, 'runserver', args.options)) sh(django_admin(system, args.env, 'runserver', args.options))
end 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