Method: Six::Appmanager.tail

Defined in:
lib/six-updater-web/vendor/plugins/six-app_manager/lib/six/appmanager.rb

.tail(file, interval = 1) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/six-updater-web/vendor/plugins/six-app_manager/lib/six/appmanager.rb', line 135

def tail(file, interval=1)
  raise "Illegal interval #{interval}" if interval < 0

  # Read to a table and display with ajax???
  # RE: http://onlamp.com/pub/a/onlamp/2005/06/09/rails_ajax.html
  File.open(file) do |io|
    loop do
      while ( line = io.gets )
        puts line
      end

      # uncomment next to watch what is happening
      # puts "-"
      sleep interval
    end
  end
end