##Given Apache 2 and MySQL are already installed.
#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated
#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules
| # If you meet install errors, see abid-hussain's comment | |
| sudo apt-get --force-yes install build-essential openssl libreadline6 libreadline6-dev curl git-core \ | |
| zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \ | |
| libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison | |
| && | |
| \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled |
| module ActiveRecord::UnionScope | |
| def self.included(base) | |
| base.send :extend, ClassMethods | |
| end | |
| module ClassMethods | |
| def union_scope(*scopes) | |
| id_column = "#{table_name}.#{primary_key}" | |
| sub_query = scopes.map { |s| s.select(id_column).to_sql }.join(" UNION ") | |
| where "#{id_column} IN (#{sub_query})" |
| # https://gist.github.com/joemaller/4503986 | |
| # | |
| # A set of color functions to help with fancy $PS1 prompts | |
| # | |
| # This: | |
| # PROMPT_COMMAND='PS1="\e[32;1m\]\u@\[\e[35;1m\]\H \[\e[0m\]\w]\$ "'' | |
| # | |
| # Can be more clearly written as: | |
| # PROMPT_COMMAND='PS1="$(DARK_GREEN \\u@)$(PURPLE \\H) \w]\$ "'' | |
| # |
| # lib/tasks/deploy.rake | |
| namespace :deploy do | |
| desc 'Deploy to staging environment' | |
| task :staging do | |
| exec 'mina deploy -f config/deploy/staging.rb' | |
| end | |
| end |
##Given Apache 2 and MySQL are already installed.
#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated
#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules
TL;DR Como configurar uma aplicação Rails usando Nginx + Unicorn + Upstart + RVM (gemset por aplicação).
Dependências: (TODO) Configuração de Servidor Nginx
Essas instruções são aplicáveis para o seguinte ambiente:
| #!/usr/bin/env ruby | |
| # An HTTP/HTTPS/FTP file downloader library/CLI based upon MiniPortile's | |
| # HTTP implementation. | |
| # | |
| # Author: Jon Maken | |
| # License: 3-clause BSD | |
| # Revision: 2012-03-25 23:01:19 -0600 | |
| require 'net/http' | |
| require 'net/https' if RUBY_VERSION < '1.9' |
by Jonathan Rochkind, http://bibwild.wordpress.com
Capistrano automates pushing out a new version of your application to a deployment location.
I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".
| # app/config/deploy.rb | |
| # Most of the changes specific to your environment will be set in | |
| # the `app/config/deploy/[env].rb` files. | |
| # define multiple deployments | |
| set :stages, %w(production staging) | |
| set :default_stage, "staging" |
| # encoding: utf-8 | |
| # Be sure to restart your server when you modify this file. | |
| # Add new inflection rules using the following format | |
| # (all these examples are active by default): | |
| # ActiveSupport::Inflector.inflections do |inflect| | |
| # inflect.plural /^(ox)$/i, '\1en' | |
| # inflect.singular /^(ox)en/i, '\1' | |
| # inflect.irregular 'person', 'people' | |
| # inflect.uncountable %w( fish sheep ) |