I use the latest Puma v1.4.0 from rubygems.
Make sure you have nginx installed with these options:
>/opt/nginx/sbin/nginx -V
nginx version: nginx/1.0.15
built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
# Redis | |
%w{6379}.each do |port| | |
God.watch do |w| | |
w.name = "redis" | |
w.interval = 30.seconds | |
w.start = "/etc/init.d/redis start" | |
w.stop = "/etc/init.d/redis stop" | |
w.restart = "/etc/init.d/redis restart" | |
w.start_grace = 10.seconds | |
w.restart_grace = 10.seconds |
upstream myapp { | |
server unix:///myapp/tmp/puma.sock; | |
} | |
server { | |
listen 80; | |
server_name myapp.com; | |
# ~2 seconds is often enough for most folks to parse HTML/CSS and | |
# retrieve needed images/icons/frames, connections are cheap in |
I use the latest Puma v1.4.0 from rubygems.
Make sure you have nginx installed with these options:
>/opt/nginx/sbin/nginx -V
nginx version: nginx/1.0.15
built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
enum = Enumerator.new do |yielder| | |
yielder << "a" | |
yielder << "b" | |
yielder << "c" | |
end | |
enum.next # "a" | |
enum.next # "b" | |
enum.next # "c" | |
enum.next # StopIteration: iteration reached an end |
I think that the approach @tenderlove has suggested to avoid monkey-patching MiniTest
(and the way MiniTest
works) means that to use Mocha
with MiniTest
, you would either need to include the Mocha
integration module into every test case, or define your own test case class inheriting from MiniTest::Unit::TestCase
.
This works well for Rails
(i.e. ActiveSupport
), because it already defines a new test case class (ActiveSupport::TestCase
) which is a suitable place to include the Mocha
integration module.
If we were to go down this route, in non-Rails Ruby projects you'd need to do one of the following...
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby | |
# - a browser with WebSocket support | |
# | |
# Usage: | |
# ruby redis_pubsub_demo.rb | |
# |
require 'rubygems' | |
require 'sinatra' | |
require 'net-ldap' | |
require 'digest/sha1' | |
require 'base64' | |
require 'haml' | |
LDAP_HOST = 'localhost' | |
ADMIN_DN = 'cn=admin,dc=company,dc=com' |
# returns true if the user exists and false otherwise | |
def user | |
render :json => User.attributes(params[:uid]) | |
end | |
def user_attribute | |
if params[:attribute] == "groups" | |
res = User.groups(params[:uid]) | |
else | |
res = User.attributes(params[:uid], params[:attribute]) |
require 'net/ldap' | |
# how to "bind" to your ldap/ad server... | |
LDAP_HOST = 'server' | |
LDAP_PORT = 389 | |
LDAP_USERNAME = 'cn=Username;cn=Users;dc=domain;dc=com' | |
LDAP_PASSWORD = 'your user password' | |
LDAP_BASE = 'dc=domain;dc=com' | |
# replace "domain" and "com" above with your AD domain |