solidstats 3.0.0.beta.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -0
  3. data/app/assets/javascripts/solidstats/application.js +257 -0
  4. data/app/assets/javascripts/solidstats/dashboard.js +179 -0
  5. data/app/assets/stylesheets/solidstats/application.css +6 -1
  6. data/app/controllers/solidstats/dashboard_controller.rb +28 -35
  7. data/app/controllers/solidstats/gem_metadata_controller.rb +12 -0
  8. data/app/controllers/solidstats/logs_controller.rb +12 -12
  9. data/app/controllers/solidstats/performance_controller.rb +2 -2
  10. data/app/controllers/solidstats/productivity_controller.rb +10 -10
  11. data/app/controllers/solidstats/quality_controller.rb +32 -32
  12. data/app/controllers/solidstats/securities_controller.rb +7 -7
  13. data/app/helpers/solidstats/application_helper.rb +10 -10
  14. data/app/helpers/solidstats/performance_helper.rb +32 -32
  15. data/app/helpers/solidstats/productivity_helper.rb +20 -20
  16. data/app/services/solidstats/bundler_audit_service.rb +13 -13
  17. data/app/services/solidstats/coverage_compass_service.rb +59 -59
  18. data/app/services/solidstats/load_lens_service.rb +90 -70
  19. data/app/services/solidstats/log_size_monitor_service.rb +59 -59
  20. data/app/services/solidstats/my_todo_service.rb +68 -68
  21. data/app/services/solidstats/style_patrol_service.rb +44 -44
  22. data/app/views/layouts/solidstats/application.html.erb +1 -1
  23. data/app/views/solidstats/shared/_quick_actions.html.erb +1 -1
  24. data/config/routes.rb +4 -4
  25. data/lib/generators/solidstats/clean/clean_generator.rb +24 -0
  26. data/lib/generators/solidstats/clean/templates/README +8 -0
  27. data/lib/generators/solidstats/install/install_generator.rb +32 -17
  28. data/lib/generators/solidstats/templates/initializer.rb +112 -0
  29. data/lib/solidstats/asset_compatibility.rb +238 -0
  30. data/lib/solidstats/asset_manifest.rb +205 -0
  31. data/lib/solidstats/engine.rb +49 -9
  32. data/lib/solidstats/version.rb +1 -1
  33. data/lib/solidstats.rb +24 -11
  34. data/lib/tasks/solidstats.rake +67 -0
  35. data/lib/tasks/solidstats_performance.rake +6 -29
  36. data/lib/tasks/solidstats_tasks.rake +16 -0
  37. metadata +14 -5
  38. data/lib/tasks/solidstats_install.rake +0 -13
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Solidstats Configuration
4
+ # This file configures the Solidstats development dashboard
5
+ # Documentation: https://github.com/your-org/solidstats
6
+
7
+ Solidstats.configure do |config|
8
+ # Cache duration for dashboard data (default: 1 hour)
9
+ # config.cache_duration = 1.hour
10
+
11
+ # Enable ViewComponent integration (default: true)
12
+ # config.enable_components = true
13
+
14
+ # Log level for Solidstats operations (default: :info)
15
+ # Levels: :debug, :info, :warn, :error
16
+ # config.log_level = :info
17
+
18
+ # Enable component previews in development (default: true in development)
19
+ # config.enable_previews = Rails.env.development?
20
+
21
+ # Asset configuration for Rails engine compatibility
22
+ config.assets = {
23
+ # Enable asset fingerprinting in production (default: true)
24
+ fingerprint: Rails.env.production?,
25
+
26
+ # Asset pipeline strategy (default: :auto)
27
+ # Options: :sprockets, :webpacker, :importmap, :auto (auto-detect)
28
+ strategy: :auto,
29
+
30
+ # Enable asset precompilation for production (default: true)
31
+ precompile: true,
32
+
33
+ # Compile assets on demand in development (default: true in dev)
34
+ compile_on_demand: Rails.env.development?
35
+ }
36
+
37
+ # CSS framework integration (default: :none)
38
+ # Options: :none, :bootstrap, :tailwind
39
+ # config.css_framework = :none
40
+
41
+ # Security scan settings
42
+ # config.security = {
43
+ # # Include retired gems in vulnerability scans (default: true)
44
+ # include_retired: true,
45
+ #
46
+ # # Severity levels to report (default: [:high, :medium, :low])
47
+ # severity_levels: [:high, :medium, :low],
48
+ #
49
+ # # Cache security scan results (default: 30 minutes)
50
+ # cache_duration: 30.minutes
51
+ # }
52
+
53
+ # Code quality settings
54
+ # config.code_quality = {
55
+ # # Enable complexity analysis (default: true)
56
+ # analyze_complexity: true,
57
+ #
58
+ # # Enable dependency analysis (default: true)
59
+ # analyze_dependencies: true,
60
+ #
61
+ # # Paths to exclude from analysis
62
+ # exclude_paths: ['tmp/', 'log/', 'vendor/']
63
+ # }
64
+
65
+ # Task tracking settings
66
+ # config.tasks = {
67
+ # # Patterns to scan for TODO/FIXME comments
68
+ # patterns: ['TODO', 'FIXME', 'HACK', 'BUG'],
69
+ #
70
+ # # File extensions to scan
71
+ # file_extensions: ['.rb', '.erb', '.js', '.css', '.yml'],
72
+ #
73
+ # # Paths to exclude from task scanning
74
+ # exclude_paths: ['vendor/', 'node_modules/', 'tmp/']
75
+ # }
76
+
77
+ # Asset configuration (advanced)
78
+ # config.assets = {
79
+ # # Enable asset fingerprinting in production (default: true)
80
+ # fingerprint: Rails.env.production?,
81
+ #
82
+ # # Asset compilation strategy
83
+ # # Options: :sprockets, :webpacker, :importmap, :auto
84
+ # strategy: :auto
85
+ # }
86
+ end
87
+
88
+ # Environment-specific configuration
89
+ if Rails.env.development?
90
+ # Development-specific settings
91
+ Solidstats.configure do |config|
92
+ config.log_level = :debug
93
+ config.enable_previews = true
94
+ end
95
+ end
96
+
97
+ # Example: Custom CSS framework integration
98
+ # Uncomment and modify based on your CSS framework
99
+ #
100
+ # # Bootstrap integration
101
+ # if defined?(Bootstrap)
102
+ # Solidstats.configure do |config|
103
+ # config.css_framework = :bootstrap
104
+ # end
105
+ # end
106
+ #
107
+ # # Tailwind CSS integration
108
+ # if Rails.application.config.assets.css_compressor == :tailwindcss
109
+ # Solidstats.configure do |config|
110
+ # config.css_framework = :tailwind
111
+ # end
112
+ # end
@@ -0,0 +1,238 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Solidstats
4
+ # Asset compatibility layer for Rails engines
5
+ # Provides universal asset loading across different Rails asset pipelines
6
+ module AssetCompatibility
7
+ extend self
8
+
9
+ # Include engine assets in host application
10
+ # @param app [Rails::Application] Rails application instance
11
+ def setup_assets(app)
12
+ detect_asset_pipeline(app, force_refresh: true)
13
+ configure_asset_pipeline(app)
14
+ add_asset_helpers(app)
15
+ end
16
+
17
+ # Detect which asset pipeline is being used
18
+ # @param app [Rails::Application] Rails application instance
19
+ # @param force_refresh [Boolean] Force refresh of cached detection
20
+ # @return [Symbol] Detected pipeline (:propshaft, :sprockets, :webpacker, :importmap, :unknown)
21
+ def detect_asset_pipeline(app, force_refresh: false)
22
+ if force_refresh
23
+ @pipeline = nil
24
+ end
25
+
26
+ @pipeline ||= begin
27
+ if propshaft_available?(app)
28
+ :propshaft
29
+ elsif importmap_available?(app)
30
+ :importmap
31
+ elsif webpacker_available?(app)
32
+ :webpacker
33
+ elsif sprockets_available?(app)
34
+ :sprockets
35
+ else
36
+ :unknown
37
+ end
38
+ end
39
+ end
40
+
41
+ # Configure the detected asset pipeline
42
+ # @param app [Rails::Application] Rails application instance
43
+ def configure_asset_pipeline(app)
44
+ case detect_asset_pipeline(app)
45
+ when :propshaft
46
+ configure_propshaft(app)
47
+ when :sprockets
48
+ configure_sprockets(app)
49
+ when :webpacker
50
+ configure_webpacker(app)
51
+ when :importmap
52
+ configure_importmap(app)
53
+ when :unknown
54
+ Solidstats.logger.warn "[Solidstats] No supported asset pipeline detected"
55
+ end
56
+ end
57
+
58
+ # Add universal asset helper methods
59
+ # @param app [Rails::Application] Rails application instance
60
+ def add_asset_helpers(app)
61
+ return unless defined?(ActionView::Base)
62
+
63
+ ActionView::Base.class_eval do
64
+ # Universal stylesheet helper for Solidstats
65
+ def solidstats_stylesheets(*args)
66
+ options = args.extract_options!
67
+ strategy = Solidstats.asset_strategy
68
+
69
+ case strategy
70
+ when :importmap, :sprockets, :propshaft
71
+ stylesheet_link_tag "solidstats/application", **options
72
+ when :webpacker
73
+ if respond_to?(:stylesheet_pack_tag)
74
+ stylesheet_pack_tag "solidstats/application", **options
75
+ else
76
+ stylesheet_link_tag "solidstats/application", **options
77
+ end
78
+ else
79
+ stylesheet_link_tag "solidstats/application", **options
80
+ end
81
+ end
82
+
83
+ # Universal javascript helper for Solidstats
84
+ def solidstats_javascripts(*args)
85
+ options = args.extract_options!
86
+ strategy = Solidstats.asset_strategy
87
+
88
+ case strategy
89
+ when :importmap
90
+ javascript_importmap_tags
91
+ javascript_include_tag "solidstats", **options
92
+ when :webpacker
93
+ if respond_to?(:javascript_pack_tag)
94
+ javascript_pack_tag "solidstats/application", **options
95
+ else
96
+ javascript_include_tag "solidstats/application", **options
97
+ end
98
+ when :sprockets, :propshaft
99
+ javascript_include_tag "solidstats/application", **options
100
+ else
101
+ javascript_include_tag "solidstats/application", **options
102
+ end
103
+ end
104
+
105
+ # Convenience method to include all Solidstats assets
106
+ def solidstats_assets(*args)
107
+ options = args.extract_options!
108
+
109
+ content = []
110
+ content << solidstats_stylesheets(**options.slice(:media, :crossorigin))
111
+ content << solidstats_javascripts(**options.slice(:defer, :async, :crossorigin))
112
+
113
+ safe_join(content, "\n")
114
+ end
115
+ end
116
+
117
+ Solidstats.logger.info "[Solidstats] Added universal asset helpers"
118
+ rescue => e
119
+ Solidstats.logger.warn "[Solidstats] Could not add asset helpers: #{e.message}"
120
+ end
121
+
122
+ private
123
+
124
+ # Check if Propshaft is available
125
+ def propshaft_available?(app)
126
+ defined?(Propshaft) && app.config.respond_to?(:assets) &&
127
+ app.assets.is_a?(Propshaft::Assembly)
128
+ end
129
+
130
+ # Check if Importmap is available
131
+ def importmap_available?(app)
132
+ defined?(Importmap) &&
133
+ app.config.respond_to?(:importmap) &&
134
+ File.exist?(Rails.root.join("config/importmap.rb"))
135
+ end
136
+
137
+ # Check if Webpacker is available
138
+ def webpacker_available?(app)
139
+ defined?(Webpacker) &&
140
+ app.config.respond_to?(:webpacker) &&
141
+ File.exist?(Rails.root.join("config/webpacker.yml"))
142
+ end
143
+
144
+ # Check if Sprockets is available
145
+ def sprockets_available?(app)
146
+ defined?(Sprockets) && app.config.respond_to?(:assets) &&
147
+ !propshaft_available?(app)
148
+ end
149
+
150
+ # Configure Propshaft asset pipeline
151
+ def configure_propshaft(app)
152
+ return unless app.config.respond_to?(:assets)
153
+
154
+ # Add engine asset paths
155
+ engine_paths = [
156
+ Solidstats::Engine.root.join("app", "assets", "stylesheets"),
157
+ Solidstats::Engine.root.join("app", "assets", "javascripts"),
158
+ Solidstats::Engine.root.join("app", "assets", "images")
159
+ ]
160
+
161
+ engine_paths.each do |path|
162
+ path_str = path.to_s
163
+ unless app.config.assets.paths.include?(path_str)
164
+ app.config.assets.paths << path_str
165
+ end
166
+ end
167
+
168
+ # Add to precompile list
169
+ precompile_assets = [
170
+ "solidstats/application.css",
171
+ "solidstats/application.js"
172
+ ]
173
+
174
+ precompile_assets.each do |asset|
175
+ unless app.config.assets.precompile.include?(asset)
176
+ app.config.assets.precompile << asset
177
+ end
178
+ end
179
+
180
+ Solidstats.logger.info "[Solidstats] Configured Propshaft asset pipeline"
181
+ end
182
+
183
+ # Configure Sprockets asset pipeline
184
+ def configure_sprockets(app)
185
+ return unless app.config.respond_to?(:assets)
186
+
187
+ # Add engine asset paths
188
+ engine_paths = [
189
+ Solidstats::Engine.root.join("app", "assets", "stylesheets"),
190
+ Solidstats::Engine.root.join("app", "assets", "javascripts"),
191
+ Solidstats::Engine.root.join("app", "assets", "images")
192
+ ]
193
+
194
+ engine_paths.each do |path|
195
+ path_str = path.to_s
196
+ unless app.config.assets.paths.include?(path_str)
197
+ app.config.assets.paths << path_str
198
+ end
199
+ end
200
+
201
+ # Add to precompile list
202
+ precompile_assets = [
203
+ "solidstats/application.css",
204
+ "solidstats/application.js"
205
+ ]
206
+
207
+ precompile_assets.each do |asset|
208
+ unless app.config.assets.precompile.include?(asset)
209
+ app.config.assets.precompile << asset
210
+ end
211
+ end
212
+
213
+ Solidstats.logger.info "[Solidstats] Configured Sprockets asset pipeline"
214
+ end
215
+
216
+ # Configure Webpacker asset pipeline
217
+ def configure_webpacker(app)
218
+ # Webpacker configuration is more complex and typically requires
219
+ # manual setup in the host application
220
+ Solidstats.logger.info "[Solidstats] Webpacker detected - manual configuration may be required"
221
+
222
+ # Add source path if possible
223
+ if app.config.webpacker.respond_to?(:source_path)
224
+ engine_source = Solidstats::Engine.root.join("app", "javascript")
225
+ if engine_source.exist?
226
+ Solidstats.logger.info "[Solidstats] Engine JavaScript available at: #{engine_source}"
227
+ end
228
+ end
229
+ end
230
+
231
+ # Configure Importmap asset pipeline
232
+ def configure_importmap(app)
233
+ # Importmap configuration is handled through config/importmap.rb
234
+ # The generator should add the appropriate pin statements
235
+ Solidstats.logger.info "[Solidstats] Importmap detected - configuration in config/importmap.rb"
236
+ end
237
+ end
238
+ end
@@ -0,0 +1,205 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Solidstats Asset Manifest
4
+ # This file defines all assets that should be precompiled for production deployment
5
+ # Compatible with Sprockets, Webpacker, and Importmap
6
+
7
+ module Solidstats
8
+ class AssetManifest
9
+ # Define all assets that should be precompiled
10
+ PRECOMPILE_ASSETS = [
11
+ # Main application assets
12
+ "solidstats/application.css",
13
+ "solidstats/application.js",
14
+
15
+ # Component-specific CSS files (using actual filenames)
16
+ "solidstats/components/summary_card.css",
17
+ "solidstats/components/dashboard_layout.css",
18
+ "solidstats/components/tab_navigation.css",
19
+ "solidstats/components/quick_navigation.css",
20
+ "solidstats/components/action_button.css",
21
+ "solidstats/components/dashboard_header.css",
22
+ "solidstats/components/navigation.css",
23
+ "solidstats/components/security.css",
24
+ "solidstats/components/status_badge.css",
25
+ "solidstats/components/dashboard.css"
26
+ ].freeze
27
+
28
+ # Assets that should be included in development mode
29
+ DEVELOPMENT_ASSETS = [
30
+ # Preview and development-only assets
31
+ "solidstats/component_preview.css",
32
+ "solidstats/development_toolbar.css"
33
+ ].freeze
34
+
35
+ # Image assets to precompile
36
+ IMAGE_ASSETS = [
37
+ # Add image assets here when they exist
38
+ # "solidstats/icons/*.png",
39
+ # "solidstats/logos/*.svg"
40
+ ].freeze
41
+
42
+ class << self
43
+ # Get all assets for precompilation based on environment
44
+ # @param environment [String] Rails environment
45
+ # @return [Array<String>] Assets to precompile
46
+ def assets_for_environment(environment = Rails.env)
47
+ assets = PRECOMPILE_ASSETS.dup
48
+
49
+ if environment == "development"
50
+ assets.concat(DEVELOPMENT_ASSETS)
51
+ end
52
+
53
+ assets.concat(IMAGE_ASSETS)
54
+ assets.uniq
55
+ end
56
+
57
+ # Configure asset precompilation for a Rails application
58
+ # @param app [Rails::Application] Rails application instance
59
+ def configure_precompilation(app)
60
+ return unless app.config.respond_to?(:assets)
61
+
62
+ assets_to_add = assets_for_environment - app.config.assets.precompile
63
+
64
+ assets_to_add.each do |asset|
65
+ app.config.assets.precompile << asset
66
+ end
67
+
68
+ # Add asset paths if not already present
69
+ add_asset_paths(app)
70
+
71
+ Rails.logger.info "[Solidstats] Added #{assets_to_add.size} assets to precompilation list"
72
+ end
73
+
74
+ # Add engine asset paths to application
75
+ # @param app [Rails::Application] Rails application instance
76
+ def add_asset_paths(app)
77
+ return unless app.config.respond_to?(:assets)
78
+
79
+ engine_paths = [
80
+ Solidstats::Engine.root.join("app", "assets", "stylesheets"),
81
+ Solidstats::Engine.root.join("app", "assets", "javascripts"),
82
+ Solidstats::Engine.root.join("app", "assets", "images")
83
+ ]
84
+
85
+ engine_paths.each do |path|
86
+ path_str = path.to_s
87
+ unless app.config.assets.paths.include?(path_str)
88
+ app.config.assets.paths << path_str
89
+ end
90
+ end
91
+ end
92
+
93
+ # Get asset fingerprinting configuration
94
+ # @param environment [String] Rails environment
95
+ # @return [Hash] Fingerprinting configuration
96
+ def fingerprint_config(environment = Rails.env)
97
+ case environment
98
+ when "production"
99
+ {
100
+ digest: true,
101
+ compile: false,
102
+ compress: true,
103
+ gzip: true
104
+ }
105
+ when "staging"
106
+ {
107
+ digest: true,
108
+ compile: false,
109
+ compress: true,
110
+ gzip: false
111
+ }
112
+ when "development"
113
+ {
114
+ digest: false,
115
+ compile: true,
116
+ compress: false,
117
+ gzip: false,
118
+ debug: true
119
+ }
120
+ when "test"
121
+ {
122
+ digest: false,
123
+ compile: true,
124
+ compress: false,
125
+ gzip: false,
126
+ debug: false
127
+ }
128
+ else
129
+ # Default safe configuration
130
+ {
131
+ digest: true,
132
+ compile: false,
133
+ compress: true,
134
+ gzip: false
135
+ }
136
+ end
137
+ end
138
+
139
+ # Apply fingerprinting configuration to application
140
+ # @param app [Rails::Application] Rails application instance
141
+ # @param environment [String] Rails environment
142
+ def configure_fingerprinting(app, environment = Rails.env)
143
+ return unless app.config.respond_to?(:assets)
144
+
145
+ config = fingerprint_config(environment)
146
+
147
+ config.each do |key, value|
148
+ if app.config.assets.respond_to?("#{key}=")
149
+ app.config.assets.public_send("#{key}=", value)
150
+ end
151
+ end
152
+
153
+ Rails.logger.info "[Solidstats] Applied #{environment} asset fingerprinting configuration"
154
+ end
155
+
156
+ # Check if all required assets exist
157
+ # @return [Array<String>] Missing assets
158
+ def missing_assets
159
+ missing = []
160
+
161
+ PRECOMPILE_ASSETS.each do |asset|
162
+ asset_path = resolve_asset_path(asset)
163
+ unless File.exist?(asset_path)
164
+ missing << asset
165
+ end
166
+ end
167
+
168
+ missing
169
+ end
170
+
171
+ # Validate that all assets are available
172
+ # @raise [Solidstats::Error] If required assets are missing
173
+ def validate_assets!
174
+ missing = missing_assets
175
+
176
+ unless missing.empty?
177
+ raise Solidstats::Error,
178
+ "Missing required assets: #{missing.join(', ')}"
179
+ end
180
+
181
+ true
182
+ end
183
+
184
+ private
185
+
186
+ # Resolve the file system path for an asset
187
+ # @param asset [String] Asset logical path
188
+ # @return [String] File system path
189
+ def resolve_asset_path(asset)
190
+ # Remove the 'solidstats/' prefix and find the actual file
191
+ relative_path = asset.sub(/^solidstats\//, "")
192
+
193
+ # Try different possible locations
194
+ possible_paths = [
195
+ Solidstats::Engine.root.join("app", "assets", "stylesheets", "solidstats", relative_path),
196
+ Solidstats::Engine.root.join("app", "assets", "javascripts", "solidstats", relative_path),
197
+ Solidstats::Engine.root.join("app", "assets", "images", "solidstats", relative_path)
198
+ ]
199
+
200
+ possible_paths.find { |path| File.exist?(path) } ||
201
+ Solidstats::Engine.root.join("app", "assets", "stylesheets", asset).to_s
202
+ end
203
+ end
204
+ end
205
+ end
@@ -1,22 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/engine" if defined?(Rails)
4
+
1
5
  module Solidstats
2
6
  class Engine < ::Rails::Engine
3
- isolate_namespace Solidstats
7
+ isolate_namespace Solidstats if defined?(Rails)
4
8
 
5
- initializer "solidstats.only_in_dev" do
9
+ # Engine configuration
10
+ config.solidstats = ActiveSupport::OrderedOptions.new
11
+
12
+ # Set default configuration values
13
+ config.before_configuration do
14
+ config.solidstats.cache_duration = 1.hour
15
+ config.solidstats.enable_components = true
16
+ config.solidstats.log_level = :info
17
+ config.solidstats.enable_previews = Rails.env.development?
18
+ end
19
+
20
+ # Ensure gem only runs in development environment
21
+ initializer "solidstats.environment_check", before: :load_config_initializers do
6
22
  unless Rails.env.development?
7
- raise "Solidstats can only be used in development mode."
23
+ raise Solidstats::ConfigurationError,
24
+ "Solidstats can only be used in development mode. Current environment: #{Rails.env}"
8
25
  end
9
26
  end
10
27
 
28
+ # Add custom paths for autoloading
29
+ initializer "solidstats.autoload_paths" do |app|
30
+ app.config.autoload_paths += Dir[Engine.root.join("app", "components", "**")]
31
+ app.config.autoload_paths += Dir[Engine.root.join("app", "services", "**")]
32
+ end
33
+
34
+ # Add custom generators path
35
+ config.generators do |g|
36
+ g.test_framework :minitest, spec: false, fixture: false
37
+ end
38
+
39
+ # Isolate the Solidstats engine's namespace
40
+ isolate_namespace Solidstats
41
+
42
+ # Set up Solidstats asset precompilation
11
43
  initializer "solidstats.assets.precompile" do |app|
12
- if Rails.env.development?
13
- app.config.assets.precompile += %w[ solidstats/application.css ]
14
- end
44
+ app.config.assets.precompile += %w[solidstats/application.css]
45
+ end
46
+
47
+ private
48
+
49
+ # Logging helpers with consistent formatting
50
+ def log_info(message)
51
+ Rails.logger&.info("[Solidstats] #{message}")
52
+ end
53
+
54
+ def log_error(message)
55
+ Rails.logger&.error("[Solidstats] #{message}")
15
56
  end
16
57
 
17
- # Load the solidstats rake tasks
18
- rake_tasks do
19
- Dir[File.join(File.dirname(__FILE__), "../tasks/**/*.rake")].each { |f| load f }
58
+ def log_debug(message)
59
+ Rails.logger&.debug("[Solidstats] #{message}")
20
60
  end
21
61
  end
22
62
  end
@@ -1,3 +1,3 @@
1
1
  module Solidstats
2
- VERSION = "3.0.0.beta.1"
2
+ VERSION = "3.0.0"
3
3
  end
data/lib/solidstats.rb CHANGED
@@ -1,18 +1,31 @@
1
1
  require "solidstats/version"
2
2
  require "solidstats/engine"
3
3
 
4
+ # Top-level module for Solidstats gem
4
5
  module Solidstats
5
- class << self
6
- # Returns the absolute path to this gem's root directory
7
- # @return [String] Gem root path
8
- def root
9
- File.dirname(__dir__)
10
- end
6
+ # Gem setup
7
+ extend self
11
8
 
12
- # Returns version string
13
- # @return [String] Version
14
- def version
15
- VERSION
16
- end
9
+ # Gem version
10
+ def version
11
+ VERSION
12
+ end
13
+
14
+ # Simple logger for internal use
15
+ def logger
16
+ @logger ||= Logger.new($stdout)
17
+ end
18
+
19
+ # Error classes for Solidstats specific exceptions
20
+ class Error < StandardError; end
21
+ class ComponentError < Error; end
22
+ class ServiceError < Error; end
23
+
24
+ # Load and initialize Solidstats in a Rails environment
25
+ def self.load!
26
+ nil unless defined?(Rails)
17
27
  end
18
28
  end
29
+
30
+ # Load Solidstats automatically when Rails is loaded
31
+ Solidstats.load! if defined?(Rails)