Oct 16 2010
- 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments
In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].
| https://github.com/ricardochimal/taps |
| if defined?(Bundler); Bundler.setup; else; require "rubygems"; end | |
| require "amqp" | |
| EventMachine.run do | |
| AMQP.connect(:host => "localhost", :username => "guest", :password => "guest") do |connection| | |
| puts "Connected. Waiting for messages... Hit Control + C to stop me." | |
| channel = AMQP::Channel.new(connection) | |
| exchange = channel.direct("hello-exchange", :durable => true, :auto_delete => false) |
| if defined?(Bundler); Bundler.setup; else; require "rubygems"; end | |
| require "amqp" | |
| EventMachine.run do | |
| AMQP.connect(:host => "localhost", :username => "guest", :password => "guest") do |connection| | |
| puts "Connected. Hit Control + C to stop me." | |
| channel = AMQP::Channel.new(connection) | |
| channel.direct("hello-exchange", :durable => true, :auto_delete => false). |
| app_dir = "/home/node/apps/routekickr" | |
| app_name = "routekickr" | |
| worker_processes 3 | |
| working_directory app_dir | |
| # Load app into the master before forking workers for super-fast | |
| # worker spawn times | |
| preload_app true | |
| # nuke workers after 60 seconds (the default) |
| #!/usr/bin/env ruby | |
| # ruby_simple_example.rb | |
| # | |
| # A sample ruby script covering connection to a MongoDB database given a | |
| # fully-qualified URI. There are a few additional means, but we prefer the URI | |
| # connection model because developers can use the same code to handle various | |
| # database configuration possibilities (single, master/slave, replica sets). | |
| # | |
| # Author:: Mongolab |
| #!/usr/bin/env ruby | |
| # mongomapper_simple_example.rb | |
| # | |
| # A sample ruby script covering connection to a MongoDB database given a | |
| # fully-qualified URI, using the MongoMapper ODM. | |
| # There are a few additional means, but we prefer the URI | |
| # connection model because developers can use the same code to handle various | |
| # database configuration possibilities (single, master/slave, replica sets). | |
| # |
| ----- ruby dependencies ----- | |
| apt-get install gcc checkinstall build-essential automake openssl libreadline6 libreadline6-dev libc6-dev curl wget git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libsqlite3-0 libxml2-dev libpcre3 libpcre3-dev libicu-dev python-dev python-pip libxslt-dev autoconf libc6-dev ncurses-dev libtool bison subversion g++ openjdk-6-jre-headless libcurl4-openssl-dev libc6-dev libmysql++-dev nodejs nodejs-dev npm libv8-dev javascript-common libev-dev wget make redis-server openssh-server git-core python-dev python-pip libyaml-dev imagemagick | |
| ----- ----- ----- ----- ----- | |
| useradd masteroftheart -g sudo -s /bin/bash -m | |
| echo "masteroftheart:gobigorgohome" | chpasswd |
| class User | |
| include MongoMapper::Document | |
| safe | |
| authenticates_with_sorcery! | |
| key :name, String, :required => true | |
| key :email, String, :unique => true | |
| key :crypted_password, String | |
| key :salt, String |
| Rails.application.config.sorcery.submodules = [:reset_password, :activity_logging, :external, :remember_me] | |
| Rails.application.config.sorcery.configure do |config| | |
| config.not_authenticated_action = :not_authenticated | |
| config.save_return_to_url = true | |
| config.cookie_domain = sorcery.kickr.io | |
| # -- session timeout -- | |
| # config.session_timeout = 3600 | |
| # config.session_timeout_from_last_action = false | |
| # -- activity logging -- |