From cf80522dfa2b86aeecce0b1d5a5ef3ed2be457a4 Mon Sep 17 00:00:00 2001
From: Mauricio Giacomini Girardello <mauriciogiacomini4@gmail.com>
Date: Mon, 17 Aug 2015 12:11:57 -0300
Subject: [PATCH] config deployment tasks

---
 analise             | 22 ------------
 config/database.yml | 67 ----------------------------------
 config/deploy.rb    | 88 +++++++--------------------------------------
 teste               |  1 -
 4 files changed, 12 insertions(+), 166 deletions(-)
 delete mode 100644 analise
 delete mode 100644 teste

diff --git a/analise b/analise
deleted file mode 100644
index 3aa1f273c..000000000
--- a/analise
+++ /dev/null
@@ -1,22 +0,0 @@
-À direita, os paladinos da legalidade; À esquerda, a vítima imobilizada.
-
-"Chama-se  a atenção para isso, como se houvesse algo de irregular nesses dois
-fatos."
-Tradução : reclamam que as empreiteiras e bancos tem lucros recordes com o
-dinheiro que lá injetamso, mas estamos nas regras do jogo!
-
-A frase é emblemática, e representa a estratégia retórica que o governo segue
-desde e a "carta ao povo brasileiro": a
-necessidade urgente de demonstrar aos grupos midiáticos, tacitamente aos
-grandes investidores, a pureza e a transparência dos negócios e dos trâmites
-engendrados, dos lucros recordes dos bancos,  o
-caráter liberal do governo, e, principalmente, o afastamento desses "bolivarianos",
-"comunistas", um pupilo exemplar do Estado democrático de direito!
-
-Mas se para 'nós', os que nos denominamos esquerda ( e aqui não me aprofundo nem em
-marxistas, marxistas-leninistas, etc), a transparência dos contratos, o respeito às
-instituições do Estado, o hasteamento da bandeira da 'maior empreiteira da
-América Latina', a exploração de
-minério em Moçambique, é o grau em que podemos nos considerar satisfeitos,
-cumpridores do dever histórico a que nos propomos desempenhar, algo parece muito
-contraditótio.
diff --git a/config/database.yml b/config/database.yml
index d02ebb8f8..b6e0c0180 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -1,24 +1,6 @@
-# PostgreSQL. Versions 8.2 and up are supported.
-#
-# Install the pg driver:
-#   gem install pg
-# On OS X with Homebrew:
-#   gem install pg -- --with-pg-config=/usr/local/bin/pg_config
-# On OS X with MacPorts:
-#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
-# On Windows:
-#   gem install pg
-#       Choose the win32 build.
-#       Install PostgreSQL and put its /bin directory on your path.
-#
-# Configure Using Gemfile
-# gem 'pg'
-#
 default: &default
   adapter: postgresql
   encoding: unicode
-  # For details on connection pooling, see rails configuration guide
-  # http://guides.rubyonrails.org/configuring.html#database-pooling
   pool: 5
 
 development: &development
@@ -27,59 +9,10 @@ development: &development
   timeout: 5000
   database: db/development.sqlite3
 
-  # The specified database role being used to connect to postgres.
-  # To create additional roles in postgres see `$ createuser --help`.
-  # When left blank, postgres will use the default role. This is
-  # the same name as the operating system user that initialized the database.
-  #username: portalmec
-
-  # The password associated with the postgres role (username).
-  #password:
-
-  # Connect on a TCP socket. Omitted by default since the client uses a
-  # domain socket that doesn't need configuration. Windows does not have
-  # domain sockets, so uncomment these lines.
-  #host: localhost
-
-  # The TCP port the server listens on. Defaults to 5432.
-  # If your server runs on a different port number, change accordingly.
-  #port: 5432
-
-  # Schema search path. The server defaults to $user,public
-  #schema_search_path: myapp,sharedapp,public
-
-  # Minimum log levels, in increasing order:
-  #   debug5, debug4, debug3, debug2, debug1,
-  #   log, notice, warning, error, fatal, and panic
-  # Defaults to warning.
-  #min_messages: notice
-
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
 test:
   <<: *development
   database: db/test.sqlite3
 
-# As with config/secrets.yml, you never want to store sensitive information,
-# like your database password, in your source code. If your source code is
-# ever seen by anyone, they now have access to your database.
-#
-# Instead, provide the password as a unix environment variable when you boot
-# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
-# for a full rundown on how to provide these environment variables in a
-# production deployment.
-#
-# On Heroku and other platform providers, you may have a full connection URL
-# available as an environment variable. For example:
-#
-#   DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
-#
-# You can use this database configuration with:
-#
-#   production:
-#     url: <%= ENV['DATABASE_URL'] %>
-#
 production:
   <<: *default
   database: portalmec_production
diff --git a/config/deploy.rb b/config/deploy.rb
index 12d5862b7..fe76376ac 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -1,90 +1,26 @@
 require 'mina/bundler'
 require 'mina/rails'
 require 'mina/git'
-# require 'mina/rbenv'  # for rbenv support. (http://rbenv.org)
-require 'mina/rvm'    # for rvm support. (http://rvm.io)
+#require 'mina/rbenv'
 
-# Basic settings:
-#   domain       - The hostname to SSH to.
-#   deploy_to    - Path to deploy into.
-#   repository   - Git repo to clone from. (needed by mina/git)
-#   branch       - Branch name to deploy. (needed by mina/git)
+set :rails_env, 'production'
 
-set :domain, 'portalmecdev.c3sl.ufpr.br'
-set :deploy_to, '/home/portalmec/portalmec-production'
-set :repository, 'https://gitlab.c3sl.ufpr.br/portalmec/portalmec.git'
-set :branch, 'master'
+set :domain,     'portalmecdev.c3sl.ufpr.br'
+set :deploy_to,  "/home/portalmec/#{rails_env}"
+set :app_path,   "#{deploy_to}/#{current_path}"
+set :repository, 'git@gitlab.c3sl.ufpr.br:portalmec/portalmec.git'
+set :branch,     'master'
+set :user,       'portalmec'
 
-# For system-wide RVM install.
-set :rvm_path, '/usr/local/rvm/bin/rvm'
-
-# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
-# They will be linked in the 'deploy:link_shared_paths' step.
-set :shared_paths, ['config/database.yml', 'config/secrets.yml', 'log']
-
-# Optional settings:
-#   set :user, 'foobar'    # Username in the server to SSH to.
-#   set :port, '30000'     # SSH port number.
-#   set :forward_agent, true     # SSH forward_agent.
-
-# This task is the environment that is loaded for most commands, such as
-# `mina deploy` or `mina rake`.
 task :environment do
-  # If you're using rbenv, use this to load the rbenv environment.
-  # Be sure to commit your .ruby-version or .rbenv-version to your repository.
-  # invoke :'rbenv:load'
-
-  # For those using RVM, use this to load an RVM version@gemset.
-  # invoke :'rvm:use[ruby-1.9.3-p125@default]'
+  #invoke :'rbenv:load'
 end
 
-# Put any custom mkdir's in here for when `mina setup` is ran.
-# For Rails apps, we'll make some of the shared paths that are shared between
-# all releases.
-task :setup => :environment do
-  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
-  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]
-
-  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
-  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]
-
-  queue! %[touch "#{deploy_to}/#{shared_path}/config/database.yml"]
-  queue! %[touch "#{deploy_to}/#{shared_path}/config/secrets.yml"]
-  queue  %[echo "-----> Be sure to edit '#{deploy_to}/#{shared_path}/config/database.yml' and 'secrets.yml'."]
+task deploy: :environment do
 
-  queue %[
-    repo_host=`echo $repo | sed -e 's/.*@//g' -e 's/:.*//g'` &&
-    repo_port=`echo $repo | grep -o ':[0-9]*' | sed -e 's/://g'` &&
-    if [ -z "${repo_port}" ]; then repo_port=22; fi &&
-    ssh-keyscan -p $repo_port -H $repo_host >> ~/.ssh/known_hosts
-  ]
-end
-
-desc "Deploys the current version to the server."
-task :deploy => :environment do
-  to :before_hook do
-    # Put things to run locally before ssh
-  end
   deploy do
-    # Put things that will set up an empty directory into a fully set-up
-    # instance of your project.
     invoke :'git:clone'
-    invoke :'deploy:link_shared_paths'
-    invoke :'bundle:install'
-    invoke :'rails:db_migrate'
-    invoke :'rails:assets_precompile'
-    invoke :'deploy:cleanup'
-
-    to :launch do
-      queue "mkdir -p #{deploy_to}/#{current_path}/tmp/"
-      queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt"
-    end
+    execute 'bundle install --binstubs'
+    execute 'rake daily:stats'
   end
 end
-
-# For help in making your deploy script, see the Mina documentation:
-#
-#  - http://nadarei.co/mina
-#  - http://nadarei.co/mina/tasks
-#  - http://nadarei.co/mina/settings
-#  - http://nadarei.co/mina/helpers
diff --git a/teste b/teste
deleted file mode 100644
index bf7e89904..000000000
--- a/teste
+++ /dev/null
@@ -1 +0,0 @@
-asdasd
-- 
GitLab