AutoReload

Get Version

1.0.0

you don't have to restart your program

What Is It?

Autoreload reloads libraries automatically at regular intervals when files are updated.

Installing

$ gem install autoreload

The Basics

  # foo.rb
  def foo
    1
  end
  # sample1.rb
  require 'autoreload'

  autoreload(:interval=>1, :verbose=>true) do
    require 'foo'
  end

  loop {
    puts foo
    sleep 1
  }

In this situation, run the script sample1.rb. You see that the number 1 is shown repeatedly. Then, while that is still running, update the file foo.rb. For example, change the number 1 to 2 and save it. Then, the library automatically check the update and reload it. You'll see the number 2 is shown.

Documentation

Repository

This project is hosted on GitHub.com.

The repository is git://github.com/rubyworks/autoreload.git for anonymous access.

Copying

(FreeBSD License)

Copyright (c) 2010 Thomas Sawyer

Copyright (c) 2003 Kouichirou Eto

Contact

Comments are welcome. Send an email to Trans "transfire at gmail dot org".

Autoreload is a RubyWorks project.

Trans, 2011-07-15
Theme extended from Paul Battley