Sha256: a59e03d2866b610022eeb34d35d1320d1abc8d65a539f77af8ebbd26ab0bb550

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.9 lib/guard/consistency_fail.rb