Sha256: df37d9d9b8e71089cac1360b443056a3811002ed5522faf8b4c5efa4eeadb6a5

Contents?: true

Size: 404 Bytes

Versions: 23

Compression:

Stored size: 404 Bytes

Contents

def tail(log_file)
  cursor = File.size(log_file)
  last_checked = Time.now
  tail_thread = Thread.new do
    File.open(log_file, 'r') do |f|
      loop do
        f.seek cursor
        if f.mtime > last_checked
          last_checked = f.mtime
          contents = f.read
          cursor += contents.length
          print contents
        end
        sleep 1
      end
    end
  end
  tail_thread
end

Version data entries

23 entries across 23 versions & 5 rubygems

Version Path
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/rails/railties/lib/commands/servers/base.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/rails/railties/lib/commands/servers/base.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/rails/railties/lib/commands/servers/base.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/railties/lib/commands/servers/base.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/railties/lib/commands/servers/base.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/railties/lib/commands/servers/base.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/railties/lib/commands/servers/base.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/railties/lib/commands/servers/base.rb
authorails-1.0.0 lib/commands/servers/base.rb
radiant-0.6.0 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.6.1 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.6.3 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.6.2 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.6.4 vendor/rails/railties/lib/commands/servers/base.rb
rails-1.2.0 lib/commands/servers/base.rb
rails-1.2.2 lib/commands/servers/base.rb
rails-1.2.4 lib/commands/servers/base.rb
rails-1.2.3 lib/commands/servers/base.rb
rails-1.2.5 lib/commands/servers/base.rb
rails-1.2.1 lib/commands/servers/base.rb