class RuGUI::Configuration
Defines configurations for a RuGUI
application.
Attributes
A hash of application specific configurations.
Automatically register conventionally named views. Defaults to true.
An array of paths for builder files.
The environment for this application.
The framework adapter to be used for this application. Defaults to GTK. For now it can only be GTK.
An array of paths which should be automaticaly loaded.
The specific logger to use. By default, a logger will be created and initialized using log_path and log_level, but a programmer may specifically set the logger to use via this accessor and it will be used directly.
The timeout for queued calls. Useful when performing long tasks.
The application root path, defined by ::APPLICATION_ROOT
An array of paths which should be searched for gtkrc styles files.
It searchs for files which have the ‘.rc’ extension or files which have the string ‘gtkrc’ in its filename.
The order in which the files are loaded is random, so do not rely on it.
If you need to use absolute paths in a gtkrc file, such as set the pixmap path, you can use “{ROOT_PATH}”, which will be substituted by the application root path when the file is read.
Public Class Methods
# File lib/rugui/configuration.rb, line 58 def initialize set_root_path! self.environment = default_environment self.framework_adapter = default_framework_adapter self.load_paths = default_load_paths self.builder_files_paths = default_builder_files_paths self.styles_paths = default_styles_paths self.queue_timeout = default_queue_timeout self.automatically_register_conventionally_named_views = default_automatically_register_conventionally_named_views self.gems = default_gems self.logger = {} self.application = {} end
Public Instance Methods
The path to the current environment’s file (development.rb
, etc.). By default the file is at config/environments/#{environment}.rb
.
# File lib/rugui/configuration.rb, line 75 def environment_path root_path.join('config', 'environments', "#{environment}.rb") end
Adds a single Gem
dependency to the RuGUI
application. By default, it will require the library with the same name as the gem. Use :lib to specify a different name.
# gem 'aws-s3', '>= 0.4.0' # require 'aws/s3' config.gem 'aws-s3', :lib => 'aws/s3', :version => '>= 0.4.0', \ :source => "http://code.whytheluckystiff.net"
To require a library be installed, but not attempt to load it, pass :lib => false
config.gem 'qrp', :version => '0.4.1', :lib => false
# File lib/rugui/configuration.rb, line 97 def gem(name, options = {}) @gems << RuGUI::GemDependency.new(name, options) end
# File lib/rugui/configuration.rb, line 79 def set_root_path! raise 'APPLICATION_ROOT is not set' unless defined?(::APPLICATION_ROOT) raise 'APPLICATION_ROOT is not a directory' unless File.directory?(::APPLICATION_ROOT) @root_path = Pathname.new(File.expand_path(::APPLICATION_ROOT)) end
Private Instance Methods
# File lib/rugui/configuration.rb, line 136 def default_automatically_register_conventionally_named_views true end
# File lib/rugui/configuration.rb, line 124 def default_builder_files_paths [] end
# File lib/rugui/configuration.rb, line 102 def default_environment ::RUGUI_ENV end
# File lib/rugui/configuration.rb, line 106 def default_framework_adapter 'GTK' end
# File lib/rugui/configuration.rb, line 140 def default_gems [] end
# File lib/rugui/configuration.rb, line 110 def default_load_paths paths = [] paths.concat %w( app app/models app/controllers app/views app/views/helpers config lib ).map { |dir| root_path.join(dir) }.select { |dir| File.directory?(dir) } end
# File lib/rugui/configuration.rb, line 132 def default_queue_timeout 50 end
# File lib/rugui/configuration.rb, line 128 def default_styles_paths [root_path.join('app', 'resources', 'styles')] end