Class PhusionPassenger::Utils::FileSystemWatcher |
In: | lib/phusion_passenger/utils/file_system_watcher.rb
Parent: | Object

Methods

- close
- new
- opens_files?
- wait_for_change

Classes and Modules
Class PhusionPassenger::Utils::FileSystemWatcher::DirInfo
Class PhusionPassenger::Utils::FileSystemWatcher::FileInfo
Attributes

[RW] | poll_interval |

Public Class methods
new(filenames, termination_pipe = nil)

[ show source ]

        # File lib/phusion_passenger/utils/file_system_watcher.rb, line 81
    81:                 def initialize(filenames, termination_pipe = nil)
    82:                         @poll_interval = 3
    83:                         @termination_pipe = termination_pipe
    84:                         @dirs  = []
    85:                         @files = []
    86:
    87:                         begin
    88:                                 filenames.each do |filename|
    89:                                         stat = File.stat(filename)
    90:                                         if stat.directory?
    91:                                                 @dirs << DirInfo.new(filename, stat)
    92:                                         else
    93:                                                 @files << FileInfo.new(filename, stat)
    94:                                         end
    95:                                 end
    96:                         rescue Errno::EACCES, Errno::ENOENT
    97:                                 @dirs = @files = nil
    98:                         end
    99:                 end

opens_files?()

[ show source ]

        # File lib/phusion_passenger/utils/file_system_watcher.rb, line 77
    77:                 def self.opens_files?
    78:                         return false
    79:                 end

Public Instance methods
close()

[ show source ]

         # File lib/phusion_passenger/utils/file_system_watcher.rb, line 115
    115:                 def close
    116:                 end

wait_for_change()

[ show source ]

         # File lib/phusion_passenger/utils/file_system_watcher.rb, line 101
    101:                 def wait_for_change
    102:                         if !@dirs
    103:                                 return false
    104:                         end
    105:
    106:                         while true
    107:                                 if changed?
    108:                                         return true
    109:                                 elsif select([@termination_pipe], nil, nil, @poll_interval)
    110:                                         return nil
    111:                                 end
    112:                         end
    113:                 end