Commit c7c6037191939c9819ab6c86bd156311d017056f

Authored by Michel Felipe
2 parents 8218e5e1 74a9b8cb

Merge branch 'production' of gitlab.com:participa/noosfero into production

.gitlab-ci.yml
@@ -2,7 +2,7 @@ before_script: @@ -2,7 +2,7 @@ before_script:
2 - mkdir -p tmp/pids log 2 - mkdir -p tmp/pids log
3 - bundle check || bundle install 3 - bundle check || bundle install
4 - script/noosfero-plugins disableall 4 - script/noosfero-plugins disableall
5 - - rm -f tmp/makemo.stamp && rake makemo &>/dev/null 5 + - bundle exec rake makemo &>/dev/null
6 # database 6 # database
7 - cp config/database.yml.gitlab-ci config/database.yml 7 - cp config/database.yml.gitlab-ci config/database.yml
8 - createdb gitlab_ci_test || true 8 - createdb gitlab_ci_test || true
@@ -2,12 +2,26 @@ language: ruby @@ -2,12 +2,26 @@ language: ruby
2 rvm: 2 rvm:
3 # for 2.2 support we need to upgrade the pg gem 3 # for 2.2 support we need to upgrade the pg gem
4 - 2.1.6 4 - 2.1.6
  5 +cache: bundler
  6 +
  7 +sudo: false
  8 +addons:
  9 + apt:
  10 + packages:
  11 + - po4a
  12 + - iso-codes
  13 + - tango-icon-theme
  14 + - pidgin-data
  15 + # for gem extensions
  16 + - libmagickwand-dev
  17 + - libpq-dev
  18 + - libreadline-dev
  19 + - libsqlite3-dev
  20 + - libxslt1-dev
5 21
6 before_install: 22 before_install:
7 -# dependencies  
8 - - sudo apt-get update  
9 - - sudo apt-get -y install po4a iso-codes tango-icon-theme pidgin-data default-jre  
10 - - sudo apt-get -y install libmagickwand-dev libpq-dev libreadline-dev libsqlite3-dev libxslt1-dev 23 +# FIXME: workaround while https://github.com/travis-ci/travis-ci/issues/4210 is open
  24 + - rm config/initializers/default_icon_theme.rb
11 # selenium support 25 # selenium support
12 - export DISPLAY=:99.0 26 - export DISPLAY=:99.0
13 - sh -e /etc/init.d/xvfb start 27 - sh -e /etc/init.d/xvfb start
@@ -16,12 +30,12 @@ before_script: @@ -16,12 +30,12 @@ before_script:
16 - mkdir -p tmp/pids log 30 - mkdir -p tmp/pids log
17 - bundle check || bundle install 31 - bundle check || bundle install
18 - script/noosfero-plugins disableall 32 - script/noosfero-plugins disableall
19 - - rake makemo 33 + - bundle exec rake makemo &>/dev/null
20 # database 34 # database
21 - cp config/database.yml.travis config/database.yml 35 - cp config/database.yml.travis config/database.yml
22 - psql -c 'create database myapp_test;' -U postgres 36 - psql -c 'create database myapp_test;' -U postgres
23 - - bundle exec rake db:schema:load  
24 - - bundle exec rake db:migrate 37 + - bundle exec rake db:schema:load &>/dev/null
  38 + - bundle exec rake db:migrate &>/dev/null
25 39
26 env: 40 env:
27 - TASK=test:units 41 - TASK=test:units
@@ -18,7 +18,6 @@ gem 'exception_notification', '~> 4.0.1' @@ -18,7 +18,6 @@ gem 'exception_notification', '~> 4.0.1'
18 gem 'gettext', '~> 2.2.1', :require => false 18 gem 'gettext', '~> 2.2.1', :require => false
19 gem 'locale', '~> 2.0.5' 19 gem 'locale', '~> 2.0.5'
20 gem 'whenever', :require => false 20 gem 'whenever', :require => false
21 -gem 'eita-jrails', '= 0.9.5', :require => 'jrails'  
22 gem 'grape', '~> 0.11.0' 21 gem 'grape', '~> 0.11.0'
23 gem 'grape-entity' 22 gem 'grape-entity'
24 gem 'grape-swagger' 23 gem 'grape-swagger'
@@ -31,6 +30,7 @@ gem 'liquid', '~> 3.0.3' @@ -31,6 +30,7 @@ gem 'liquid', '~> 3.0.3'
31 30
32 # FIXME list here all actual dependencies (i.e. the ones in debian/control), 31 # FIXME list here all actual dependencies (i.e. the ones in debian/control),
33 # with their GEM names (not the Debian package names) 32 # with their GEM names (not the Debian package names)
  33 +gem 'eita-jrails', '~> 0.9.5', require: 'jrails'
34 34
35 # asset pipeline 35 # asset pipeline
36 gem 'uglifier', '>= 1.0.3' 36 gem 'uglifier', '>= 1.0.3'
app/models/profile.rb
@@ -432,7 +432,7 @@ class Profile < ActiveRecord::Base @@ -432,7 +432,7 @@ class Profile < ActiveRecord::Base
432 end 432 end
433 433
434 # registar callback for creating boxes after the object is created. 434 # registar callback for creating boxes after the object is created.
435 - after_create :create_default_set_of_boxes 435 + before_create :create_default_set_of_boxes
436 436
437 # creates the initial set of boxes when the profile is created. Can be 437 # creates the initial set of boxes when the profile is created. Can be
438 # overriden for each subclass to create a custom set of boxes for its 438 # overriden for each subclass to create a custom set of boxes for its
@@ -498,9 +498,6 @@ class Profile < ActiveRecord::Base @@ -498,9 +498,6 @@ class Profile < ActiveRecord::Base
498 self.custom_footer = template[:custom_footer] 498 self.custom_footer = template[:custom_footer]
499 self.custom_header = template[:custom_header] 499 self.custom_header = template[:custom_header]
500 self.public_profile = template.public_profile 500 self.public_profile = template.public_profile
501 -  
502 - # flush  
503 - self.save(:validate => false)  
504 end 501 end
505 502
506 def apply_type_specific_template(template) 503 def apply_type_specific_template(template)
@@ -693,15 +690,15 @@ private :generate_url, :url_options @@ -693,15 +690,15 @@ private :generate_url, :url_options
693 after_create :insert_default_article_set 690 after_create :insert_default_article_set
694 def insert_default_article_set 691 def insert_default_article_set
695 if template 692 if template
696 - copy_articles_from template 693 + self.save! if copy_articles_from template
697 else 694 else
698 default_set_of_articles.each do |article| 695 default_set_of_articles.each do |article|
699 article.profile = self 696 article.profile = self
700 article.advertise = false 697 article.advertise = false
701 article.save! 698 article.save!
702 end 699 end
  700 + self.save!
703 end 701 end
704 - self.save!  
705 end 702 end
706 703
707 # Override this method in subclasses of Profile to create a default article 704 # Override this method in subclasses of Profile to create a default article
@@ -722,10 +719,12 @@ private :generate_url, :url_options @@ -722,10 +719,12 @@ private :generate_url, :url_options
722 end 719 end
723 720
724 def copy_articles_from other 721 def copy_articles_from other
  722 + return false if other.top_level_articles.empty?
725 other.top_level_articles.each do |a| 723 other.top_level_articles.each do |a|
726 copy_article_tree a 724 copy_article_tree a
727 end 725 end
728 self.articles.reload 726 self.articles.reload
  727 + true
729 end 728 end
730 729
731 def copy_article_tree(article, parent=nil) 730 def copy_article_tree(article, parent=nil)