noosfero | 3 new commits pushed to repository

Bráulio Bhavamitra gitlab at gitlab.com
Sun Feb 22 20:30:55 BRT 2015


Bráulio Bhavamitra pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>

Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/a368d61a06eb2dc16ad8bd32b57f4324e75249f9">a368d61a</a> by Larissa Reis
Fixes multitenancy rake tasks

  - Fixes a typo;
  - Loads the environment first so ActiveRecord is available.

- - - - -
<a href="https://gitlab.com/noosfero/noosfero/commit/79477411ff724af60a2fd8869aa3b2350afb31bb">79477411</a> by Larissa Reis
Uses YAML alias to reference default environment in multitenancy

  Using the previous documented syntax got me an error since environment
  wasn't expected to be a string. I could only get it to work using YAML
  alias and anchors, so I'm changing the documentation.

- - - - -
<a href="https://gitlab.com/noosfero/noosfero/commit/2baa37a91d14773c42ab2ed68c2d560d8ab5e84a">2baa37a9</a> by Bráulio Bhavamitra
Merge branch 'multitenancy' into 'master'

Fixes multitenancy documentation and task

Multitenancy installation is not currently working as described on documentation.
This patch fixes the create task and updates the documentation.

See merge request !377

- - - - -


Changes:

=====================================
INSTALL.multitenancy.md
=====================================
--- a/INSTALL.multitenancy.md
+++ b/INSTALL.multitenancy.md
@@ -26,7 +26,7 @@ The file config/database.yml must follow a structure in order to achieve multite
 
 Each "hosted" environment must have an entry like this:
 
-    env1_production:
+    env1_production: &DEFAULT
       adapter: postgresql
       encoding: unicode
       database: noosfero
@@ -61,7 +61,7 @@ The "hosted" environments define, besides the `schema_search_path`, a list of do
 You must also tell the application which is the default environment.
 
     production:
-      env1_production
+      <<: *DEFAULT
 
 On the example above there are only three hosted environments, but it can be more than three. The schemas `env2` and `env3` must already exist in the same database of the hosting environment. As postgres user, you can create them typing:
 

=====================================
config/database.yml.multitenancy
=====================================
--- a/config/database.yml.multitenancy
+++ b/config/database.yml.multitenancy
@@ -1,5 +1,5 @@
 # Refer to INSTALL.multitenancy for more information on Multitenancy support
-env1_production:
+env1_production: &DEFAULT
   adapter: postgresql
   encoding: unicode
   database: noosfero
@@ -30,4 +30,4 @@ env3_production:
     - env3.net
 
 production:
-  env1_production
+  <<: *DEFAULT

=====================================
lib/tasks/multitenancy.rake
=====================================
--- a/lib/tasks/multitenancy.rake
+++ b/lib/tasks/multitenancy.rake
@@ -1,16 +1,16 @@
 namespace :multitenancy do
 
-  task :create do
+  task :create => :environment do
     db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) }
     cd Rails.root.join('config', 'environments'), :verbose => true
-    file_envs = Dir.glob "{*_development.rb,*_prodution.rb,*_test.rb}"
+    file_envs = Dir.glob "{*_development.rb,*_production.rb,*_test.rb}"
     (db_envs.map{ |e| e + '.rb' } - file_envs).each { |env| ln_s env.split('_').last, env }
   end
 
-  task :remove do
+  task :remove => :environment do
     db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) }
     cd Rails.root.join('config', 'environments'), :verbose => true
-    file_envs = Dir.glob "{*_development.rb,*_prodution.rb,*_test.rb}"
+    file_envs = Dir.glob "{*_development.rb,*_production.rb,*_test.rb}"
     (file_envs - db_envs.map{ |e| e + '.rb' }).each { |env| safe_unlink env }
   end
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150222/d69e981a/attachment-0001.html>


More information about the Noosfero-dev mailing list