add qunit to autospec
This commit is contained in:
parent
e679ba97a3
commit
b56b11d96a
18 changed files with 921 additions and 571 deletions
lib/autospec
|
@ -1,23 +1,23 @@
|
|||
module Autospec; end
|
||||
|
||||
class Autospec::ReloadCss
|
||||
|
||||
MATCHERS = {}
|
||||
WATCHERS = {}
|
||||
def self.watch(pattern, &blk)
|
||||
MATCHERS[pattern] = blk
|
||||
WATCHERS[pattern] = blk
|
||||
end
|
||||
|
||||
watch(/tmp\/refresh_browser/)
|
||||
# css, scss, sass or handlebars
|
||||
watch(/\.css$/)
|
||||
watch(/\.css\.erb$/)
|
||||
watch(/\.sass$/)
|
||||
watch(/\.scss$/)
|
||||
watch(/\.sass\.erb$/)
|
||||
watch(/\.ca?ss\.erb$/)
|
||||
watch(/\.s[ac]ss$/)
|
||||
watch(/\.handlebars$/)
|
||||
|
||||
def self.message_bus
|
||||
MessageBus::Instance.new.tap do |bus|
|
||||
bus.site_id_lookup do
|
||||
# this is going to be dev the majority of the time, if you have multisite configured in dev stuff may be different
|
||||
# this is going to be dev the majority of the time
|
||||
# if you have multisite configured in dev stuff may be different
|
||||
"default"
|
||||
end
|
||||
end
|
||||
|
@ -26,13 +26,13 @@ class Autospec::ReloadCss
|
|||
def self.run_on_change(paths)
|
||||
paths.map! do |p|
|
||||
hash = nil
|
||||
fullpath = Rails.root.to_s + "/" + p
|
||||
hash = Digest::MD5.hexdigest(File.read(fullpath)) if File.exists? fullpath
|
||||
fullpath = "#{Rails.root}/#{p}"
|
||||
hash = Digest::MD5.hexdigest(File.read(fullpath)) if File.exists?(fullpath)
|
||||
p = p.sub /\.sass\.erb/, ""
|
||||
p = p.sub /\.sass/, ""
|
||||
p = p.sub /\.scss/, ""
|
||||
p = p.sub /^app\/assets\/stylesheets/, "assets"
|
||||
{name: p, hash: hash}
|
||||
{ name: p, hash: hash }
|
||||
end
|
||||
message_bus.publish "/file-change", paths
|
||||
end
|
||||
|
|
Reference in a new issue