Guardfile - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
 (HTM) git clone git://jay.scot/warvox
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
       Guardfile (4241B)
       ---
            1 # A sample Guardfile
            2 # More info at https://github.com/guard/guard#readme
            3 
            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.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
            7 
            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.
           11 #
           12 #  $ mkdir config
           13 #  $ mv Guardfile config/
           14 #  $ ln -s config/Guardfile .
           15 #
           16 # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
           17 
           18 guard :bundler do
           19   require 'guard/bundler'
           20   require 'guard/bundler/verify'
           21   helper = Guard::Bundler::Verify.new
           22 
           23   files = ['Gemfile']
           24   files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
           25 
           26   # Assume files are symlinked from somewhere
           27   files.each { |file| watch(helper.real_path(file)) }
           28 end
           29 
           30 guard 'livereload' do
           31   watch(%r{app/views/.+\.(erb|haml|slim)$})
           32   watch(%r{app/helpers/.+\.rb})
           33   watch(%r{public/.+\.(css|js|html)})
           34   watch(%r{config/locales/.+\.yml})
           35   # Rails Assets Pipeline
           36   watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
           37 end
           38 
           39 # Guard-Rails supports a lot options with default values:
           40 # daemon: false                        # runs the server as a daemon.
           41 # debugger: false                      # enable ruby-debug gem.
           42 # environment: 'development'           # changes server environment.
           43 # force_run: false                     # kills any process that's holding the listen port before attempting to (re)start Rails.
           44 # pid_file: 'tmp/pids/[RAILS_ENV].pid' # specify your pid_file.
           45 # host: 'localhost'                    # server hostname.
           46 # port: 3000                           # server port number.
           47 # root: '/spec/dummy'                  # Rails' root path.
           48 # server: thin                         # webserver engine.
           49 # start_on_start: true                 # will start the server when starting Guard.
           50 # timeout: 30                          # waits untill restarting the Rails server, in seconds.
           51 # zeus_plan: server                    # custom plan in zeus, only works with `zeus: true`.
           52 # zeus: false                          # enables zeus gem.
           53 # CLI: 'rails server'                  # customizes runner command. Omits all options except `pid_file`!
           54 
           55 guard 'rails' do
           56   watch('Gemfile.lock')
           57   watch(%r{^(config|lib)/.*})
           58 end
           59 
           60 # Note: The cmd option is now required due to the increasing number of ways
           61 #       rspec may be run, below are examples of the most common uses.
           62 #  * bundler: 'bundle exec rspec'
           63 #  * bundler binstubs: 'bin/rspec'
           64 #  * spring: 'bin/rspec' (This will use spring if running and you have
           65 #                          installed the spring binstubs per the docs)
           66 #  * zeus: 'zeus rspec' (requires the server to be started separately)
           67 #  * 'just' rspec: 'rspec'
           68 
           69 guard :rspec, cmd: "bundle exec rspec" do
           70   require "guard/rspec/dsl"
           71   dsl = Guard::RSpec::Dsl.new(self)
           72 
           73   # Feel free to open issues for suggestions and improvements
           74 
           75   # RSpec files
           76   rspec = dsl.rspec
           77   watch(rspec.spec_helper) { rspec.spec_dir }
           78   watch(rspec.spec_support) { rspec.spec_dir }
           79   watch(rspec.spec_files)
           80 
           81   # Ruby files
           82   ruby = dsl.ruby
           83   dsl.watch_spec_files_for(ruby.lib_files)
           84 
           85   # Rails files
           86   rails = dsl.rails(view_extensions: %w(erb haml slim))
           87   dsl.watch_spec_files_for(rails.app_files)
           88   dsl.watch_spec_files_for(rails.views)
           89 
           90   watch(rails.controllers) do |m|
           91     [
           92       rspec.spec.("routing/#{m[1]}_routing"),
           93       rspec.spec.("controllers/#{m[1]}_controller"),
           94       rspec.spec.("acceptance/#{m[1]}")
           95     ]
           96   end
           97 
           98   # Rails config changes
           99   watch(rails.spec_helper)     { rspec.spec_dir }
          100   watch(rails.routes)          { "#{rspec.spec_dir}/routing" }
          101   watch(rails.app_controller)  { "#{rspec.spec_dir}/controllers" }
          102 
          103   # Capybara features specs
          104   watch(rails.view_dirs)     { |m| rspec.spec.("features/#{m[1]}") }
          105   watch(rails.layouts)       { |m| rspec.spec.("features/#{m[1]}") }
          106 
          107   # Turnip features and steps
          108   watch(%r{^spec/acceptance/(.+)\.feature$})
          109   watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
          110     Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
          111   end
          112 end