Class: CapyDash::Configuration
- Inherits:
-
Object
- Object
- CapyDash::Configuration
- Defined in:
- lib/capydash/configuration.rb
Instance Attribute Summary collapse
-
#dashboard ⇒ Object
Returns the value of attribute dashboard.
-
#logging ⇒ Object
Returns the value of attribute logging.
-
#performance ⇒ Object
Returns the value of attribute performance.
-
#security ⇒ Object
Returns the value of attribute security.
-
#server ⇒ Object
Returns the value of attribute server.
-
#tests ⇒ Object
Returns the value of attribute tests.
Class Method Summary collapse
Instance Method Summary collapse
- #auth_enabled? ⇒ Boolean
- #auto_scroll? ⇒ Boolean
- #cleanup_interval ⇒ Object
- #compression_enabled? ⇒ Boolean
- #controller_tests_dir ⇒ Object
- #dashboard_title ⇒ Object
- #feature_tests_dir ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_from_hash(hash) ⇒ Object
- #log_file ⇒ Object
- #log_level ⇒ Object
- #max_connections ⇒ Object
- #max_file_size ⇒ Object
- #max_files ⇒ Object
- #max_memory_usage ⇒ Object
- #max_screenshot_width ⇒ Object
- #message_history_limit ⇒ Object
- #model_tests_dir ⇒ Object
- #screenshot_dir ⇒ Object
- #screenshot_quality ⇒ Object
- #secret_key ⇒ Object
- #server_host ⇒ Object
- #server_port ⇒ Object
- #session_timeout ⇒ Object
- #show_timestamps? ⇒ Boolean
- #system_tests_dir ⇒ Object
- #test_timeout ⇒ Object
- #websocket_path ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/capydash/configuration.rb', line 5 def initialize @server = { host: "localhost", port: 4000, websocket_path: "/websocket", max_connections: 100, message_history_limit: 1000 } @dashboard = { title: "CapyDash Test Monitor", refresh_interval: 1000, auto_scroll: true, show_timestamps: true, screenshot_quality: 0.8, max_screenshot_width: 1200 } @tests = { default_directory: "test", system_tests_dir: "test/system", feature_tests_dir: "test/features", controller_tests_dir: "test/controllers", model_tests_dir: "test/models", screenshot_dir: "tmp/capydash_screenshots", timeout: 300 } @logging = { level: "info", file: "log/capydash.log", max_file_size: "10MB", max_files: 5 } @security = { enable_auth: false, secret_key: "your-secret-key-here", session_timeout: 3600 } @performance = { enable_compression: true, cleanup_interval: 300, max_memory_usage: "512MB" } end |
Instance Attribute Details
#dashboard ⇒ Object
Returns the value of attribute dashboard.
3 4 5 |
# File 'lib/capydash/configuration.rb', line 3 def dashboard @dashboard end |
#logging ⇒ Object
Returns the value of attribute logging.
3 4 5 |
# File 'lib/capydash/configuration.rb', line 3 def logging @logging end |
#performance ⇒ Object
Returns the value of attribute performance.
3 4 5 |
# File 'lib/capydash/configuration.rb', line 3 def performance @performance end |
#security ⇒ Object
Returns the value of attribute security.
3 4 5 |
# File 'lib/capydash/configuration.rb', line 3 def security @security end |
#server ⇒ Object
Returns the value of attribute server.
3 4 5 |
# File 'lib/capydash/configuration.rb', line 3 def server @server end |
#tests ⇒ Object
Returns the value of attribute tests.
3 4 5 |
# File 'lib/capydash/configuration.rb', line 3 def tests @tests end |
Class Method Details
.load_from_file(config_path = nil) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/capydash/configuration.rb', line 53 def self.load_from_file(config_path = nil) config_path ||= File.join(Dir.pwd, "config", "capydash.yml") if File.exist?(config_path) require 'yaml' yaml_config = YAML.load_file(config_path) config = new config.load_from_hash(yaml_config) config else # Return default configuration if file doesn't exist new end rescue => e puts "Warning: Could not load configuration from #{config_path}: #{e.message}" puts "Using default configuration." new end |
Instance Method Details
#auth_enabled? ⇒ Boolean
162 163 164 |
# File 'lib/capydash/configuration.rb', line 162 def auth_enabled? @security[:enable_auth] end |
#auto_scroll? ⇒ Boolean
106 107 108 |
# File 'lib/capydash/configuration.rb', line 106 def auto_scroll? @dashboard[:auto_scroll] end |
#cleanup_interval ⇒ Object
178 179 180 |
# File 'lib/capydash/configuration.rb', line 178 def cleanup_interval @performance[:cleanup_interval] end |
#compression_enabled? ⇒ Boolean
174 175 176 |
# File 'lib/capydash/configuration.rb', line 174 def compression_enabled? @performance[:enable_compression] end |
#controller_tests_dir ⇒ Object
130 131 132 |
# File 'lib/capydash/configuration.rb', line 130 def controller_tests_dir @tests[:controller_tests_dir] end |
#dashboard_title ⇒ Object
102 103 104 |
# File 'lib/capydash/configuration.rb', line 102 def dashboard_title @dashboard[:title] end |
#feature_tests_dir ⇒ Object
126 127 128 |
# File 'lib/capydash/configuration.rb', line 126 def feature_tests_dir @tests[:feature_tests_dir] end |
#load_from_hash(hash) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/capydash/configuration.rb', line 73 def load_from_hash(hash) @server.merge!(hash['server']) if hash['server'] @dashboard.merge!(hash['dashboard']) if hash['dashboard'] @tests.merge!(hash['tests']) if hash['tests'] @logging.merge!(hash['logging']) if hash['logging'] @security.merge!(hash['security']) if hash['security'] @performance.merge!(hash['performance']) if hash['performance'] end |
#log_file ⇒ Object
150 151 152 |
# File 'lib/capydash/configuration.rb', line 150 def log_file @logging[:file] end |
#log_level ⇒ Object
146 147 148 |
# File 'lib/capydash/configuration.rb', line 146 def log_level @logging[:level] end |
#max_connections ⇒ Object
94 95 96 |
# File 'lib/capydash/configuration.rb', line 94 def max_connections @server[:max_connections] end |
#max_file_size ⇒ Object
158 159 160 |
# File 'lib/capydash/configuration.rb', line 158 def max_file_size @logging[:max_file_size] end |
#max_files ⇒ Object
154 155 156 |
# File 'lib/capydash/configuration.rb', line 154 def max_files @logging[:max_files] end |
#max_memory_usage ⇒ Object
182 183 184 |
# File 'lib/capydash/configuration.rb', line 182 def max_memory_usage @performance[:max_memory_usage] end |
#max_screenshot_width ⇒ Object
118 119 120 |
# File 'lib/capydash/configuration.rb', line 118 def max_screenshot_width @dashboard[:max_screenshot_width] end |
#message_history_limit ⇒ Object
98 99 100 |
# File 'lib/capydash/configuration.rb', line 98 def @server[:message_history_limit] end |
#model_tests_dir ⇒ Object
134 135 136 |
# File 'lib/capydash/configuration.rb', line 134 def model_tests_dir @tests[:model_tests_dir] end |
#screenshot_dir ⇒ Object
138 139 140 |
# File 'lib/capydash/configuration.rb', line 138 def screenshot_dir @tests[:screenshot_dir] end |
#screenshot_quality ⇒ Object
114 115 116 |
# File 'lib/capydash/configuration.rb', line 114 def screenshot_quality @dashboard[:screenshot_quality] end |
#secret_key ⇒ Object
166 167 168 |
# File 'lib/capydash/configuration.rb', line 166 def secret_key @security[:secret_key] end |
#server_host ⇒ Object
82 83 84 |
# File 'lib/capydash/configuration.rb', line 82 def server_host @server[:host] end |
#server_port ⇒ Object
86 87 88 |
# File 'lib/capydash/configuration.rb', line 86 def server_port @server[:port] end |
#session_timeout ⇒ Object
170 171 172 |
# File 'lib/capydash/configuration.rb', line 170 def session_timeout @security[:session_timeout] end |
#show_timestamps? ⇒ Boolean
110 111 112 |
# File 'lib/capydash/configuration.rb', line 110 def @dashboard[:show_timestamps] end |
#system_tests_dir ⇒ Object
122 123 124 |
# File 'lib/capydash/configuration.rb', line 122 def system_tests_dir @tests[:system_tests_dir] end |
#test_timeout ⇒ Object
142 143 144 |
# File 'lib/capydash/configuration.rb', line 142 def test_timeout @tests[:timeout] end |
#websocket_path ⇒ Object
90 91 92 |
# File 'lib/capydash/configuration.rb', line 90 def websocket_path @server[:websocket_path] end |