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
| package :imagemagick do | |
| description "ImageMagick" | |
| version '6.5.4-10' | |
| source "ftp://ftp.fifi.org/pub/ImageMagick/ImageMagick-#{version}.tar.gz" do | |
| prefix '/usr' | |
| disable 'static' | |
| enable 'shared' | |
| with %w(modules quantum-depth=8) | |
| without %w(perl magick-plus-plus) |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| class User < ActiveRecord::Base | |
| # Include default devise modules. Others available are: | |
| # :token_authenticatable, :confirmable, :lockable and :timeoutable | |
| devise :database_authenticatable , :registerable, :recoverable, :rememberable, :trackable, :validatable | |
| devise :omniauthable#, :omniauth_providers => [:facebook] | |
| devise :encryptable, :encryptor => :custom_encryptor | |
| # Devise: Setup accessible (or protected) attributes for your model | |
| attr_accessible :email, :password, :password_confirmation, :remember_me |
| # 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 | |
| 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 |
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
| #!/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 |
| #!/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) |
| # 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 |
| 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 |