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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Publishing a new version
- Write your new code
- Change
lib/wurst/version.rb - In the root folder, run
gem build wurst.gemspec - In the root, run
gem push wurst-0.0.x.gem