add guard livereload

This commit is contained in:
Tanguy PATTE 2015-11-20 13:54:23 +01:00
parent 1379d6d495
commit bcf712828e
3 changed files with 54 additions and 1 deletions

View file

@ -76,6 +76,7 @@ group :test do
gem 'timecop' gem 'timecop'
gem 'guard' gem 'guard'
gem 'guard-rspec', require: false gem 'guard-rspec', require: false
gem 'guard-livereload', '~> 2.4', require: false
end end
group :development, :test do group :development, :test do

View file

@ -109,7 +109,11 @@ GEM
activemodel (>= 3.0) activemodel (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
request_store (~> 1.0) request_store (~> 1.0)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0) erubis (2.7.0)
eventmachine (1.0.8)
execjs (2.5.2) execjs (2.5.2)
factory_girl (4.5.0) factory_girl (4.5.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@ -130,6 +134,12 @@ GEM
pry (>= 0.9.12) pry (>= 0.9.12)
shellany (~> 0.0) shellany (~> 0.0)
thor (>= 0.18.1) thor (>= 0.18.1)
guard-compat (1.2.1)
guard-livereload (2.5.1)
em-websocket (~> 0.5)
guard (~> 2.8)
guard-compat (~> 1.0)
multi_json (~> 1.8)
guard-rspec (4.3.1) guard-rspec (4.3.1)
guard (~> 2.1) guard (~> 2.1)
rspec (>= 2.14, < 4.0) rspec (>= 2.14, < 4.0)
@ -149,6 +159,7 @@ GEM
ruby_parser (~> 3.5) ruby_parser (~> 3.5)
http-cookie (1.0.2) http-cookie (1.0.2)
domain_name (~> 0.5) domain_name (~> 0.5)
http_parser.rb (0.6.0)
httpclient (2.6.0.1) httpclient (2.6.0.1)
i18n (0.7.0) i18n (0.7.0)
jbuilder (2.3.1) jbuilder (2.3.1)
@ -417,6 +428,7 @@ DEPENDENCIES
factory_girl factory_girl
font-awesome-rails font-awesome-rails
guard guard
guard-livereload (~> 2.4)
guard-rspec guard-rspec
haml-rails haml-rails
hashie hashie

View file

@ -23,6 +23,47 @@
# installed the spring binstubs per the docs) # installed the spring binstubs per the docs)
# * zeus: 'zeus rspec' (requires the server to be started separetly) # * zeus: 'zeus rspec' (requires the server to be started separetly)
# * 'just' rspec: 'rspec' # * 'just' rspec: 'rspec'
guard 'livereload' do
extensions = {
css: :css,
scss: :css,
sass: :css,
js: :js,
coffee: :js,
html: :html,
png: :png,
gif: :gif,
jpg: :jpg,
jpeg: :jpeg,
# less: :less, # uncomment if you want LESS stylesheets done in browser
}
rails_view_exts = %w(erb haml slim)
# file types LiveReload may optimize refresh for
compiled_exts = extensions.values.uniq
watch(%r{public/.+\.(#{compiled_exts * '|'})})
extensions.each do |ext, type|
watch(%r{
(?:app|vendor)
(?:/assets/\w+/(?<path>[^.]+) # path+base without extension
(?<ext>\.#{ext})) # matching extension (must be first encountered)
(?:\.\w+|$) # other extensions
}x) do |m|
path = m[1]
"/assets/#{path}.#{type}"
end
end
# file needing a full reload of the page anyway
watch(%r{app/views/.+\.(#{rails_view_exts * '|'})$})
watch(%r{app/helpers/.+\.rb})
watch(%r{config/locales/.+\.yml})
end
guard :rspec, cmd: 'bin/rspec' do guard :rspec, cmd: 'bin/rspec' do
watch(%r{^spec/.+_spec\.rb$}) watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
@ -44,4 +85,3 @@ guard :rspec, cmd: 'bin/rspec' do
watch(%r{^spec/acceptance/(.+)\.feature$}) watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end end