Project

ripl-rack

0.02
No commit activity in last 3 years
No release in over 3 years
This ripl plugin provides a console for rack apps.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.0
~> 0.6.2
>= 0.7.0
 Project Readme

Description¶ ↑

This ripl plugin provides a console for rack apps.

Install¶ ↑

Install the gem with:

gem install ripl-rack

Usage¶ ↑

As an executable:

$ ripl rack
Loading development environment (Rack 1.1)

As a plugin:

$ ripl rails -r ripl/rack

Now let’s use it:

$ ripl rack
Loading development environment (Rack 1.1)

# your rack app thanks to Rack::Test
>> rack
#<Ripl::Rack::App:0x3f8cc @env="development" ... >

# Make http requests
>> rack.get '/'
>> rack.post '/login', :user => 'x', :password => 'y'
...

# To see what actions you can perform on your app
>> rack.actions
=> [:request, :get, :post, :put, :delete, :head, :follow_redirect!, :header, :set_cookie,
:clear_cookies, :authorize, :basic_authorize, :digest_authorize, :last_response, :last_request]

# To perform these actions even more naturally
>> rackit!
=> [:request, :get, :post, :put, :delete, :head, :follow_redirect!, :header, :set_cookie,
:clear_cookies, :authorize, :basic_authorize, :digest_authorize, :last_response, :last_request]

# All of the above methods are now available at the top level
>> get '/'
>> post '/login', :user => 'x', :password => 'y'
....

To have rack actions in your top-level by default add the following to ~/.riplrc:

Ripl.config[:rackit] = true

Credits¶ ↑

  • Thanks to racksh for interesting rack-test bits

  • Thanks to @kukushkin for fixing a reload bug