update gems
[oni_sorceress.git] / Guardfile
blobada2f37a6a2ac3bfe83cc0854654b934f1307e1f
1 # A sample Guardfile
2 # More info at https://github.com/guard/guard#readme
4 ## Uncomment and set this to only include directories you want to watch
5 # directories %w(app lib config test spec features) \
6 #  .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
8 ## Note: if you are using the `directories` clause above and you are not
9 ## watching the project directory ('.'), then you will want to move
10 ## the Guardfile to a watched dir and symlink it back, e.g.
12 #  $ mkdir config
13 #  $ mv Guardfile config/
14 #  $ ln -s config/Guardfile .
16 # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
18 guard 'livereload' do
19   extensions = {
20     css: :css,
21     scss: :css,
22     sass: :css,
23     js: :js,
24     coffee: :js,
25     html: :html,
26     png: :png,
27     gif: :gif,
28     jpg: :jpg,
29     jpeg: :jpeg,
30     # less: :less, # uncomment if you want LESS stylesheets done in browser
31   }
33   rails_view_exts = %w(erb haml slim)
35   # file types LiveReload may optimize refresh for
36   compiled_exts = extensions.values.uniq
37   watch(%r{public/.+\.(#{compiled_exts * '|'})})
39   extensions.each do |ext, type|
40     watch(%r{
41           (?:app|vendor)
42           (?:/assets/\w+/(?<path>[^.]+) # path+base without extension
43            (?<ext>\.#{ext})) # matching extension (must be first encountered)
44           (?:\.\w+|$) # other extensions
45           }x) do |m|
46       path = m[1]
47       "/assets/#{path}.#{type}"
48     end
49   end
51   # file needing a full reload of the page anyway
52   watch(%r{app/views/.+\.(#{rails_view_exts * '|'})$})
53   watch(%r{app/helpers/.+\.rb})
54   watch(%r{config/locales/.+\.yml})
55   # anything in app/
56   watch(%r{app/.+\.rb})
57 end
59 # Note: The cmd option is now required due to the increasing number of ways
60 #       rspec may be run, below are examples of the most common uses.
61 #  * bundler: 'bundle exec rspec'
62 #  * bundler binstubs: 'bin/rspec'
63 #  * spring: 'bin/rspec' (This will use spring if running and you have
64 #                          installed the spring binstubs per the docs)
65 #  * zeus: 'zeus rspec' (requires the server to be started separately)
66 #  * 'just' rspec: 'rspec'
68 guard :rspec, cmd: "bin/rspec" do
69   require "guard/rspec/dsl"
70   dsl = Guard::RSpec::Dsl.new(self)
72   # Feel free to open issues for suggestions and improvements
74   # RSpec files
75   rspec = dsl.rspec
76   watch(rspec.spec_helper) { rspec.spec_dir }
77   watch(rspec.spec_support) { rspec.spec_dir }
78   watch(rspec.spec_files)
80   # Ruby files
81   ruby = dsl.ruby
82   dsl.watch_spec_files_for(ruby.lib_files)
84   # Rails files
85   rails = dsl.rails(view_extensions: %w(erb haml slim))
86   dsl.watch_spec_files_for(rails.app_files)
87   dsl.watch_spec_files_for(rails.views)
89   watch(rails.controllers) do |m|
90     [
91       rspec.spec.call("routing/#{m[1]}_routing"),
92       rspec.spec.call("controllers/#{m[1]}_controller"),
93       rspec.spec.call("acceptance/#{m[1]}")
94     ]
95   end
97   # Rails config changes
98   watch(rails.spec_helper)     { rspec.spec_dir }
99   watch(rails.routes)          { "#{rspec.spec_dir}/routing" }
100   watch(rails.app_controller)  { "#{rspec.spec_dir}/controllers" }
102   # Capybara features specs
103   watch(rails.view_dirs)     { |m| rspec.spec.call("features/#{m[1]}") }
104   watch(rails.layouts)       { |m| rspec.spec.call("features/#{m[1]}") }
106   # Turnip features and steps
107   watch(%r{^spec/acceptance/(.+)\.feature$})
108   watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
109     Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
110   end
112   watch(%r{^spec/system/(.+)\.spec\.rb})