I've been trying to understand how to setup systems from
the ground up on Ubuntu. I just installed redis
onto
the box and here's how I did it and some things to look
out for.
To install:
require 'minitest_helper' | |
ADDRESSES = { | |
toledo_ohio: { | |
street1: '', | |
city: 'Toledo', | |
state: '', | |
zip: '', | |
country: 'United States', | |
expected_obfuscated_street: '', |
if Rails.env.production? | |
Braintree::Configuration.environment = Rails.env.staging? ? :sandbox : :production | |
Braintree::Configuration.merchant_id = ENV["braintree_merchant_id"] | |
Braintree::Configuration.public_key = ENV["braintree_public_key"] | |
Braintree::Configuration.private_key = ENV["braintree_private_key"] | |
else | |
Braintree::Configuration.environment = :sandbox | |
Braintree::Configuration.merchant_id = "<super secret>" | |
Braintree::Configuration.public_key = "<super secret>" | |
Braintree::Configuration.private_key = "<super secret>" |
brew install python --framework | |
easy_install pip | |
pip install virtualenv | |
pip install virtualenvwrapper | |
mkdir $HOME/.virtualenvs | |
# homebrew python 2.7 | |
echo 'export PATH="/usr/local/share/python:$PATH"' >> ~/.zshrc | |
#virtualenv wrapper |
ENV["RAILS_ENV"] = "test" | |
require File.expand_path('../../config/environment', __FILE__) | |
require 'rails/test_help' | |
require 'minitest/autorun' | |
require 'minitest/pride' | |
require 'capybara/rails' | |
class MiniTest::Spec | |
include ActiveSupport::Testing::SetupAndTeardown |
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin` | |
# Be sure to have rails and thin installed. | |
require "rubygems" | |
require "rails" | |
# Let's load only action controller. If you want | |
# to use active record, just require it as well. | |
require "action_controller/railtie" | |
class MyApp < Rails::Application |
require "money" | |
class Decorator < BasicObject | |
undef_method :== | |
def initialize(component) | |
@component = component | |
end | |
def method_missing(name, *args, &block) |
class AnonymousUser < User | |
attr_accessible *ACCESSIBLE_ATTRS, :type, :token, as: :registrant | |
def register(params) | |
params = params.merge(type: 'User', token: nil) | |
self.update_attributes(params, as: :registrant) | |
end | |
end |
gem 'couchrest_extended_document' |
# An example of elasticsearch & Tire setup for ActiveRecord associations. | |
# | |
# A `Book has_many :chapters` scenario, with mapping and JSON serialization | |
# for indexing associated models. | |
# | |
# Demonstrates three important caveats as of now: | |
# | |
# 1. You you have to use `touch: true` in the `belongs_to` declaration, | |
# to automatically notify the parent model about the update. | |
# |