solidstats 1.0.0 ā 2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +85 -0
- data/README.md +35 -0
- data/app/assets/javascripts/solidstats/application.js +257 -0
- data/app/assets/javascripts/solidstats/dashboard.js +225 -0
- data/app/assets/javascripts/solidstats/gem_metadata.js +554 -0
- data/app/assets/stylesheets/solidstats/application.css +6 -1
- data/app/assets/stylesheets/solidstats/components/action_button.css +99 -0
- data/app/assets/stylesheets/solidstats/components/dashboard.css +151 -0
- data/app/assets/stylesheets/solidstats/components/dashboard_header.css +93 -0
- data/app/assets/stylesheets/solidstats/components/dashboard_layout.css +97 -0
- data/app/assets/stylesheets/solidstats/components/gem_metadata.css +1403 -0
- data/app/assets/stylesheets/solidstats/components/navigation.css +80 -0
- data/app/assets/stylesheets/solidstats/components/quick_navigation.css +54 -0
- data/app/assets/stylesheets/solidstats/components/security.css +332 -0
- data/app/assets/stylesheets/solidstats/components/status_badge.css +58 -0
- data/app/assets/stylesheets/solidstats/components/summary_card.css +66 -0
- data/app/assets/stylesheets/solidstats/components/tab_navigation.css +95 -0
- data/app/components/solidstats/base_component.rb +88 -0
- data/app/components/solidstats/code_quality/code_quality_section_component.html.erb +0 -0
- data/app/components/solidstats/code_quality/code_quality_section_component.rb +0 -0
- data/app/components/solidstats/code_quality/section_component.html.erb +45 -0
- data/app/components/solidstats/code_quality/section_component.rb +34 -0
- data/app/components/solidstats/dashboard_header_component.html.erb +39 -0
- data/app/components/solidstats/dashboard_header_component.rb +33 -0
- data/app/components/solidstats/previews/action_button_component_preview/button_vs_link.html.erb +6 -0
- data/app/components/solidstats/previews/action_button_component_preview/sizes.html.erb +6 -0
- data/app/components/solidstats/previews/action_button_component_preview/variants.html.erb +6 -0
- data/app/components/solidstats/previews/action_button_component_preview/with_icons.html.erb +6 -0
- data/app/components/solidstats/previews/action_button_component_preview.rb +64 -0
- data/app/components/solidstats/previews/navigation_component_preview.rb +74 -0
- data/app/components/solidstats/previews/stats_overview_component_preview.rb +100 -0
- data/app/components/solidstats/previews/status_badge_component_preview/sizes.html.erb +6 -0
- data/app/components/solidstats/previews/status_badge_component_preview/statuses.html.erb +6 -0
- data/app/components/solidstats/previews/status_badge_component_preview/with_icons.html.erb +6 -0
- data/app/components/solidstats/previews/status_badge_component_preview.rb +49 -0
- data/app/components/solidstats/previews/summary_card_component_preview/clickable.html.erb +9 -0
- data/app/components/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb +9 -0
- data/app/components/solidstats/previews/summary_card_component_preview/statuses.html.erb +6 -0
- data/app/components/solidstats/previews/summary_card_component_preview/value_formats.html.erb +6 -0
- data/app/components/solidstats/previews/summary_card_component_preview.rb +67 -0
- data/app/components/solidstats/quick_navigation_component.html.erb +8 -0
- data/app/components/solidstats/quick_navigation_component.rb +21 -0
- data/app/components/solidstats/security/gem_impact_analysis_component.html.erb +44 -0
- data/app/components/solidstats/security/gem_impact_analysis_component.rb +45 -0
- data/app/components/solidstats/security/overview_component.html.erb +21 -0
- data/app/components/solidstats/security/overview_component.rb +104 -0
- data/app/components/solidstats/security/section_component.html.erb +26 -0
- data/app/components/solidstats/security/section_component.rb +52 -0
- data/app/components/solidstats/security/timeline_component.html.erb +39 -0
- data/app/components/solidstats/security/timeline_component.rb +43 -0
- data/app/components/solidstats/tasks_section_component.html.erb +17 -0
- data/app/components/solidstats/tasks_section_component.rb +22 -0
- data/app/components/solidstats/ui/action_button_component.html.erb +6 -0
- data/app/components/solidstats/ui/action_button_component.rb +71 -0
- data/app/components/solidstats/ui/dashboard_layout_component.html.erb +19 -0
- data/app/components/solidstats/ui/dashboard_layout_component.rb +85 -0
- data/app/components/solidstats/ui/navigation_component.html.erb +34 -0
- data/app/components/solidstats/ui/navigation_component.rb +72 -0
- data/app/components/solidstats/ui/stats_overview_component.html.erb +14 -0
- data/app/components/solidstats/ui/stats_overview_component.rb +78 -0
- data/app/components/solidstats/ui/status_badge_component.html.erb +6 -0
- data/app/components/solidstats/ui/status_badge_component.rb +42 -0
- data/app/components/solidstats/ui/summary_card_component.html.erb +12 -0
- data/app/components/solidstats/ui/summary_card_component.rb +63 -0
- data/app/components/solidstats/ui/tab_navigation_component.html.erb +22 -0
- data/app/components/solidstats/ui/tab_navigation_component.rb +79 -0
- data/app/controllers/solidstats/dashboard_controller.rb +22 -0
- data/app/controllers/solidstats/gem_metadata_controller.rb +12 -0
- data/app/helpers/solidstats/application_helper.rb +42 -0
- data/app/services/solidstats/gem_metadata/fetcher_service.rb +136 -0
- data/app/services/solidstats/log_size_monitor_service.rb +94 -0
- data/app/views/layouts/solidstats/application.html.erb +2 -1
- data/app/views/solidstats/dashboard/_log_monitor.html.erb +759 -0
- data/app/views/solidstats/dashboard/index.html.erb +67 -1323
- data/app/views/solidstats/gem_metadata/_panel.html.erb +419 -0
- data/config/routes.rb +7 -0
- data/lib/generators/solidstats/feature/feature_generator.rb +170 -0
- data/lib/generators/solidstats/feature/templates/component.html.erb +84 -0
- data/lib/generators/solidstats/feature/templates/component.rb.erb +103 -0
- data/lib/generators/solidstats/feature/templates/component.scss +243 -0
- data/lib/generators/solidstats/feature/templates/component_test.rb.erb +183 -0
- data/lib/generators/solidstats/feature/templates/controller.rb.erb +44 -0
- data/lib/generators/solidstats/feature/templates/controller_test.rb.erb +111 -0
- data/lib/generators/solidstats/feature/templates/detail_view.html.erb +755 -0
- data/lib/generators/solidstats/feature/templates/preview.rb.erb +107 -0
- data/lib/generators/solidstats/feature/templates/service.rb.erb +132 -0
- data/lib/generators/solidstats/feature/templates/service_test.rb.erb +109 -0
- data/lib/generators/solidstats/install_generator.rb +109 -0
- data/lib/generators/solidstats/templates/initializer.rb +112 -0
- data/lib/solidstats/asset_compatibility.rb +238 -0
- data/lib/solidstats/asset_manifest.rb +205 -0
- data/lib/solidstats/engine.rb +114 -9
- data/lib/solidstats/version.rb +1 -1
- data/lib/solidstats.rb +299 -2
- data/lib/tasks/solidstats_install.rake +122 -2
- metadata +99 -2
@@ -0,0 +1,107 @@
|
|
1
|
+
module Solidstats
|
2
|
+
module Previews
|
3
|
+
class <%= class_name %>ComponentPreview < ViewComponent::Preview
|
4
|
+
# Preview for dashboard summary component
|
5
|
+
# @label Summary View
|
6
|
+
def default
|
7
|
+
render Solidstats::<%= class_name %>Component.new(
|
8
|
+
data: sample_data
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Preview with warning status
|
13
|
+
# @label Warning State
|
14
|
+
def warning_state
|
15
|
+
render Solidstats::<%= class_name %>Component.new(
|
16
|
+
data: sample_data.merge(
|
17
|
+
status: :warning,
|
18
|
+
value: 75
|
19
|
+
)
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Preview with danger status
|
24
|
+
# @label Danger State
|
25
|
+
def danger_state
|
26
|
+
render Solidstats::<%= class_name %>Component.new(
|
27
|
+
data: sample_data.merge(
|
28
|
+
status: :danger,
|
29
|
+
value: 150
|
30
|
+
)
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Preview with error state
|
35
|
+
# @label Error State
|
36
|
+
def error_state
|
37
|
+
render Solidstats::<%= class_name %>Component.new(
|
38
|
+
data: {
|
39
|
+
value: 0,
|
40
|
+
count: 0,
|
41
|
+
items: [],
|
42
|
+
status: :error,
|
43
|
+
error: "Unable to collect data",
|
44
|
+
last_updated: 2.hours.ago
|
45
|
+
}
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Preview with no data
|
50
|
+
# @label Empty State
|
51
|
+
def empty_state
|
52
|
+
render Solidstats::<%= class_name %>Component.new(
|
53
|
+
data: {
|
54
|
+
value: 0,
|
55
|
+
count: 0,
|
56
|
+
items: [],
|
57
|
+
status: :ok,
|
58
|
+
last_updated: Time.current
|
59
|
+
}
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def sample_data
|
66
|
+
{
|
67
|
+
value: 42,
|
68
|
+
count: 8,
|
69
|
+
status: :ok,
|
70
|
+
last_updated: 30.minutes.ago,
|
71
|
+
items: [
|
72
|
+
{
|
73
|
+
name: "Sample Item 1",
|
74
|
+
value: 15,
|
75
|
+
category: "important",
|
76
|
+
description: "This is a sample item for preview"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
name: "Sample Item 2",
|
80
|
+
value: 8,
|
81
|
+
category: "normal",
|
82
|
+
description: "Another sample item"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
name: "Sample Item 3",
|
86
|
+
value: 12,
|
87
|
+
category: "important",
|
88
|
+
description: "Third sample item"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
name: "Sample Item 4",
|
92
|
+
value: 3,
|
93
|
+
category: "low",
|
94
|
+
description: "Fourth sample item"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
name: "Sample Item 5",
|
98
|
+
value: 7,
|
99
|
+
category: "normal",
|
100
|
+
description: "Fifth sample item"
|
101
|
+
}
|
102
|
+
]
|
103
|
+
}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
module Solidstats
|
2
|
+
class <%= class_name %>Service
|
3
|
+
CACHE_KEY = "solidstats_<%= file_name %>".freeze
|
4
|
+
CACHE_HOURS = <%= options[:cache_hours] %>
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@cache_file = Rails.root.join("tmp", "#{CACHE_KEY}.json")
|
8
|
+
end
|
9
|
+
|
10
|
+
# Fetch cached data or collect fresh data
|
11
|
+
def fetch(force_refresh = false)
|
12
|
+
if force_refresh || cache_expired?
|
13
|
+
data = collect_data
|
14
|
+
cache_data(data)
|
15
|
+
data
|
16
|
+
else
|
17
|
+
cached_data
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Get summary data for dashboard cards
|
22
|
+
def summary
|
23
|
+
data = fetch
|
24
|
+
{
|
25
|
+
value: calculate_summary_value(data),
|
26
|
+
status: determine_status(data),
|
27
|
+
last_updated: data[:last_updated] || Time.current,
|
28
|
+
count: data[:count] || 0
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Collect detailed data for full view
|
33
|
+
def detailed_data
|
34
|
+
fetch.merge(
|
35
|
+
breakdown: calculate_breakdown(fetch),
|
36
|
+
trends: calculate_trends(fetch)
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def collect_data
|
43
|
+
# TODO: Implement your data collection logic here
|
44
|
+
# This is where you'd gather metrics, run system commands,
|
45
|
+
# analyze files, or call external APIs
|
46
|
+
|
47
|
+
{
|
48
|
+
value: sample_value,
|
49
|
+
count: sample_count,
|
50
|
+
items: sample_items,
|
51
|
+
last_updated: Time.current,
|
52
|
+
status: :ok
|
53
|
+
}
|
54
|
+
rescue StandardError => e
|
55
|
+
Rails.logger.error "Error collecting <%= file_name %> data: #{e.message}"
|
56
|
+
{
|
57
|
+
value: 0,
|
58
|
+
count: 0,
|
59
|
+
items: [],
|
60
|
+
last_updated: Time.current,
|
61
|
+
status: :error,
|
62
|
+
error: e.message
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
def calculate_summary_value(data)
|
67
|
+
# TODO: Customize how the main metric is calculated
|
68
|
+
data[:value] || 0
|
69
|
+
end
|
70
|
+
|
71
|
+
def determine_status(data)
|
72
|
+
# TODO: Implement your status logic
|
73
|
+
# Return :ok, :warning, or :danger based on your metrics
|
74
|
+
|
75
|
+
return :error if data[:error]
|
76
|
+
return :ok if data[:value].to_i < 50
|
77
|
+
return :warning if data[:value].to_i < 100
|
78
|
+
:danger
|
79
|
+
end
|
80
|
+
|
81
|
+
def calculate_breakdown(data)
|
82
|
+
# TODO: Implement breakdown analysis for detailed view
|
83
|
+
data[:items]&.group_by { |item| item[:category] } || {}
|
84
|
+
end
|
85
|
+
|
86
|
+
def calculate_trends(data)
|
87
|
+
# TODO: Implement trend analysis
|
88
|
+
# This could compare with historical data
|
89
|
+
[]
|
90
|
+
end
|
91
|
+
|
92
|
+
# Sample data methods - replace with your actual logic
|
93
|
+
def sample_value
|
94
|
+
rand(1..100)
|
95
|
+
end
|
96
|
+
|
97
|
+
def sample_count
|
98
|
+
rand(1..20)
|
99
|
+
end
|
100
|
+
|
101
|
+
def sample_items
|
102
|
+
(1..sample_count).map do |i|
|
103
|
+
{
|
104
|
+
name: "Item #{i}",
|
105
|
+
value: rand(1..10),
|
106
|
+
category: ["category_a", "category_b", "category_c"].sample,
|
107
|
+
created_at: Time.current - rand(24).hours
|
108
|
+
}
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Cache management
|
113
|
+
def cache_expired?
|
114
|
+
return true unless @cache_file.exist?
|
115
|
+
|
116
|
+
File.mtime(@cache_file) < CACHE_HOURS.hours.ago
|
117
|
+
end
|
118
|
+
|
119
|
+
def cached_data
|
120
|
+
return {} unless @cache_file.exist?
|
121
|
+
|
122
|
+
JSON.parse(File.read(@cache_file)).deep_symbolize_keys
|
123
|
+
rescue JSON::ParserError
|
124
|
+
{}
|
125
|
+
end
|
126
|
+
|
127
|
+
def cache_data(data)
|
128
|
+
FileUtils.mkdir_p(@cache_file.dirname)
|
129
|
+
File.write(@cache_file, data.to_json)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
module Solidstats
|
4
|
+
class <%= class_name %>ServiceTest < ActiveSupport::TestCase
|
5
|
+
def setup
|
6
|
+
@service = <%= class_name %>Service.new
|
7
|
+
end
|
8
|
+
|
9
|
+
test "should initialize properly" do
|
10
|
+
assert_not_nil @service
|
11
|
+
end
|
12
|
+
|
13
|
+
test "should fetch data without errors" do
|
14
|
+
data = @service.fetch
|
15
|
+
|
16
|
+
assert_not_nil data
|
17
|
+
assert_kind_of Hash, data
|
18
|
+
assert data.key?(:value)
|
19
|
+
assert data.key?(:count)
|
20
|
+
assert data.key?(:items)
|
21
|
+
assert data.key?(:last_updated)
|
22
|
+
assert data.key?(:status)
|
23
|
+
end
|
24
|
+
|
25
|
+
test "should return summary data" do
|
26
|
+
summary = @service.summary
|
27
|
+
|
28
|
+
assert_not_nil summary
|
29
|
+
assert_kind_of Hash, summary
|
30
|
+
assert summary.key?(:value)
|
31
|
+
assert summary.key?(:status)
|
32
|
+
assert summary.key?(:last_updated)
|
33
|
+
assert summary.key?(:count)
|
34
|
+
end
|
35
|
+
|
36
|
+
test "should return detailed data" do
|
37
|
+
detailed = @service.detailed_data
|
38
|
+
|
39
|
+
assert_not_nil detailed
|
40
|
+
assert_kind_of Hash, detailed
|
41
|
+
assert detailed.key?(:value)
|
42
|
+
assert detailed.key?(:items)
|
43
|
+
assert detailed.key?(:breakdown)
|
44
|
+
assert detailed.key?(:trends)
|
45
|
+
end
|
46
|
+
|
47
|
+
test "should handle force refresh" do
|
48
|
+
# Test that force refresh bypasses cache
|
49
|
+
data1 = @service.fetch(false)
|
50
|
+
data2 = @service.fetch(true)
|
51
|
+
|
52
|
+
assert_not_nil data1
|
53
|
+
assert_not_nil data2
|
54
|
+
assert_kind_of Hash, data1
|
55
|
+
assert_kind_of Hash, data2
|
56
|
+
end
|
57
|
+
|
58
|
+
test "should determine status correctly" do
|
59
|
+
summary = @service.summary
|
60
|
+
|
61
|
+
assert_includes [:ok, :warning, :danger, :error], summary[:status]
|
62
|
+
end
|
63
|
+
|
64
|
+
test "should handle errors gracefully" do
|
65
|
+
# Mock an error condition
|
66
|
+
@service.stub(:collect_data, -> { raise StandardError.new("Test error") }) do
|
67
|
+
data = @service.fetch
|
68
|
+
|
69
|
+
assert_equal :error, data[:status]
|
70
|
+
assert_equal "Test error", data[:error]
|
71
|
+
assert_equal 0, data[:value]
|
72
|
+
assert_equal 0, data[:count]
|
73
|
+
assert_empty data[:items]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
test "should cache data properly" do
|
78
|
+
# Test caching behavior
|
79
|
+
first_fetch = @service.fetch
|
80
|
+
|
81
|
+
# Mock cache file existence
|
82
|
+
cache_file = @service.instance_variable_get(:@cache_file)
|
83
|
+
assert_not_nil cache_file
|
84
|
+
|
85
|
+
# Subsequent fetch should use cache if not expired
|
86
|
+
second_fetch = @service.fetch
|
87
|
+
assert_equal first_fetch[:last_updated], second_fetch[:last_updated]
|
88
|
+
end
|
89
|
+
|
90
|
+
test "should validate data structure" do
|
91
|
+
data = @service.fetch
|
92
|
+
|
93
|
+
# Validate required fields
|
94
|
+
assert_respond_to data[:value], :to_i
|
95
|
+
assert_respond_to data[:count], :to_i
|
96
|
+
assert_kind_of Array, data[:items]
|
97
|
+
assert_kind_of Time, data[:last_updated]
|
98
|
+
|
99
|
+
# Validate items structure if present
|
100
|
+
if data[:items].any?
|
101
|
+
data[:items].each do |item|
|
102
|
+
assert_kind_of Hash, item
|
103
|
+
assert item.key?(:name)
|
104
|
+
assert item.key?(:value)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/base"
|
4
|
+
|
5
|
+
module Solidstats
|
6
|
+
module Generators
|
7
|
+
class InstallGenerator < Rails::Generators::Base
|
8
|
+
desc "Install Solidstats in your Rails application"
|
9
|
+
|
10
|
+
source_root File.expand_path("templates", __dir__)
|
11
|
+
|
12
|
+
class_option :css_framework, type: :string, default: "none",
|
13
|
+
desc: "CSS framework integration (none, bootstrap, tailwind)"
|
14
|
+
class_option :skip_assets, type: :boolean, default: false,
|
15
|
+
desc: "Skip asset configuration"
|
16
|
+
class_option :skip_routes, type: :boolean, default: false,
|
17
|
+
desc: "Skip route mounting"
|
18
|
+
|
19
|
+
def check_environment
|
20
|
+
unless Rails.env.development?
|
21
|
+
say "ā ļø Warning: Solidstats is designed for development environments only.", :yellow
|
22
|
+
say "Current environment: #{Rails.env}", :yellow
|
23
|
+
|
24
|
+
unless yes? "Continue installation anyway? (y/n)"
|
25
|
+
say "Installation cancelled.", :red
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def check_dependencies
|
32
|
+
say "š Checking dependencies...", :green
|
33
|
+
|
34
|
+
# Check Rails version
|
35
|
+
rails_version = Rails::VERSION::STRING
|
36
|
+
if Gem::Version.new(rails_version) < Gem::Version.new("6.1.0")
|
37
|
+
say "ā Rails #{rails_version} is not supported. Minimum version: 6.1.0", :red
|
38
|
+
exit 1
|
39
|
+
end
|
40
|
+
say "ā
Rails #{rails_version} supported", :green
|
41
|
+
|
42
|
+
# Check ViewComponent
|
43
|
+
begin
|
44
|
+
require "view_component"
|
45
|
+
say "ā
ViewComponent #{ViewComponent::VERSION} detected", :green
|
46
|
+
rescue LoadError
|
47
|
+
say "ā ViewComponent not found. Please add it to your Gemfile:", :red
|
48
|
+
say "gem 'view_component'", :yellow
|
49
|
+
exit 1
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def mount_engine
|
54
|
+
return if options[:skip_routes]
|
55
|
+
|
56
|
+
say "š¤ļø Mounting Solidstats engine...", :green
|
57
|
+
|
58
|
+
route_content = " mount Solidstats::Engine => '/solidstats' if Rails.env.development?"
|
59
|
+
|
60
|
+
if File.read("config/routes.rb").include?("Solidstats::Engine")
|
61
|
+
say "ā ļø Solidstats engine already mounted in routes.rb", :yellow
|
62
|
+
else
|
63
|
+
route route_content
|
64
|
+
say "ā
Engine mounted at /solidstats (development only)", :green
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def configure_assets
|
69
|
+
say "š¦ Configuring assets...", :green
|
70
|
+
|
71
|
+
say " ā
Using inline asset delivery (no configuration needed)", :blue
|
72
|
+
say " š Assets are automatically included via helper methods", :blue
|
73
|
+
|
74
|
+
say "ā
Asset configuration complete", :green
|
75
|
+
end
|
76
|
+
|
77
|
+
def create_initializer
|
78
|
+
say "āļø Creating initializer...", :green
|
79
|
+
|
80
|
+
template "initializer.rb", "config/initializers/solidstats.rb"
|
81
|
+
say "ā
Created config/initializers/solidstats.rb", :green
|
82
|
+
end
|
83
|
+
|
84
|
+
def show_installation_complete
|
85
|
+
say "\nš Solidstats installation complete!", :green
|
86
|
+
say "ā" * 50, :green
|
87
|
+
|
88
|
+
say "\nš Next steps:", :cyan
|
89
|
+
say "1. Start your Rails server: rails server", :white
|
90
|
+
say "2. Visit: http://localhost:3000/solidstats", :white
|
91
|
+
say "3. Customize settings in config/initializers/solidstats.rb", :white
|
92
|
+
|
93
|
+
say "\nš” Asset Delivery:", :cyan
|
94
|
+
say " ⢠CSS and JavaScript are automatically inlined", :white
|
95
|
+
say " ⢠No asset pipeline configuration needed", :white
|
96
|
+
say " ⢠Works with any Rails asset setup", :white
|
97
|
+
|
98
|
+
say "\nš Documentation: https://github.com/your-org/solidstats", :cyan
|
99
|
+
say "ā" * 50, :green
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def css_framework_integration_available?
|
105
|
+
%w[bootstrap tailwind].include?(options[:css_framework])
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -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
|