Merge branch 'master' into fixes_stats

This commit is contained in:
Patri
2014-12-08 02:08:02 +01:00
6 changed files with 322 additions and 5 deletions
+1 -2
View File
@@ -37,6 +37,5 @@ pickle-email-*.html
.idea/
sgemset
# Vagrant images
# Ignore .vagrant folder with images
.vagrant
+2
View File
@@ -64,6 +64,8 @@ gem "shelly-dependencies"
group :development do
gem "binding_of_caller"
gem "better_errors"
gem "rubocop"
gem "haml-lint"
end
group :development, :test do
+23
View File
@@ -51,6 +51,9 @@ GEM
arbre (1.0.2)
activesupport (>= 3.0.0)
arel (5.0.1.20140414130214)
ast (2.0.0)
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
awesome_print (1.2.0)
bcrypt (3.1.7)
better_errors (1.0.1)
@@ -106,6 +109,10 @@ GEM
actionpack (>= 3.0)
haml (4.0.5)
tilt
haml-lint (0.8.0)
haml (~> 4.0)
rubocop (>= 0.25.0)
sysexits (~> 1.1)
haml-rails (0.5.3)
actionpack (>= 4.0.1)
activesupport (>= 4.0.1)
@@ -153,11 +160,15 @@ GEM
orm_adapter (0.5.0)
paranoia (2.0.0)
activerecord (~> 4.0)
parser (2.2.0.pre.8)
ast (>= 1.1, < 3.0)
slop (~> 3.4, >= 3.4.5)
pg (0.17.1)
pg-hstore (1.2.0)
polyamorous (1.0.0)
activerecord (>= 3.0)
polyglot (0.3.4)
powerpack (0.0.9)
pundit (0.3.0)
activesupport (>= 3.0.0)
rack (1.5.2)
@@ -191,6 +202,7 @@ GEM
activesupport (= 4.1.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
rake (10.4.0)
ransack (1.2.3)
actionpack (>= 3.0)
@@ -217,7 +229,14 @@ GEM
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rubocop (0.27.1)
astrolabe (~> 1.3)
parser (>= 2.2.0.pre.7, < 3.0)
powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-graphviz (1.0.9)
ruby-progressbar (1.7.0)
sass (3.2.19)
sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0)
@@ -230,6 +249,7 @@ GEM
simple_form (3.0.2)
actionpack (~> 4.0)
activemodel (~> 4.0)
slop (3.6.0)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
@@ -239,6 +259,7 @@ GEM
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sysexits (1.2.0)
textacular (3.2.0)
activerecord (>= 3.0, < 4.2)
thin (1.6.2)
@@ -282,6 +303,7 @@ DEPENDENCIES
fabrication
faker
foreman
haml-lint
haml-rails
has_scope
high_voltage (~> 2.1.0)
@@ -305,6 +327,7 @@ DEPENDENCIES
rest-client
rollbar
rspec-rails (~> 2.14)
rubocop
sass-rails (= 4.0.5)
shelly-dependencies
simple_form (>= 3.0.0)
Vendored
+127
View File
@@ -0,0 +1,127 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, path: "bootstrap.sh"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 3000, host: 3000, auto_correct: true # For rails
config.vm.network "forwarded_port", guest: 4000, host: 4000, auto_correct: true # For nomachine
config.vm.network "forwarded_port", guest: 5432, host: 15432, auto_correct: true # For PostgreSQL access from PgAdmin
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Don't boot with headless mode
# vb.gui = true
# Use VBoxManage to customize the VM. For example to change memory:
#vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.memory = 1024
end
#
# View the documentation for the provider you're using for more
# information on available options.
# Enable provisioning with CFEngine. CFEngine Community packages are
# automatically installed. For example, configure the host as a
# policy server and optionally a policy file to run:
#
# config.vm.provision "cfengine" do |cf|
# cf.am_policy_hub = true
# # cf.run_file = "motd.cf"
# end
#
# You can also configure and bootstrap a client to an existing
# policy server:
#
# config.vm.provision "cfengine" do |cf|
# cf.policy_server_address = "10.0.2.15"
# end
# Enable provisioning with Puppet stand alone. Puppet manifests
# are contained in a directory path relative to this Vagrantfile.
# You will need to create the manifests directory and a manifest in
# the file default.pp in the manifests_path directory.
#
# config.vm.provision "puppet" do |puppet|
# puppet.manifests_path = "manifests"
# puppet.manifest_file = "default.pp"
# end
# Enable provisioning with chef solo, specifying a cookbooks path, roles
# path, and data_bags path (all relative to this Vagrantfile), and adding
# some recipes and/or roles.
#
# config.vm.provision "chef_solo" do |chef|
# chef.cookbooks_path = "../my-recipes/cookbooks"
# chef.roles_path = "../my-recipes/roles"
# chef.data_bags_path = "../my-recipes/data_bags"
# chef.add_recipe "mysql"
# chef.add_role "web"
#
# # You may also specify custom JSON attributes:
# chef.json = { mysql_password: "foo" }
# end
# Enable provisioning with chef server, specifying the chef server URL,
# and the path to the validation key (relative to this Vagrantfile).
#
# The Opscode Platform uses HTTPS. Substitute your organization for
# ORGNAME in the URL and validation key.
#
# If you have your own Chef Server, use the appropriate URL, which may be
# HTTP instead of HTTPS depending on your configuration. Also change the
# validation key to validation.pem.
#
# config.vm.provision "chef_client" do |chef|
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
# chef.validation_key_path = "ORGNAME-validator.pem"
# end
#
# If you're using the Opscode platform, your validator client is
# ORGNAME-validator, replacing ORGNAME with your organization name.
#
# If you have your own Chef Server, the default validation client name is
# chef-validator, unless you changed the configuration.
#
# chef.validation_client_name = "ORGNAME-validator"
end
+166
View File
@@ -0,0 +1,166 @@
#!/usr/bin/env bash
echo '******************************************************'
echo "Vagrant image provisioning started at "
date
date > /etc/vagrant_provisioned_at
echo '******************************************************'
# 1. Apply updates and install essential dependencies
echo ''
echo '******************************************************'
echo '****** STEP 1 of 10 ***** Applying Ubuntu Updates and installing dependencies'
echo '******************************************************'
echo ''
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install git-core build-essential zlib1g-dev nodejs libpq-dev
# 2. Configure GIT
echo ''
echo '******************************************************'
echo '****** STEP 2 of 10 ***** Configuring GIT'
echo '******************************************************'
echo ''
cd /vagrant
git config --global core.autocrlf input
git config --global color.ui true
git config --global push.default simple
git config --global pull.rebase true
git config --global alias.changed "show --pretty=\"format:\" --name-only"
git config --global alias.nicelog "log --pretty=format:'%Cgreen%cd [%h] %Cblue<%an> %Cred%s' --date-order"
git config --global alias.s "status -s"
git config --global alias.lg "log --oneline --decorate --all --graph"
git config --global alias.g "grep --break --heading --line-number"
git remote add upstream https://github.com/coopdevs/timeoverflow.git
# 3.Install RVM
echo ''
echo '******************************************************'
echo '****** STEP 3 of 10 ***** Installing RVM'
echo '******************************************************'
echo ''
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
\curl -L https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
# 4.Install ruby 2.1.4 and bundler
echo ''
echo '******************************************************'
echo '****** STEP 4 of 10 ***** Installing ruby 2.1.4'
echo '******************************************************'
echo ''
rvm install 2.1.4
rvm use 2.1.4
rvm --default 2.1.4
# 5.Install bundler and apply gems from Gemfile.lock
echo ''
echo '******************************************************'
echo '****** STEP 5 of 10 ***** Installing Bundler and TimeOverflow gems'
echo '******************************************************'
gem install bundler
bundle install
# 6.Install and setup PostgreSQL 9.3
echo ''
echo '******************************************************'
echo '****** STEP 6 of 10 ***** Installing and configuring PostgreSQL for development'
echo '******************************************************'
echo ''
sudo apt-get -y install postgresql postgresql-contrib
pg_hba=`sudo find / -name pg_hba.conf -print -quit|head -1`
sudo -u postgres sed -ibak 's/postgres/all/gi' $pg_hba
sudo -u postgres sed -ibak 's/peer/trust/gi' $pg_hba
sudo -u postgres sed -ibak 's/md5/trust/gi' $pg_hba
sudo service postgresql restart
sudo -u postgres -i psql -c 'CREATE EXTENSION hstore;'
sudo -u postgres -i psql -c 'CREATE USER vagrant WITH SUPERUSER CREATEROLE CREATEDB;'
sudo -u postgres -i psql -c 'CREATE USER root WITH SUPERUSER CREATEROLE CREATEDB;'
# 7.Create all databases
echo ''
echo '******************************************************'
echo '****** STEP 7 of 10 ***** Creating TimeOverflow Databases (development,test,production)'
echo '******************************************************'
echo ''
rake db:create RAILS_ENV=development
rake db:create RAILS_ENV=test
rake db:create RAILS_ENV=production
# 8.Grant privileges to user vagrant
echo ''
echo '******************************************************'
echo '****** STEP 8 of 10 ***** Granting privileges to User vagrant on these databases'
echo '******************************************************'
echo ''
sudo -u postgres -i psql -c 'GRANT ALL PRIVILEGES ON DATABASE timeoverflow_development to vagrant;'
sudo -u postgres -i psql -c 'GRANT ALL PRIVILEGES ON DATABASE timeoverflow_test to vagrant;'
sudo -u postgres -i psql -c 'GRANT ALL PRIVILEGES ON DATABASE timeoverflow_production to vagrant;'
sudo -u postgres -i psql -c 'GRANT ALL PRIVILEGES ON DATABASE timeoverflow_development to root;'
sudo -u postgres -i psql -c 'GRANT ALL PRIVILEGES ON DATABASE timeoverflow_test to root;'
sudo -u postgres -i psql -c 'GRANT ALL PRIVILEGES ON DATABASE timeoverflow_production to root;'
# 9.Run DB migrations
echo ''
echo '******************************************************'
echo '****** STEP 9 of 10 ***** Running Databases Migrations'
echo '******************************************************'
echo ''
rake db:migrate RAILS_ENV=development
rake db:migrate RAILS_ENV=test
rake db:migrate RAILS_ENV=production
# 10.Run DB seeds
echo ''
echo '******************************************************'
echo '****** STEP 9 of 10 ***** Running Database Seeds'
echo '******************************************************'
echo ''
rake db:seed RAILS_ENV=development
rake db:seed RAILS_ENV=test
rake db:seed RAILS_ENV=production
# 12.Inform we are DONE!
echo ''
echo '********************** DONE! *************************'
echo 'Vagrant image for TimeOverflow development provisioned! :)'
echo "Date of provisioning saved at /etc/vagrant_provisioned_at file"
echo '******************************************************'
echo ''
echo '******************* IMPORTANT ******************'
echo 'Please remember to finish your git configuration'
echo ''
echo 'Configure your user.name and user.email that will show in Github'
echo '$ git config --global user.email "your@email.com"'
echo '$ git config --global user.name "Your name"'
echo '******************* IMPORTANT *****************'
echo ''
echo '**************'
echo 'What is next?'
echo '**************'
echo '1. launch a session of the TimeOverflow Vagrant image and go to /vagrant folder'
echo ' NOTE: /vagrant folder is a shared folder with your host where TimeOverflow code resides'
echo ' $ vagrant ssh'
echo ' $ cd /vagrant'
echo '2. Then develop using your host editor.'
echo '3. Run TimeOverflow by doing'
echo ' $ cd /vagrant'
echo ' $ rails s'
echo 'As we are doing port forwarding for 3000 you can access the running app from your browser at http://localhost:3000'
echo ''
echo '4. For commits and other GIT commands: You can use GIT from vagrant ssh session or from your host computer'
echo ' If using Windows host machine use GIT from vagrant ssh session'
echo ''
echo 'For more details visit the TimeOverflow Wiki at Github, specially following links'
echo 'https://github.com/coopdevs/timeoverflow/wiki/Getting-started'
echo 'https://github.com/coopdevs/timeoverflow/wiki/Configuring-Postgres-to-Avoid-using-environment-variables'
echo ''
echo ''
echo '******************************************************'
echo "Vagrant image provisioning finished at "
date
date >> /etc/vagrant_provisioned_at
echo '******************************************************'
+3 -3
View File
@@ -33,7 +33,7 @@ User.find_or_create_by(email: "user@example.com") do |user|
user.confirmed_at = DateTime.now.utc
user.password = "1234test"
user.password_confirmation = "1234test"
user.username = "admin"
user.username = "user"
user.gender = "male"
user.identity_document = "X1111111X"
end
@@ -43,7 +43,7 @@ User.find_or_create_by(email: "admin2@example.com") do |user|
user.confirmed_at = DateTime.now.utc
user.password = "1234test"
user.password_confirmation = "1234test"
user.username = "admin"
user.username = "admin2"
user.gender = "male"
user.identity_document = "X2222222X"
end
@@ -53,7 +53,7 @@ User.find_or_create_by(email: "user2@example.com") do |user|
user.confirmed_at = DateTime.now.utc
user.password = "1234test"
user.password_confirmation = "1234test"
user.username = "admin"
user.username = "user2"
user.gender = "male"
user.identity_document = "X3333333X"
end