Sha256: 2d653cf2d4e08bcf8df25a38993881595f40dd8402a57f666ed11295fe29e743

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

# Grape::Reload

Expiremental approach for providing reloading of Grape-based rack applications in dev environment.  
It uses Ripper to extract class usage and definitions from code and reloads files and API classes based on dependency map.

## Installation

Add this line to your application's Gemfile:

    gem 'grape-reload'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install grape-reload

## Usage

In your config.ru you use Grape::RackBuilder to mount your apps:

    builder = Grape::RackBuilder.setup do
        logger Logger.new(STDOUT)
        add_source_path File.expand_path('**/*.rb', YOUR_APP_ROOT)
        reload_threshold 1 # Reload sources not often one second
        mount 'Your::App', to: '/'
        mount 'Your::App1', to: '/app1'
    end

    run builder.boot!.application

Grape::Reload will resolve all class dependencies and load your files in appropriate order, so you don't need to include 'require' or 'require_relative' for your app classes.

## Restrictions:

If you want to monkey-patch class in your code for any reason, you should use 
    
    AlreadyDefined.class_eval do 
    end

instead of

    class AlreadyDefined
    end  

because it confuses dependency resolver

## Known issues

* It still lacks of good design :(  
* MOAR TESTS!!!!111

## Contributing

1. Fork it ( https://github.com/AMar4enko/grape-reload/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-reload-0.0.2 README.md