Sha256: d7c4254455665aa5910a825c84250421dd1df7bd61f205fa9ec30f1e6c9dd1d8

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'guard'
require 'guard/guard'

module Guard
  class ConsistencyFail < Guard

    # Allowable options are:
    # :environment        defaults to 'development'

    def initialize(watchers = [], options = {})
      @options = options
      super(watchers, options)
    end

    def start
      system(cmd)
    end

    # Called on Ctrl-C signal (when Guard quits)
    def stop
    end

    # Called on Ctrl-Z signal
    # This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
    def reload
      start
    end

    # Called on Ctrl-/ signal
    # This method should be principally used for long action like running all specs/tests/...
    def run_all
      start
    end

    # Called on file(s) modifications
    def run_on_change(paths)
      start
    end

    private

    def cmd
      command = 'consistency_fail'
      command = "export RAILS_ENV=#{@options[:environment]}; #{command}" if @options[:environment]
      UI.info "Running consistency_fail: #{command}"
      command
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
guard-consistency_fail-0.0.10 lib/guard/consistency_fail.rb