0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
Integrate Unpoly with any Rack or Sinatra application
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.0
~> 0.6
~> 13.0
~> 1.26

Runtime

>= 2.0, < 4.0
 Project Readme

Unpoly for Rack & Sinatra

Installation

Add this line to your application's Gemfile:

gem "rack-unpoly"

And then execute:

$ bundle

Or install it yourself as:

$ gem install rack-unpoly

Usage in a Rails application

Use the official Unpoly gem from Makandra.

Usage in a Sinatra application

require "sinatra/base"
require "sinatra/unpoly"

class App < Sinatra::Base
  register Sinatra::Unpoly

  get "/" do
    if up?
      "Unpoly request!"
    else
      "Not Unpoly :("
    end
  end
end

Usage in a Roda application

Use the roda-unpoly gem.

Usage in a Rack application (that's not Rails, Sinatra, or Roda)

require "rack"
require "rack/unpoly/middleware"

use Rack::Unpoly::Middleware

app = ->(env) {
  if env["rack.unpoly"].up?
    [200, {}, ["Unpoly request!"]]
  else
    [200, {}, ["Not Unpoly :("]]
  end
}

run app

Where are the Javascript and CSS assets?

I've chosen not to bundle those assets with the gem as they might be updated more frequently then this library. Most Ruby web libraries outside of Rails are asset-agnostic (for the most part), so it's easier if you bring in your assets as you see fit for your specific needs.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/adam12/rack-unpoly.

I love pull requests! If you fork this project and modify it, please ping me to see if your changes can be incorporated back into this project.

That said, if your feature idea is nontrivial, you should probably open an issue to discuss it before attempting a pull request.

License

The gem is available as open source under the terms of the MIT License.