Merge branch 'cale/singleton-watchers' into cale/stabilize-dev-env
Conflicts: CHANGELOG.rst
This commit is contained in:
@@ -11,6 +11,9 @@ XModule: Don't delete generated xmodule asset files when compiling (for
|
||||
instance, when XModule provides a coffeescript file, don't delete
|
||||
the associated javascript)
|
||||
|
||||
Common: Make asset watchers run as singletons (so they won't start if the
|
||||
watcher is already running in another shell).
|
||||
|
||||
Common: Make rake provide better error messages if packages are missing.
|
||||
|
||||
Common: Repairs development documentation generation by sphinx.
|
||||
|
||||
1
Gemfile
1
Gemfile
@@ -4,3 +4,4 @@ gem 'sass', '3.1.15'
|
||||
gem 'bourbon', '~> 1.3.6'
|
||||
gem 'colorize', '~> 0.5.8'
|
||||
gem 'launchy', '~> 2.1.2'
|
||||
gem 'sys-proctable', '~> 0.9.3'
|
||||
|
||||
@@ -114,9 +114,9 @@ namespace :assets do
|
||||
task :_watch => (prereq_tasks + ["assets:#{asset_type}:debug"]) do
|
||||
cmd = send(asset_type.to_s + "_cmd", watch=true, debug=true)
|
||||
if cmd.kind_of?(Array)
|
||||
cmd.each {|c| background_process(c)}
|
||||
cmd.each {|c| singleton_process(c)}
|
||||
else
|
||||
background_process(cmd)
|
||||
singleton_process(cmd)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
require 'digest/md5'
|
||||
require 'sys/proctable'
|
||||
require 'colorize'
|
||||
|
||||
def find_executable(exec)
|
||||
path = %x(which #{exec}).strip
|
||||
@@ -84,6 +86,16 @@ def background_process(*command)
|
||||
end
|
||||
end
|
||||
|
||||
# Runs a command as a background process, as long as no other processes
|
||||
# tagged with the same tag are running
|
||||
def singleton_process(*command)
|
||||
if Sys::ProcTable.ps.select {|proc| proc.cmdline.include?(command.join(' '))}.empty?
|
||||
background_process(*command)
|
||||
else
|
||||
puts "Process '#{command.join(' ')} already running, skipping".blue
|
||||
end
|
||||
end
|
||||
|
||||
def environments(system)
|
||||
Dir["#{system}/envs/**/*.py"].select{|file| ! (/__init__.py$/ =~ file)}.map do |env_file|
|
||||
env_file.gsub("#{system}/envs/", '').gsub(/\.py/, '').gsub('/', '.')
|
||||
|
||||
Reference in New Issue
Block a user