1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

extract livereload into gem

This commit is contained in:
Thomas Reynolds 2011-08-20 17:52:05 -07:00
parent feca0a0a2b
commit b2153db79f
4 changed files with 28 additions and 25 deletions

View file

@ -1,3 +1,7 @@
2.0.6
=====
- Pulled out livereload feature into its own extension, still installed by default.
2.0.5 2.0.5
===== =====
- Vendored Padrino 0.10.0 - Vendored Padrino 0.10.0

View file

@ -1,6 +1,5 @@
require "guard" require "guard"
require "guard/guard" require "guard/guard"
require "guard/livereload"
require "rbconfig" require "rbconfig"
if Config::CONFIG['host_os'].downcase =~ %r{mswin|mingw} if Config::CONFIG['host_os'].downcase =~ %r{mswin|mingw}
@ -8,34 +7,34 @@ if Config::CONFIG['host_os'].downcase =~ %r{mswin|mingw}
require 'win32console' require 'win32console'
end end
module Middleman::Guard module Middleman
def self.start(options={}, livereload={}) module Guard
options_hash = "" def self.add_guard(&block)
options.each do |k,v| @additional_guards ||= []
options_hash << ", :#{k} => '#{v}'" @additional_guards << block
end end
guardfile_contents = %Q{ def self.start(options={}, livereload={})
guard 'middleman'#{options_hash} do options_hash = ""
watch("config.rb") options.each do |k,v|
watch(%r{^lib/^[^\.](.*)\.rb$}) options_hash << ", :#{k} => '#{v}'"
end
}
if livereload
livereload_options_hash = ""
livereload.each do |k,v|
livereload_options_hash << ", :#{k} => '#{v}'"
end end
guardfile_contents << %Q{ guardfile_contents = %Q{
guard 'livereload'#{livereload_options_hash} do guard 'middleman'#{options_hash} do
watch(%r{^source/([^\.].*)$}) watch("config.rb")
watch(%r{^lib/^[^\.](.*)\.rb$})
end end
} }
end
::Guard.start({ :guardfile_contents => guardfile_contents }) (@additional_guards || []).each do |block|
result = block.call(options, livereload)
guardfile_contents << result unless result.nil?
end
$stderr.puts guardfile_contents
::Guard.start({ :guardfile_contents => guardfile_contents })
end
end end
end end

View file

@ -1,3 +1,3 @@
module Middleman module Middleman
VERSION = "2.0.5" VERSION = "2.0.6"
end end

View file

@ -69,7 +69,7 @@ eos
end end
s.add_runtime_dependency("guard", ["~> 0.6.2"]) s.add_runtime_dependency("guard", ["~> 0.6.2"])
s.add_runtime_dependency("guard-livereload", ["~> 0.3.0"]) s.add_runtime_dependency("middleman-livereload", ["~> 0.2.0"])
s.add_development_dependency("coffee-filter", ["~> 0.1.1"]) s.add_development_dependency("coffee-filter", ["~> 0.1.1"])
s.add_development_dependency("cucumber", ["~> 1.0.2"]) s.add_development_dependency("cucumber", ["~> 1.0.2"])
s.add_development_dependency("rake", ["0.8.7"]) s.add_development_dependency("rake", ["0.8.7"])