Sha256: b55bbc0b079d57c731cd4948fc468f125128c54def3418a2e561332a7d0e72aa

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 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]
      puts "Running #{command}"
      command
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
guard-consistency_fail-0.0.8 lib/guard/consistency_fail.rb
guard-consistency_fail-0.0.7 lib/guard/consistency_fail.rb
guard-consistency_fail-0.0.6 lib/guard/consistency_fail.rb
guard-consistency_fail-0.0.5 lib/guard/consistency_fail.rb