Let's practice some SQL
CREATE DATABASES based on the following Classes
# create a db called middle_earth_db
class Hobbit
attr_accessor :name, age, :is_couragous
end
| require 'active_record' | |
| ActiveRecord::Base.logger = Logger.new( STDOUT ) | |
| ActiveRecord::Base.establish_connection( | |
| :adapter => "postgresql", | |
| :host => "localhost", | |
| :username => "philco", | |
| :password => "", | |
| :database => "amazon_db" |
| require 'git' | |
| require 'date' | |
| require 'logger' | |
| START_DATE = Date.parse('23/09/2013') | |
| namespace :hw do | |
| desc "gets homework" | |
| task :get do |
| Pushing to Heroku | |
| Install Heroku | |
| Create an account on Heroku | |
| Install the Heroku Toolbelt | |
| $ heroku login | |
| Enter your Heroku credentials. | |
| Email: [email protected] | |
| Password:subl | |
| Could not find an existing public key. | |
| Would you like to generate one? [Yn] |
| development: &defaults | |
| adapter: postgresql | |
| encoding: unicode | |
| pool: 5 | |
| host: localhost | |
| username: <%= `echo $USER`.chomp %> | |
| password: | |
| database: <%= File.basename(Rails.root) %>_development | |
| test: |
| # Configure Rspec to print nice | |
| RSpec.configure do |config| | |
| # Use color in STDOUT | |
| config.color_enabled = true | |
| # Use color not only in STDOUT but also in pagers and files | |
| config.tty = true | |
| # Use the specified formatter | |
| config.formatter = :documentation # :progress, :html, :textmate | |
| # immediately stop running upon first failure | |
| config.fail_fast = true |
| language: ruby | |
| rvm: | |
| - 1.9.3 | |
| before_script: | |
| - "sh -e /etc/init.d/xvfb start" | |
| - "export DISPLAY=:99.0" | |
| - "export JASMINE_SPEC_FORMAT=documentation" | |
| script: | |
| - "bundle exec rake travis:run" | |
| env: |
| class XHRConstraint | |
| def matches?(request) | |
| !request.xhr? && !(request.url =~ /\.json$/ && ::Rails.env == 'development') | |
| end | |
| end | |
| match '(*url)' => 'home#index', :constraints => XHRConstraint.new |
| # README | |
| # pass in this file when creating a rails project | |
| # | |
| # for example: | |
| # rails _3.2.14_ new awesome_app -d postgresql -m ~/kickhash_template.rb | |
| remove_file "README.rdoc" | |
| create_file "README.md", "TODO" | |
| gem_group :development, :test do |
| # This script checks for and removes previous installs of macports and rvm | |
| # http://stackoverflow.com/questions/5735666/execute-bash-script-from-url | |
| # This is meant to be run by pasting the following into Terminal | |
| # bash <(curl -s https://gist.github.com/phlco/8358292/raw/48f61796b20f879cdfa30250614ac40ec2a76d43/uninstalls.sh) | |
| # This script checks for and removes previous installs of macports or rvm | |
| # http://stackoverflow.com/questions/3976362/bash-scripts-requiring-sudo-password | |
| # Run the Script with sudo | |
| sudo -v |