First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel
Then ssh with root account, run this in termianl:
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
// Bot-mate by Zero.One (http://www.zeroone.st) | |
// Simple nodejs server, that receives request with _escaped_fragment_ parameter, and renders back client-side gererated html from given host. | |
// Useful for single-page apps, with hashbang-style routes, to make them crawlable, and bot-friendly. | |
// (Read this great article for details: http://pivotallabs.com/seo-friendly-single-page-apps-in-rails/) | |
// | |
// Requirements: node and phantomjs in your PATH. | |
// TODO: Exception handling | |
// TODO: Caching support | |
// TODO: Add Nginx and Apache config example | |
// |
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: thin | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: S 0 1 6 | |
# Short-Description: thin initscript | |
# Description: thin | |
### END INIT INFO |
set :shared_children, shared_children << 'tmp/sockets' | |
namespace :deploy do | |
desc "Start the application" | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false | |
end | |
desc "Stop the application" | |
task :stop, :roles => :app, :except => { :no_release => true } do |
# Nginx can serve FLV/MP4 files by pseudo-streaming way without any specific media-server software. | |
# To do the custom build we use 2 modules: --with-http_secure_link_module --with-http_flv_module | |
# This module "secure-link" helps you to protect links from stealing away. | |
# | |
# NOTE: see more details at coderwall: http://coderwall.com/p/3hksyg | |
cd /usr/src | |
wget http://nginx.org/download/nginx-1.5.13.tar.gz | |
tar xzvf ./nginx-1.5.13.tar.gz && rm -f ./nginx-1.5.13.tar.gz |
#!/bin/sh | |
set_path="cd /home/rails/my_app/current" | |
case "$1" in | |
start) | |
echo -n "Starting delayed_job: " | |
su - rails -c "$set_path; RAILS_ENV=production script/delayed_job start" >> log/delayed_job.log 2>&1 | |
echo "done." | |
;; | |
stop) |
#!/usr/bin/env ruby | |
require "openssl" | |
class BF < Struct.new(:key, :pad_with_spaces) | |
def encrypt(str) | |
cipher = OpenSSL::Cipher.new('bf-ecb').encrypt | |
if pad_with_spaces | |
str += " " until str.bytesize % 8 == 0 | |
cipher.padding = 0 |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
require 'spec_helper' | |
describe Users::OauthCallbacksController, "handle facebook authentication callback" do | |
describe "#annonymous user" do | |
context "when facebook email doesn't exist in the system" do | |
before(:each) do | |
stub_env_for_omniauth | |
get :facebook |
# encoding: utf-8 | |
require 'test_helper' | |
class Users::OmniauthCallbacksControllerTest < ActionController::TestCase | |
context "Facebook callback" do | |
setup do | |
# This a Devise specific thing for functional tests. See https://github.com/plataformatec/devise/issues/closed#issue/608 | |
request.env["devise.mapping"] = Devise.mappings[:user] | |
end | |