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 ⇒ OpenStruct
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
48 49 50 |
# File 'lib/ood_appkit/configuration.rb', line 48 def bootstrap @bootstrap end |
#clusters ⇒ OpenStruct
Cluster information for local HPC center
16 17 18 |
# File 'lib/ood_appkit/configuration.rb', line 16 def clusters @clusters end |
#dashboard ⇒ DashboardUrl
System dashboard app url handler
28 29 30 |
# File 'lib/ood_appkit/configuration.rb', line 28 def dashboard @dashboard end |
#dataroot ⇒ Pathname?
Location where app data is stored on local filesystem
9 10 11 |
# File 'lib/ood_appkit/configuration.rb', line 9 def dataroot Pathname.new(@dataroot) if @dataroot end |
#editor ⇒ EditorUrl
System file editor app url handler
40 41 42 |
# File 'lib/ood_appkit/configuration.rb', line 40 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
53 54 55 |
# File 'lib/ood_appkit/configuration.rb', line 53 def enable_log_formatter @enable_log_formatter end |
#files ⇒ FilesUrl
System files app url handler
36 37 38 |
# File 'lib/ood_appkit/configuration.rb', line 36 def files @files end |
#markdown ⇒ Redcarpet::Markdown
A markdown renderer used when rendering ‘*.md` or `*.markdown` views
20 21 22 |
# File 'lib/ood_appkit/configuration.rb', line 20 def markdown @markdown end |
#public ⇒ PublicUrl
Public assets url handler
24 25 26 |
# File 'lib/ood_appkit/configuration.rb', line 24 def public @public end |
#routes ⇒ OpenStruct
Whether to auto-generate default routes for helpful apps/features
44 45 46 |
# File 'lib/ood_appkit/configuration.rb', line 44 def routes @routes end |
#shell ⇒ ShellUrl
System shell app url handler
32 33 34 |
# File 'lib/ood_appkit/configuration.rb', line 32 def shell @shell end |
Instance Method Details
#configure {|self| ... } ⇒ Object
Customize configuration for this object.
57 58 59 |
# File 'lib/ood_appkit/configuration.rb', line 57 def configure yield self end |
#set_default_configuration ⇒ void
This method returns an undefined value.
Sets the default configuration for this object.
63 64 65 66 67 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 125 126 127 |
# File 'lib/ood_appkit/configuration.rb', line 63 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'] # Initialize list of available clusters self.clusters = OpenStruct.new clusters.all = OodAppkit::Cluster.all( ENV['OOD_CLUSTERS'] ? {file: ENV['OOD_CLUSTERS']} : {} ) def clusters.hpc all.select {|k,v| v.hpc_cluster?} end def clusters.lpc all.reject {|k,v| v.hpc_cluster?} end # 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 = PublicUrl.new( title: ENV['OOD_PUBLIC_TITLE'] || 'Public Assets', base_url: ENV['OOD_PUBLIC_URL'] || '/public' ) self.dashboard = DashboardUrl.new( title: ENV['OOD_DASHBOARD_TITLE'] || 'Dashboard', base_url: ENV['OOD_DASHBOARD_URL'] || '/pun/sys/dashboard' ) self.shell = ShellUrl.new( title: ENV['OOD_SHELL_TITLE'] || 'Shell', base_url: ENV['OOD_SHELL_URL'] || '/pun/sys/shell' ) self.files = FilesUrl.new( title: ENV['OOD_FILES_TITLE'] || 'Files', base_url: ENV['OOD_FILES_URL'] || '/pun/sys/files' ) self.editor = EditorUrl.new( title: ENV['OOD_EDITOR_TITLE'] || 'Editor', base_url: ENV['OOD_EDITOR_URL'] || '/pun/sys/file-editor' ) # 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 |