From 915387ebc6c3d3d40152c8d1cfdfa029452bd74d Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 6 Oct 2014 13:12:44 +0300 Subject: [PATCH 01/10] Robot now not exit from first error --- bin/robot | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/robot b/bin/robot index 195a6b3dd..0347f92b1 100755 --- a/bin/robot +++ b/bin/robot @@ -1,11 +1,11 @@ -#!/bin/bash -e - +#!/bin/bash # # Build and run everything for automatic tests # +set -o pipefail -# cd to current script directory -cd "$(dirname "$0")" +# cd to Rails root directory +cd "$(dirname "$0")"; cd .. git pull origin master bundle install --deployment @@ -27,6 +27,5 @@ echo "END_OF_RUBOCOP_RESULTS" # run tests echo "TEST_RESULTS" -RAILS_ENV=test bundle exec rake test:other +RAILS_ENV=test bundle exec rake test echo "END_OF_TEST_RESULTS" - From 6419aef849a9c82ddbc2fe6f113ee2322d20e73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Mon, 6 Oct 2014 13:15:43 +0300 Subject: [PATCH 02/10] Client: Show contact history in contact_list#show --- app/views/client/contacts/show.haml | 4 ++++ app/views/client/shared/_versions.haml | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 app/views/client/shared/_versions.haml diff --git a/app/views/client/contacts/show.haml b/app/views/client/contacts/show.haml index 887d8ea93..80fcccccf 100644 --- a/app/views/client/contacts/show.haml +++ b/app/views/client/contacts/show.haml @@ -13,3 +13,7 @@ .col-md-6= render 'admin/contacts/partials/address' .row .col-md-12= render 'client/contacts/partials/domains' + +- if @contact.versions.present? + = render 'client/shared/versions', versions: @contact.versions + diff --git a/app/views/client/shared/_versions.haml b/app/views/client/shared/_versions.haml new file mode 100644 index 000000000..43b2400ae --- /dev/null +++ b/app/views/client/shared/_versions.haml @@ -0,0 +1,21 @@ +.row + .col-md-12 + .table-responsive + %table.table.table-hover.table-bordered.table-condensed + %thead + %tr + %th + =t('shared.whodunnit') + %th + =t('shared.event') + %th + =t('shared.created_at') + + %tbody + -versions.each do |version| + %tr + %td= whodunnit_with_protocol(version.whodunnit) + %td= version.event + %td= version.created_at + + From 84943567615a925f02befba1adba56dcda76527b Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 6 Oct 2014 13:22:26 +0300 Subject: [PATCH 03/10] Reset git after robot run --- bin/robot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/robot b/bin/robot index 0347f92b1..a32f3a8b9 100755 --- a/bin/robot +++ b/bin/robot @@ -8,6 +8,8 @@ set -o pipefail cd "$(dirname "$0")"; cd .. git pull origin master +git --git-dir=. --work-tree=$PWD/.. reset --hard + bundle install --deployment # cp config/secrets-example.yml config/secrets.yml From 6497f37f87977b14b887356dbfb7633fd2ef959b Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 6 Oct 2014 13:49:09 +0300 Subject: [PATCH 04/10] Added cov for robot --- Gemfile | 3 +++ Gemfile.lock | 7 +++++++ bin/robot | 2 +- spec/rails_helper.rb | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 7554cf5c0..d7d6dab61 100644 --- a/Gemfile +++ b/Gemfile @@ -118,4 +118,7 @@ group :development, :test do # For unique IDs (used by the epp gem) gem 'uuidtools', '~> 2.1.4' + + # For code review + gem 'simplecov', '~> 0.9.1', :require => false end diff --git a/Gemfile.lock b/Gemfile.lock index 36d4a25cb..0b8cf0bc6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -61,6 +61,7 @@ GEM thread_safe (~> 0.1) warden (~> 1.2.3) diff-lcs (1.2.5) + docile (1.1.5) epp (1.4.0) hpricot libxml-ruby @@ -219,6 +220,11 @@ GEM rdoc (~> 4.0) shoulda-matchers (2.6.2) activesupport (>= 3.0.0) + simplecov (0.9.1) + docile (~> 1.1.0) + multi_json (~> 1.0) + simplecov-html (~> 0.8.0) + simplecov-html (0.8.0) simpleidn (0.0.5) slop (3.6.0) spring (1.1.3) @@ -297,6 +303,7 @@ DEPENDENCIES sass-rails (~> 4.0.3) sdoc (~> 0.4.0) shoulda-matchers (~> 2.6.1) + simplecov (~> 0.9.1) simpleidn (~> 0.0.5) spring therubyracer diff --git a/bin/robot b/bin/robot index a32f3a8b9..ae19d9c8f 100755 --- a/bin/robot +++ b/bin/robot @@ -29,5 +29,5 @@ echo "END_OF_RUBOCOP_RESULTS" # run tests echo "TEST_RESULTS" -RAILS_ENV=test bundle exec rake test +RAILS_ENV=test ROBOT=true bundle exec rake test echo "END_OF_TEST_RESULTS" diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 6a878e510..338fa88d6 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -6,6 +6,11 @@ require 'rspec/rails' require 'shoulda/matchers' require 'capybara/poltergeist' +if ENV['ROBOT'] + require 'simplecov' + SimpleCov.start 'rails' +end + # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are # run as spec files by default. This means that files in spec/support that end From 70ed489a1d44fab770abdafec870dfe1ba4286fe Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 6 Oct 2014 14:10:30 +0300 Subject: [PATCH 05/10] Run robot bundler as app --- bin/robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/robot b/bin/robot index ae19d9c8f..1b682c15a 100755 --- a/bin/robot +++ b/bin/robot @@ -10,7 +10,7 @@ cd "$(dirname "$0")"; cd .. git pull origin master git --git-dir=. --work-tree=$PWD/.. reset --hard -bundle install --deployment +setuser app bundle install --deployment # cp config/secrets-example.yml config/secrets.yml # create manually config/database.yml From a15ef4c261256ece69c0ec10ee4b39d5a6aa1087 Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 6 Oct 2014 14:17:26 +0300 Subject: [PATCH 06/10] Added alternative git reset to robot --- bin/robot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/robot b/bin/robot index 1b682c15a..5ce531c9b 100755 --- a/bin/robot +++ b/bin/robot @@ -8,7 +8,8 @@ set -o pipefail cd "$(dirname "$0")"; cd .. git pull origin master -git --git-dir=. --work-tree=$PWD/.. reset --hard +git reset --hard +unset GIT_DIR GIT_WORK_TREE setuser app bundle install --deployment From 743c382a0377ba600ec351fa558a895e65ceb6cf Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 6 Oct 2014 14:23:35 +0300 Subject: [PATCH 07/10] Robot now manually reset database --- bin/robot | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/robot b/bin/robot index 5ce531c9b..9232e247f 100755 --- a/bin/robot +++ b/bin/robot @@ -16,7 +16,10 @@ setuser app bundle install --deployment # cp config/secrets-example.yml config/secrets.yml # create manually config/database.yml -RAILS_ENV=test bundle exec rake db:reset +RAILS_ENV=test bundle exec rake db:drop +RAILS_ENV=test bundle exec rake db:create +RAILS_ENV=test bundle exec rake db:schema:load +RAILS_ENV=test bundle exec rake db:seed RAILS_ENV=test bundle exec rake assets:precompile echo "GIT_LAST_COMMITS" From f77daf2c6db4d71e90b8865c849f3333d23c1e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Mon, 6 Oct 2014 14:44:13 +0300 Subject: [PATCH 08/10] Client: Domain history in domains_list#show --- app/views/client/domains/show.haml | 4 +++ app/views/client/shared/_versions.haml | 35 ++++++++++++++------------ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/app/views/client/domains/show.haml b/app/views/client/domains/show.haml index 7b895c94f..c8c59f303 100644 --- a/app/views/client/domains/show.haml +++ b/app/views/client/domains/show.haml @@ -21,3 +21,7 @@ .col-md-12= render 'admin/domains/partials/nameservers' .row .col-md-12= render 'admin/domains/partials/dnskeys' + +- if @domain.versions.present? + = render 'client/shared/versions', versions: @domain.versions + diff --git a/app/views/client/shared/_versions.haml b/app/views/client/shared/_versions.haml index 43b2400ae..3f9a95305 100644 --- a/app/views/client/shared/_versions.haml +++ b/app/views/client/shared/_versions.haml @@ -1,21 +1,24 @@ .row .col-md-12 - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th - =t('shared.whodunnit') - %th - =t('shared.event') - %th - =t('shared.created_at') - - %tbody - -versions.each do |version| + #nameservers.panel{ class: 'panel-default' } + .panel-heading.clearfix + = t('shared.history') + .table-responsive + %table.table.table-hover.table-bordered.table-condensed + %thead %tr - %td= whodunnit_with_protocol(version.whodunnit) - %td= version.event - %td= version.created_at + %th + =t('shared.whodunnit') + %th + =t('shared.event') + %th + =t('shared.created_at') + + %tbody + -versions.each do |version| + %tr + %td= whodunnit_with_protocol(version.whodunnit) + %td= version.event + %td= version.created_at From b27ba36ede73cbcf9c5415265b1ce26f5a2363cd Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 6 Oct 2014 14:51:05 +0300 Subject: [PATCH 09/10] Hardcoded home to robot script for a while --- bin/robot | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/robot b/bin/robot index 9232e247f..7919d97fa 100755 --- a/bin/robot +++ b/bin/robot @@ -3,6 +3,7 @@ # Build and run everything for automatic tests # set -o pipefail +HOME=/home/app # cd to Rails root directory cd "$(dirname "$0")"; cd .. From 99cc15534330bc1e8298414509dd230d90a4cc1c Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 6 Oct 2014 14:54:52 +0300 Subject: [PATCH 10/10] Removed unneeded home from robot --- bin/robot | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/robot b/bin/robot index 7919d97fa..9232e247f 100755 --- a/bin/robot +++ b/bin/robot @@ -3,7 +3,6 @@ # Build and run everything for automatic tests # set -o pipefail -HOME=/home/app # cd to Rails root directory cd "$(dirname "$0")"; cd ..