Module: Solidstats
- Defined in:
- lib/solidstats/asset_manifest.rb,
lib/solidstats.rb,
lib/solidstats/engine.rb,
lib/solidstats/version.rb,
lib/solidstats/asset_compatibility.rb,
app/jobs/solidstats/application_job.rb,
app/services/solidstats/todo_service.rb,
app/services/solidstats/audit_service.rb,
app/components/solidstats/base_component.rb,
app/models/solidstats/application_record.rb,
app/helpers/solidstats/application_helper.rb,
app/mailers/solidstats/application_mailer.rb,
lib/generators/solidstats/install_generator.rb,
app/services/solidstats/data_collector_service.rb,
app/controllers/solidstats/dashboard_controller.rb,
app/services/solidstats/log_size_monitor_service.rb,
app/components/solidstats/tasks_section_component.rb,
app/components/solidstats/ui/navigation_component.rb,
app/controllers/solidstats/application_controller.rb,
app/controllers/solidstats/gem_metadata_controller.rb,
app/components/solidstats/ui/status_badge_component.rb,
app/components/solidstats/ui/summary_card_component.rb,
lib/generators/solidstats/feature/feature_generator.rb,
lib/generators/solidstats/install/install_generator.rb,
app/components/solidstats/dashboard_header_component.rb,
app/components/solidstats/quick_navigation_component.rb,
app/components/solidstats/security/section_component.rb,
app/components/solidstats/ui/action_button_component.rb,
app/services/solidstats/gem_metadata/fetcher_service.rb,
app/components/solidstats/security/overview_component.rb,
app/components/solidstats/security/timeline_component.rb,
app/components/solidstats/ui/stats_overview_component.rb,
app/components/solidstats/ui/tab_navigation_component.rb,
app/components/solidstats/ui/dashboard_layout_component.rb,
app/components/solidstats/code_quality/section_component.rb,
app/components/solidstats/previews/navigation_component_preview.rb,
app/components/solidstats/security/gem_impact_analysis_component.rb,
app/components/solidstats/previews/status_badge_component_preview.rb,
app/components/solidstats/previews/summary_card_component_preview.rb,
app/components/solidstats/previews/action_button_component_preview.rb,
app/components/solidstats/previews/stats_overview_component_preview.rb
Overview
Solidstats Asset Manifest This file defines all assets that should be precompiled for production deployment Compatible with Sprockets, Webpacker, and Importmap
Defined Under Namespace
Modules: ApplicationHelper, AssetCompatibility, CodeQuality, GemMetadata, Generators, Previews, Security, Ui Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, AssetManifest, AuditService, BaseComponent, ComponentError, Configuration, ConfigurationError, DashboardController, DashboardHeaderComponent, DataCollectorService, Engine, Error, GemMetadataController, LogSizeMonitorService, QuickNavigationComponent, ServiceError, TasksSectionComponent, TodoService
Constant Summary collapse
- VERSION =
"2.0.0"
Class Method Summary collapse
-
.app_path ⇒ Pathname
Returns the gem’s app directory.
-
.asset_fingerprinting? ⇒ Boolean
Check if assets should be fingerprinted.
-
.asset_prefix ⇒ String
Get the asset prefix for engine assets.
-
.asset_strategy ⇒ Symbol
Get asset strategy for current application.
-
.components_path ⇒ Pathname
Returns the components directory.
-
.configuration ⇒ Configuration
Configuration object for the gem.
-
.configure {|Configuration| ... } ⇒ Object
Configure the gem with a block.
-
.development? ⇒ Boolean
Check if running in development mode.
-
.engine ⇒ Solidstats::Engine
Get engine instance.
-
.ensure_view_component! ⇒ Boolean
Safely load ViewComponent if not already loaded.
-
.environment ⇒ String?
Current Rails environment.
-
.environment_suitable? ⇒ Boolean
Check if Solidstats can run in current environment.
-
.logger ⇒ Logger
Logger instance with fallback.
-
.logger=(custom_logger) ⇒ Object
Set a custom logger.
-
.production? ⇒ Boolean
Check if running in production mode.
-
.reset_configuration! ⇒ Configuration
Reset configuration to defaults.
-
.root ⇒ Pathname
Returns the absolute path to this gem’s root directory.
-
.services_path ⇒ Pathname
Returns the services directory.
-
.test? ⇒ Boolean
Check if running in test mode.
-
.version ⇒ String
Returns version string.
-
.view_component_available? ⇒ Boolean
Check if ViewComponent is available and properly loaded.
Class Method Details
.app_path ⇒ Pathname
Returns the gem’s app directory
36 37 38 |
# File 'lib/solidstats.rb', line 36 def app_path @app_path ||= root.join("app") end |
.asset_fingerprinting? ⇒ Boolean
Check if assets should be fingerprinted
188 189 190 |
# File 'lib/solidstats.rb', line 188 def asset_fingerprinting? configuration.assets[:fingerprint] && !Rails.env.development? end |
.asset_prefix ⇒ String
Get the asset prefix for engine assets
194 195 196 197 198 199 200 201 202 203 |
# File 'lib/solidstats.rb', line 194 def asset_prefix case asset_strategy when :importmap, :sprockets "solidstats" when :webpacker "solidstats" else "solidstats" end end |
.asset_strategy ⇒ Symbol
Get asset strategy for current application
171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/solidstats.rb', line 171 def asset_strategy return configuration.assets[:strategy] if configuration.assets[:strategy] != :auto # Auto-detect asset strategy if defined?(Importmap) && File.exist?(Rails.root.join("config/importmap.rb")) :importmap elsif defined?(Webpacker) && File.exist?(Rails.root.join("config/webpacker.yml")) :webpacker elsif defined?(Sprockets) :sprockets else :none end end |
.components_path ⇒ Pathname
Returns the components directory
42 43 44 |
# File 'lib/solidstats.rb', line 42 def components_path @components_path ||= app_path.join("components", "solidstats") end |
.configuration ⇒ Configuration
Configuration object for the gem
117 118 119 |
# File 'lib/solidstats.rb', line 117 def configuration @configuration ||= Configuration.new end |
.configure {|Configuration| ... } ⇒ Object
Configure the gem with a block
128 129 130 131 |
# File 'lib/solidstats.rb', line 128 def configure yield(configuration) if block_given? configuration end |
.development? ⇒ Boolean
Check if running in development mode
93 94 95 |
# File 'lib/solidstats.rb', line 93 def development? defined?(Rails) && Rails.env.development? end |
.engine ⇒ Solidstats::Engine
Get engine instance
165 166 167 |
# File 'lib/solidstats.rb', line 165 def engine Engine end |
.ensure_view_component! ⇒ Boolean
Safely load ViewComponent if not already loaded
62 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 |
# File 'lib/solidstats.rb', line 62 def ensure_view_component! return true if view_component_available? unless defined?(Rails) logger.warn "[Solidstats] Rails not available - ViewComponent cannot be loaded" return false end begin require "view_component" require "view_component/engine" # Verify it loaded correctly if view_component_available? logger.info "[Solidstats] ViewComponent loaded successfully" true else logger.error "[Solidstats] ViewComponent loaded but not properly initialized" false end rescue LoadError => e logger.warn "[Solidstats] ViewComponent not available: #{e.message}" false rescue StandardError => e logger.error "[Solidstats] Failed to load ViewComponent: #{e.message}" false end end |
.environment ⇒ String?
Current Rails environment
111 112 113 |
# File 'lib/solidstats.rb', line 111 def environment Rails.env if defined?(Rails) end |
.environment_suitable? ⇒ Boolean
Check if Solidstats can run in current environment
154 155 156 157 158 159 160 161 |
# File 'lib/solidstats.rb', line 154 def environment_suitable? unless development? raise ConfigurationError, "Solidstats can only be used in development mode. Current: #{environment || 'unknown'}" end true end |
.logger ⇒ Logger
Logger instance with fallback
141 142 143 |
# File 'lib/solidstats.rb', line 141 def logger @logger ||= build_logger end |
.logger=(custom_logger) ⇒ Object
Set a custom logger
147 148 149 |
# File 'lib/solidstats.rb', line 147 def logger=(custom_logger) @logger = custom_logger end |
.production? ⇒ Boolean
Check if running in production mode
99 100 101 |
# File 'lib/solidstats.rb', line 99 def production? defined?(Rails) && Rails.env.production? end |
.reset_configuration! ⇒ Configuration
Reset configuration to defaults
135 136 137 |
# File 'lib/solidstats.rb', line 135 def reset_configuration! @configuration = Configuration.new end |
.root ⇒ Pathname
Returns the absolute path to this gem’s root directory
24 25 26 |
# File 'lib/solidstats.rb', line 24 def root @root ||= Pathname.new(File.dirname(__dir__)) end |
.services_path ⇒ Pathname
Returns the services directory
48 49 50 |
# File 'lib/solidstats.rb', line 48 def services_path @services_path ||= app_path.join("services", "solidstats") end |
.test? ⇒ Boolean
Check if running in test mode
105 106 107 |
# File 'lib/solidstats.rb', line 105 def test? defined?(Rails) && Rails.env.test? end |
.version ⇒ String
Returns version string
30 31 32 |
# File 'lib/solidstats.rb', line 30 def version VERSION end |
.view_component_available? ⇒ Boolean
Check if ViewComponent is available and properly loaded
54 55 56 57 58 |
# File 'lib/solidstats.rb', line 54 def view_component_available? defined?(ViewComponent::Base) && ViewComponent::Base.respond_to?(:new) && defined?(Rails) end |