Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cyril David
committed
Oct 8, 2010
1 parent
af21079
commit 7e878e8
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Pistol | ||
====== | ||
|
||
_n. A small tool designed to reload your rack application._ | ||
|
||
Get it! | ||
------- | ||
|
||
$ gem install pistol | ||
|
||
Usage | ||
----- | ||
|
||
# app.rb | ||
require "sinatra/base" | ||
require "pistol" | ||
|
||
class App < Sinatra::Base | ||
use Pistol, :files => Dir[__FILE__, "./app/**/*.rb"] | ||
end | ||
|
||
Dir["./app/**/*.rb"].each { |file| require file } | ||
|
||
### What this does: | ||
|
||
1. It marks `app.rb` as the main application file. It's assumed that app.rb | ||
handles all the loading, boiler plate, etc. | ||
2. It reloads everything in `app/**/*.rb`. You can of course specify | ||
other paths (e.g. `./config/*.rb`, `./lib/*.rb`). | ||
|
||
### Only in development? | ||
|
||
Sure. Simply change it to: | ||
|
||
class App < Sinatra::Base | ||
configure :development do | ||
use Pistol, :files => Dir[__FILE__, "./app/**/*.rb"] | ||
end | ||
end |