$ brew install ansible # OSX
$ [sudo] pip install ansible # elsewhere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The purpose of all this is to see if sphinx, thinking sphinx and thinking sphinx delayed delta are all working properly. | |
I created a test controller on a separate monit subdomain that simply generates and posts a test value and then uses curl to retrieve it. If the two values match, then sphinx is working properly with delayed delta. | |
This example assumes a Linux installation. | |
The file 'delayed_delta.sh' spawns the `rake ts:dd` process in the background, saving its PID to tmp/pids in your Rails project. You can start and stop it by running '/etc/init.d/delayed_delta.sh start' and '/etc/init.d/delayed_delta.sh stop'. You will use these in your monitoring to, see the monitrc snippet. | |
In a crontab, every X seconds or minutes, run 'ar_sphinx_mon.sh' to see if records are properly being inserted and indexed. If they aren't, then kill all Thinking Sphinx processes and monit should restart them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias rdm="git diff master --name-only --diff-filter=ACMR | grep '.rb' | ag -v 'schema' | xargs rubocop" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rack | |
# disable CSS3 and jQuery animations in test mode for speed, consistency and avoiding timing issues. | |
# Usage for Rails: | |
# in config/environments/test.rb | |
# config.middleware.use Rack::NoAnimations | |
class NoAnimations | |
def initialize(app, options = {}) | |
@app = app | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a multiline script, this will wrap the script in a function and then | |
# call it so Capybara's evaluate_script knows how to get the return value properly. | |
# By default, Capybara just prepends a 'return ' to your script. | |
# | |
# Usage: | |
# | |
# value = page.evaluate_multiline_script %{ | |
# var foo = []; | |
# $('li').each(function(i, li) { | |
# foo[foo.length] = $(li).text(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install postgresql@9.6 | |
brew unlink postgresql@9.6 | |
brew link postgresql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CHECKING_OUT_BRANCH=$3 | |
OLD_BRANCH=$1 | |
NEW_BRANCH=$2 | |
if [ $CHECKING_OUT_BRANCH -eq 1 ] | |
then | |
FILES_CHANGED=`git diff $OLD_BRANCH $NEW_BRANCH --name-status` | |
MIGRATIONS_REMOVED=`echo "$FILES_CHANGED" | egrep 'D\tdb/migrate/([0-9]+)' | sort -r` | |
MIGRATIONS_ADDED=`echo "$FILES_CHANGED" | egrep 'A\tdb/migrate/([0-9]+)'` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CHECKING_OUT_BRANCH=$3 | |
OLD_BRANCH=$1 | |
NEW_BRANCH=$2 | |
if [ $CHECKING_OUT_BRANCH -eq 1 ] | |
then | |
FILES_CHANGED=`git diff $OLD_BRANCH $NEW_BRANCH --name-status` | |
MIGRATIONS_REMOVED=`echo "$FILES_CHANGED" | egrep 'D\tdb/migrate/([0-9]+)' | sort -r` | |
MIGRATIONS_ADDED=`echo "$FILES_CHANGED" | egrep 'A\tdb/migrate/([0-9]+)'` | |