Module: OodAppkit::Configuration
- Included in:
- OodAppkit
- Defined in:
- lib/ood_appkit/configuration.rb
Overview
An object that stores and adds configuration options.
Instance Attribute Summary collapse
-
#bootstrap ⇒ OpenStruct
Override Boostrap SASS variables in app.
-
#clusters ⇒ OodCore::Clusters
Cluster information for local HPC center.
-
#dashboard ⇒ DashboardUrl
System dashboard app url handler.
-
#dataroot ⇒ Pathname?
Location where app data is stored on local filesystem.
-
#editor ⇒ EditorUrl
System file editor app url handler.
-
#enable_log_formatter ⇒ boolean
Set to false if you don’t want Rails.logger formatter to use LogFormatter and lograge to be enabled automatically.
-
#files ⇒ FilesUrl
System files app url handler.
-
#markdown ⇒ Redcarpet::Markdown
A markdown renderer used when rendering ‘*.md` or `*.markdown` views.
-
#public ⇒ PublicUrl
Public assets url handler.
-
#routes ⇒ OpenStruct
Whether to auto-generate default routes for helpful apps/features.
-
#shell ⇒ ShellUrl
System shell app url handler.
Instance Method Summary collapse
-
#configure {|self| ... } ⇒ Object
Customize configuration for this object.
-
#set_default_configuration ⇒ void
Sets the default configuration for this object.
Instance Attribute Details
#bootstrap ⇒ OpenStruct
Override Boostrap SASS variables in app
53 54 55 |
# File 'lib/ood_appkit/configuration.rb', line 53 def bootstrap @bootstrap end |
#clusters ⇒ OodCore::Clusters
Cluster information for local HPC center
17 18 19 |
# File 'lib/ood_appkit/configuration.rb', line 17 def clusters @clusters ||= parse_clusters(ENV['OOD_CLUSTERS']) end |
#dashboard ⇒ DashboardUrl
System dashboard app url handler
33 34 35 |
# File 'lib/ood_appkit/configuration.rb', line 33 def dashboard @dashboard end |
#dataroot ⇒ Pathname?
Location where app data is stored on local filesystem
10 11 12 |
# File 'lib/ood_appkit/configuration.rb', line 10 def dataroot Pathname.new(@dataroot). if @dataroot end |
#editor ⇒ EditorUrl
System file editor app url handler
45 46 47 |
# File 'lib/ood_appkit/configuration.rb', line 45 def editor @editor end |
#enable_log_formatter ⇒ boolean
Set to false if you don’t want Rails.logger formatter to use LogFormatter and lograge to be enabled automatically
58 59 60 |
# File 'lib/ood_appkit/configuration.rb', line 58 def enable_log_formatter @enable_log_formatter end |
#files ⇒ FilesUrl
System files app url handler
41 42 43 |
# File 'lib/ood_appkit/configuration.rb', line 41 def files @files end |
#markdown ⇒ Redcarpet::Markdown
A markdown renderer used when rendering ‘*.md` or `*.markdown` views
25 26 27 |
# File 'lib/ood_appkit/configuration.rb', line 25 def markdown @markdown end |
#public ⇒ PublicUrl
Public assets url handler
29 30 31 |
# File 'lib/ood_appkit/configuration.rb', line 29 def public @public end |
#routes ⇒ OpenStruct
Whether to auto-generate default routes for helpful apps/features
49 50 51 |
# File 'lib/ood_appkit/configuration.rb', line 49 def routes @routes end |
#shell ⇒ ShellUrl
System shell app url handler
37 38 39 |
# File 'lib/ood_appkit/configuration.rb', line 37 def shell @shell end |
Instance Method Details
#configure {|self| ... } ⇒ Object
Customize configuration for this object.
62 63 64 |
# File 'lib/ood_appkit/configuration.rb', line 62 def configure yield self end |
#set_default_configuration ⇒ void
This method returns an undefined value.
Sets the default configuration for this object.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/ood_appkit/configuration.rb', line 68 def set_default_configuration ActiveSupport::Deprecation.warn("The environment variable RAILS_DATAROOT will be deprecated in an upcoming release, please use OOD_DATAROOT instead.") if ENV['RAILS_DATAROOT'] self.dataroot = ENV['OOD_DATAROOT'] || ENV['RAILS_DATAROOT'] self.dataroot ||= "~/#{ENV['OOD_PORTAL'] || "ondemand"}/data/#{ENV['APP_TOKEN']}" if ENV['APP_TOKEN'] # Add markdown template support self.markdown = Redcarpet::Markdown.new( Redcarpet::Render::HTML, autolink: true, tables: true, strikethrough: true, fenced_code_blocks: true, no_intra_emphasis: true ) # Initialize URL handlers for system apps self.public = Urls::Public.new( title: ENV['OOD_PUBLIC_TITLE'] || 'Public Assets', base_url: ENV['OOD_PUBLIC_URL'] || '/public' ) self.dashboard = Urls::Dashboard.new( title: ENV['OOD_DASHBOARD_TITLE'] || 'Open OnDemand', base_url: ENV['OOD_DASHBOARD_URL'] || '/pun/sys/dashboard' ) self.shell = Urls::Shell.new( title: ENV['OOD_SHELL_TITLE'] || 'Shell', base_url: ENV['OOD_SHELL_URL'] || '/pun/sys/shell' ) self.files = Urls::Files.new( title: ENV['OOD_FILES_TITLE'] || 'Files', base_url: ENV['OOD_FILES_URL'] || '/pun/sys/dashboard/files' ) self.editor = Urls::Editor.new( title: ENV['OOD_EDITOR_TITLE'] || 'Editor', # this is not a typo => the editor is /edit off of the base url base_url: ENV['OOD_EDITOR_URL'] || '/pun/sys/dashboard/files' ) # Add routes for useful features self.routes = OpenStruct.new( files_rack_app: true, wiki: true ) # Override Bootstrap SASS variables self.bootstrap = OpenStruct.new( navbar_inverse_bg: '#53565a', navbar_inverse_link_color: '#fff', navbar_inverse_color: '$navbar-inverse-link-color', navbar_inverse_link_hover_color: 'darken($navbar-inverse-link-color, 20%)', navbar_inverse_brand_color: '$navbar-inverse-link-color', navbar_inverse_brand_hover_color: '$navbar-inverse-link-hover-color' ) ENV.each {|k, v| /^BOOTSTRAP_(?<name>.+)$/ =~ k ? self.bootstrap[name.downcase] = v : nil} self.enable_log_formatter = ::Rails.env.production? end |