sinatra

Getting the Access Token from a Facebook Open Graph response in Ruby

Hi, I'm trying to implement single sign-on using facebook in my ruby sinatra app. So far, I've been following this tutorial: http://jaywiggins.com/2010/05/facebook-oauth-with-sinatra/ I am able to send a request for a user to connect to my application but I'm having trouble actually "getting" the access token. The user can connect wit...

Any success with Sinatra working together with EventMachine WebSockets?

I have been using Sinatra for sometime now and I would like to add some realtime features to my web-app by pushing the data via websockets. I have successfully used the gem 'em-websocket' on its own, but have not been able to write one ruby file that has a sinatra web server AND a web-socket server. I've tried spinning the run! or star...

Using FBML in a ruby sinatra app

Hi, I'm building an application in ruby using the sinatra framework and am having trouble with rendering some fbml elements. I'm currently trying to render an fb:multi-friend-selector so the user can select which friends they want to invite. However, when I write the following in my code: <fb:fbml> <fb:request-form action="/invit...

Has somebody built a navigation/menu helper for Sinatra?

I see there is one for staticmatic, and plenty in the Ruby toolbox for rails menu builders, but I can't seem to track one down specifically for Sinatra. ...

Is there a way to flush html to the wire in Sinatra

I have a Sinatra app with a long running process (a web scraper). I'd like the app flush the results of the crawler's progress as the crawler is running instead of at the end. I've considered forking the request and doing something fancy with ajax but this is a really basic one-pager app that really just needs to output a log to a brow...

Can I have Sinatra / Rack not read the entire request body into memory?

Say I have a Sinatra route ala: put '/data' do request.body.read # ... end It appears that the entire request.body is read into memory. Is there a way to consume the body as it comes into the system, rather than having it all buffered in Rack/Sinatra beforehand? I see I can do this to read the body in parts, but the entire body s...

How can I get all the checked items from a submitted form with sinatra's params?

I'm running Sinatra 1.0 with HAML, my form has a number of checkboxes, for example books I like, and you would select all the books you want. The checkbox name is "books". In sinatra params['books'] there should be an array of all the books that were checked, but it only has the last item that was checked, not an array. How can I get a...

Set Rack session cookie expiration programatically

I'm using Rack to try to implement "Remember Me" functionality in my Sinatra app. I'm able to set the session cookie to expire when the session ends or in X seconds time but I'd like to do both. For example, if a user has clicked "remember me" then I wish for their session to end after X seconds. Eg, my app.rb has a line that looks lik...

Running Ruby app on Apache

I have been learning Ruby lately, and I want to upload a test web application to my server. But I can't figure out how to get it to run on my shared hosting. My Hosting Details Shared Hosting with JustHost (see here for list of features) OS: Linux Apache: 2.2.11 cPanel: 11.25.0-STABLE No SSH access. Can install Ruby Gems. Can't instal...

What is the limit of Sinatra?

I've been learning the Ruby web framework Sinatra lately, and I'm finding it great to use. Most of the articles and blogs I have read about it seem to assume that it is good only for small websites, or 'tiny' web-apps. Is this true? Can a complete web application be built in Sinatra, or is Ruby on Rails the way to go? ...

What python equivalent of Sinatra would you recommend?

I like the sinatra framework, but might have to work in python. A quick web search has uncovered a few python equivalents including itty, flask and juno. I'd like to know people's experience of these, or other sinatra equivalents. Which would you recommend? ...

Getting started with Sinatra, CouchDB & CouchRest?

Hi All I'm just starting to learn my way around CouchDB and Sinatra, but am struggling to find some basic examples of integrating the two via CouchRest. The CouchRest docs assume a little too much to be useful to me yet. Does anyone have links to useful examples/articles/docs? ...

Sinatra/CouchDB error?

Hi All I'm working on my first Sinatra/CouchDB project and I'm getting an error I can't explain. Here's my rackup (config.ru) file: require 'rubygems' require 'couchrest' require 'patina' set :environment, :development set :root, File.dirname(__FILE__) set :run, false FileUtils.mkdir_p 'log' unless File.exists?('log') log = File.new...

Ruby framework to write a API in?

Hi I'm looking to write a multiplatorm tasks application for technical people. I want to handle as many platforms as I can (web, shell, desktop) and therefore I have decided to begin with a server/API. I want to write it in Ruby, however i think that Rails is a bit too heavy for this, even though it would do the job. Sinatra also doesn'...

Sinatra, progress bar in upload form

Hi! I'm developing a Sinatra app that consists of an upload form, with a progress bar indicating how much of the upload has completed. The process, as described by ryan dahl, is the following: HTTP upload progress bars are rather obfuscated- they typically involve a process running on the server keeping track of the size of the te...

How to detect language from URL in Sinatra

I have a multi-language website and I'm puting the language in the URL like domain.com/en/. When the user doesn't put the language in the URL I want to redirect him to the page in the main language like "domain.com/posts" to "domain.com/en/posts". Is there an easy way to do this with Sinatra? I have more than one hundred routes. So doin...

Sinatra app as Rails 3 subpath

I'm trying to get a sinatra app as a subpath in my rails 3 app. Specifically, the resque queuing system has a sinatra based web interface that I would like to have accessible through /resque on my usual rails app. You can see the project here: http://github.com/defunkt/resque I found some people talking about adding a rackup file and ...

Using sinatra, how do I construct a proper DateTime value from 3 separate input boxes?

How do I take a numeric month, day and year from three separate text inputs and parse a proper value for my DateTime field in the db? ...

how to store the name of nested files in a variable and loop through them in rake

I have the following rake file to create a static version of my sinatra app, stolen from http://github.com/semanticart/stuff-site/blob/master/Rakefile class View attr_reader :permalink def initialize(path) filename = File.basename(path) @permalink = filename[0..-6] end end view_paths = Dir.glob(File.join(File.dirname(__...

DataMapper Many-To-Many Association using Sinatra

I just stared learning Sinatra and DataMapper while building a simple blog. I seem to have encountered a problem getting my Many-To-Many association working. I'm trying to associate categories with posts. Upon creation of a post, the category association is not created. Here are my models: class Post include DataMapper::Resource ...