myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2147] trunk: created default_settings. yml inste


From: noreply
Subject: [myexperiment-hackers] [2147] trunk: created default_settings. yml instead of requiring adopters to copy/edit/merge an example config
Date: Sun, 29 Mar 2009 10:11:51 -0400 (EDT)

Revision
2147
Author
dgc
Date
2009-03-29 10:11:51 -0400 (Sun, 29 Mar 2009)

Log Message

created default_settings.yml instead of requiring adopters to copy/edit/merge an example config

Modified Paths

Added Paths

Removed Paths

Diff

Copied: trunk/config/default_settings.yml (from rev 2143, trunk/config/settings.yml.pre) (0 => 2147)


--- trunk/config/default_settings.yml	                        (rev 0)
+++ trunk/config/default_settings.yml	2009-03-29 14:11:51 UTC (rev 2147)
@@ -0,0 +1,201 @@
+# myExperiment: config/settings.yml.pre
+#
+# Copyright (c) 2009 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+# ------------------------------------------------------------------------------
+#   myExperiment server configuration
+# ------------------------------------------------------------------------------
+#
+# site_name - Set "site_name" to the name of this myExperiment installation.
+#             This is used by the myExperiment codebase to refer to service by
+#             name.
+#
+#             Example:
+#
+#               site_name: mySite
+
+site_name: mySite
+
+# site_logo - set "site_logo" to the name of the logo used at the top left of
+#             the web pages.
+#
+#             Example:
+#
+#               site_logo: logo.png
+
+site_logo: logo.png
+
+# base_uri - Set "base_uri" to the main entry point to this installation of
+#            myExperiment.  If you use a load balancing solution to proxy
+#            incoming requests to a cluster, then this is the external address.
+#
+#            Examples:
+#
+#              base_uri: http://www.example.com
+#
+#            or
+#
+#              base_uri: http://www.example.com:3000
+#
+#            NOTE: No trailing slash.
+
+base_uri: http://www.example.com
+
+# admins - Set "admins" to the list of usernames of people that are
+#          administrators of this installation.  This is "Username" that is set
+#          when you manage your account, not the "Display Name".
+#
+#          Example:
+#
+#            admins: [dgc, jits, dtm]
+
+admins: []
+
+# main_tabs - These are the main tabs of the website.  Each entry requires at
+#             least a label and a link.  If you specify a controller in a tab,
+#             then the tab is shown as selected when the page has been served by
+#             a controller that matches.
+#
+#             The controller entry is a regular _expression_, so you can make a tab
+#             show as selected in multiple controllers.
+#
+#             Example:
+#
+#               main_tabs:
+#
+#                 - label:      Home
+#                   link:       /home
+#                   controller: home
+#
+#                 - label:      Users
+#                   link:       /users
+#                   controller: (users|profiles|userhistory|friendships|memberships|pictures)
+#
+#                 - label:      Groups
+#                   link:       /groups
+#                   controller: networks
+#
+#                 - label:      Wiki
+#                   link:       http://wiki.example.com/
+
+main_tabs:
+
+  - label:      Home
+    link:       /home
+    controller: home
+
+  - label:      Users
+    link:       /users
+    controller: (users|profiles|userhistory|friendships|memberships|pictures)
+
+  - label:      Groups
+    link:       /groups
+    controller: networks
+
+  - label:      Workflows
+    link:       /workflows
+    controller: workflows
+
+  - label:      Files
+    link:       /files
+    controller: blobs
+
+  - label:      Packs
+    link:       /packs
+    controller: packs
+
+# new_menu - Set "new_menu" with the details of each kind of thing to appear in
+#            the New/Upload gadget.
+#
+#            Each entry must have at least a label and link.  You may specify
+#            controller, in which case it is intepreted as a pattern against
+#            that is matched with the current controller in use.  If it
+#            matches, it becomes the pre selected option in the new/upload
+#            combo box.
+#
+#            You may also specify a condition which is eval'd to determine if
+#            the item should be included.
+#
+#            Example:
+#
+#              new_menu:
+#
+#                - label:      Workflow
+#                  link:       /workflows/new
+#                  controller: workflows
+#
+#                - label:      File
+#                  link:       /files/new
+#                  controller: blobs
+#
+#                - label:      Message
+#                  link:       /messages/new
+#                  controller: messages
+#                  condition:  logged_in?
+
+new_menu:
+
+  - label:      Workflow
+    link:       /workflows/new
+    controller: workflows
+
+  - label:      File
+    link:       /files/new
+    controller: blobs
+
+  - label:      Pack
+    link:       /packs/new
+    controller: packs
+  
+  - label:      Group
+    link:       /groups/new
+    controller: networks
+
+  - label:      Message
+    link:       /messages/new
+    controller: messages
+    condition:  logged_in?
+
+  - label:      Runner
+    link:       /runners/new
+    controller: runners
+    condition:  logged_in? && !TavernaEnactor.for_user(current_user).empty?
+
+  - label:      Experiment
+    link:       /experiments/new
+    controller: experiments
+    condition:  logged_in? && !TavernaEnactor.for_user(current_user).empty?
+
+  - label:      Job
+    link:       /jobs/new
+    controller: jobs
+    condition:  logged_in? && !TavernaEnactor.for_user(current_user).empty?
+
+# search_categories - These are the search categories shown in the search bar
+#                     just under the main tabs.
+
+search_categories: [all, users, groups, workflows, files, packs]
+
+# email - These are the email addresses used for sending notifications and the
+#         email address to send feedback entered from the web site.
+#
+#         Example:
+#
+#           notifications_email_address: address@hidden
+#
+#           feedback_email_address: address@hidden
+
+notifications_email_address: address@hidden
+
+feedback_email_address: address@hidden
+
+# model_aliases - These are visible names for models where the desired visible
+#                 name might conflict with existing classes (e.g. "File" or
+#                 "Application")
+
+model_aliases:
+
+  File:  Blob
+  Group: Network
+

Deleted: trunk/config/settings.yml.pre (2146 => 2147)


--- trunk/config/settings.yml.pre	2009-03-29 13:56:30 UTC (rev 2146)
+++ trunk/config/settings.yml.pre	2009-03-29 14:11:51 UTC (rev 2147)
@@ -1,201 +0,0 @@
-# myExperiment: config/settings.yml.pre
-#
-# Copyright (c) 2009 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-# ------------------------------------------------------------------------------
-#   myExperiment server configuration
-# ------------------------------------------------------------------------------
-#
-# site_name - Set "site_name" to the name of this myExperiment installation.
-#             This is used by the myExperiment codebase to refer to service by
-#             name.
-#
-#             Example:
-#
-#               site_name: mySite
-
-site_name: mySite
-
-# site_logo - set "site_logo" to the name of the logo used at the top left of
-#             the web pages.
-#
-#             Example:
-#
-#               site_logo: logo.png
-
-site_logo: logo.png
-
-# base_uri - Set "base_uri" to the main entry point to this installation of
-#            myExperiment.  If you use a load balancing solution to proxy
-#            incoming requests to a cluster, then this is the external address.
-#
-#            Examples:
-#
-#              base_uri: http://www.example.com
-#
-#            or
-#
-#              base_uri: http://www.example.com:3000
-#
-#            NOTE: No trailing slash.
-
-base_uri: http://www.example.com
-
-# admins - Set "admins" to the list of usernames of people that are
-#          administrators of this installation.  This is "Username" that is set
-#          when you manage your account, not the "Display Name".
-#
-#          Example:
-#
-#            admins: [dgc, jits, dtm]
-
-admins: []
-
-# main_tabs - These are the main tabs of the website.  Each entry requires at
-#             least a label and a link.  If you specify a controller in a tab,
-#             then the tab is shown as selected when the page has been served by
-#             a controller that matches.
-#
-#             The controller entry is a regular _expression_, so you can make a tab
-#             show as selected in multiple controllers.
-#
-#             Example:
-#
-#               main_tabs:
-#
-#                 - label:      Home
-#                   link:       /home
-#                   controller: home
-#
-#                 - label:      Users
-#                   link:       /users
-#                   controller: (users|profiles|userhistory|friendships|memberships|pictures)
-#
-#                 - label:      Groups
-#                   link:       /groups
-#                   controller: networks
-#
-#                 - label:      Wiki
-#                   link:       http://wiki.example.com/
-
-main_tabs:
-
-  - label:      Home
-    link:       /home
-    controller: home
-
-  - label:      Users
-    link:       /users
-    controller: (users|profiles|userhistory|friendships|memberships|pictures)
-
-  - label:      Groups
-    link:       /groups
-    controller: networks
-
-  - label:      Workflows
-    link:       /workflows
-    controller: workflows
-
-  - label:      Files
-    link:       /files
-    controller: blobs
-
-  - label:      Packs
-    link:       /packs
-    controller: packs
-
-# new_menu - Set "new_menu" with the details of each kind of thing to appear in
-#            the New/Upload gadget.
-#
-#            Each entry must have at least a label and link.  You may specify
-#            controller, in which case it is intepreted as a pattern against
-#            that is matched with the current controller in use.  If it
-#            matches, it becomes the pre selected option in the new/upload
-#            combo box.
-#
-#            You may also specify a condition which is eval'd to determine if
-#            the item should be included.
-#
-#            Example:
-#
-#              new_menu:
-#
-#                - label:      Workflow
-#                  link:       /workflows/new
-#                  controller: workflows
-#
-#                - label:      File
-#                  link:       /files/new
-#                  controller: blobs
-#
-#                - label:      Message
-#                  link:       /messages/new
-#                  controller: messages
-#                  condition:  logged_in?
-
-new_menu:
-
-  - label:      Workflow
-    link:       /workflows/new
-    controller: workflows
-
-  - label:      File
-    link:       /files/new
-    controller: blobs
-
-  - label:      Pack
-    link:       /packs/new
-    controller: packs
-  
-  - label:      Group
-    link:       /groups/new
-    controller: networks
-
-  - label:      Message
-    link:       /messages/new
-    controller: messages
-    condition:  logged_in?
-
-  - label:      Runner
-    link:       /runners/new
-    controller: runners
-    condition:  logged_in? && !TavernaEnactor.for_user(current_user).empty?
-
-  - label:      Experiment
-    link:       /experiments/new
-    controller: experiments
-    condition:  logged_in? && !TavernaEnactor.for_user(current_user).empty?
-
-  - label:      Job
-    link:       /jobs/new
-    controller: jobs
-    condition:  logged_in? && !TavernaEnactor.for_user(current_user).empty?
-
-# search_categories - These are the search categories shown in the search bar
-#                     just under the main tabs.
-
-search_categories: [all, users, groups, workflows, files, packs]
-
-# email - These are the email addresses used for sending notifications and the
-#         email address to send feedback entered from the web site.
-#
-#         Example:
-#
-#           notifications_email_address: address@hidden
-#
-#           feedback_email_address: address@hidden
-
-notifications_email_address: address@hidden
-
-feedback_email_address: address@hidden
-
-# model_aliases - These are visible names for models where the desired visible
-#                 name might conflict with existing classes (e.g. "File" or
-#                 "Application")
-
-model_aliases:
-
-  File:  Blob
-  Group: Network
-

Modified: trunk/lib/conf.rb (2146 => 2147)


--- trunk/lib/conf.rb	2009-03-29 13:56:30 UTC (rev 2146)
+++ trunk/lib/conf.rb	2009-03-29 14:11:51 UTC (rev 2147)
@@ -9,53 +9,66 @@
 
 class Conf
 
-  @vars = YAML::load_file("config/settings.yml")
+  @defaults = YAML::load_file("config/default_settings.yml")
 
+  if File.exists?("config/settings.yml")
+    @settings = YAML::load_file("config/settings.yml")
+  else
+    @settings = {}
+  end
+
   def self.sitename
-    @vars['site_name']
+    self.fetch_entry('site_name')
   end
 
   def self.site_logo
-    @vars['site_logo']
+    self.fetch_entry('site_logo')
   end
 
   def self.notifications_email_address
-    @vars['notifications_email_address']
+    self.fetch_entry('notifications_email_address')
   end
 
   def self.feedback_email_address
-    @vars['feedback_email_address']
+    self.fetch_entry('feedback_email_address')
   end
 
   def self.base_uri
-    @vars['base_uri']
+    self.fetch_entry('base_uri')
   end
 
   def self.admins
-    @vars['admins']
+    self.fetch_entry('admins')
   end
 
   def self.main_tabs
-    @vars['main_tabs']
+    self.fetch_entry('main_tabs')
   end
 
   def self.new_menu
-    @vars['new_menu']
+    self.fetch_entry('new_menu')
   end
 
   def self.search_categories
-    @vars['search_categories']
+    self.fetch_entry('search_categories')
   end
 
   def self.model_aliases
-    @vars['model_aliases']
+    self.fetch_entry('model_aliases')
   end
 
   # This method is required to create an administrator in the test fixtures
 
   def self.admins=(value)
-    @vars['admins'] = value
+    @settings['admins'] = value
   end
 
+private
+
+  def self.fetch_entry(key)
+    return @settings[key] if @settings[key]
+    return @defaults[key] if @defaults[key]
+  end
+
 end
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]