Sha256: 9a29701985e4afc008fdf2978d6c150dce8cd111028cc2687adf65a84c3f0709

Contents?: true

Size: 753 Bytes

Versions: 27

Compression:

Stored size: 753 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

def start_debugger
  begin
    require_library_or_gem 'ruby-debug'
    Debugger.start
    Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings)
    puts "=> Debugger enabled"
  rescue Exception
    puts "You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'"
    exit
  end
end

Version data entries

27 entries across 27 versions & 7 rubygems

Version Path
radiant-0.7.2 vendor/rails/railties/lib/commands/servers/base.rb
vibes-bj-1.2.2 spec/rails_root/vendor/rails/railties/lib/commands/servers/base.rb
vibes-bj-1.2.1 spec/rails_root/vendor/rails/railties/lib/commands/servers/base.rb
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/railties/lib/commands/servers/base.rb
rails-2.2.3 lib/commands/servers/base.rb
antfarm-0.3.0 rails/vendor/rails/railties/lib/commands/servers/base.rb
antfarm-0.4.0 rails/vendor/rails/railties/lib/commands/servers/base.rb
erails-2.1.2 lib/commands/servers/base.rb
radiant-0.6.5.1 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.6.5 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.6.6 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.6.7 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.6.8 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.6.9 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.7.0 vendor/rails/railties/lib/commands/servers/base.rb
radiant-0.7.1 vendor/rails/railties/lib/commands/servers/base.rb
rails-2.0.2 lib/commands/servers/base.rb
rails-2.0.1 lib/commands/servers/base.rb
rails-2.0.4 lib/commands/servers/base.rb
rails-2.0.0 lib/commands/servers/base.rb