Project

pistol

0.0
No commit activity in last 3 years
No release in over 3 years
Extremely lightweight reloading tool for rack & sinatra apps.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 1.0
~> 1.0
~> 1.0
 Project Readme

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, Dir[__FILE__, "./app/**/*.rb"] do
    reset! and load(__FILE__)
  end
end

Dir["./app/**/*.rb"].each { |file| require file }

What this does:

  1. It instructs Pistol to watch for changes in any of the files passed.
  2. If changes occur, the block is executed.

Only in development?

Sure. Simply change it to:

class App < Sinatra::Base
  configure :development do
    use Pistol, Dir[__FILE__, "./app/**/*.rb"] do
      reset! and load(__FILE__)
    end
  end
end