wurst

Wurst connects the two awesome worlds of Sinatra and Ember.js and enables you to create single page webapps in a very easy and fast way.

Installation

Add this line to your application's Gemfile:

gem 'wurst'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install wurst

Link the following four files from your layout view. They are injected automagically:

layout.erb

...
<head>
  <script type="text/javascript" src="/handlebars-v1.3.0.js"></script>
  <script type="text/javascript" src="/ember.js"></script>
  <script type="text/javascript" src="/ember-data.js"></script>
  <script type="text/javascript" src="/models.js"></script>
</head>
...

As the last step, extend ZWResources in your application file:

app.rb

class App < Sinatra::Base
  extend ZWResources
  ...
end

Usage

You can now define your controller actions in app.rb. The model properties are automatically passed to your Ember.js code.

class App < Sinatra::Base
  extend ZWResources

  resource :posts do |router|
    router.index do
      Post.all
    end

    ...
  end
end

Contributing

  1. Fork it
  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 new Pull Request

Publishing a new version

  1. Write your new code
  2. Change lib/wurst/version.rb
  3. In the root folder, run gem build wurst.gemspec
  4. In the root, run gem push wurst-0.0.x.gem