solidstats 1.1.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 +68 -0
- data/README.md +33 -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 +8 -5
- 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 +10 -10
- data/app/views/layouts/solidstats/application.html.erb +2 -1
- data/app/views/solidstats/dashboard/index.html.erb +67 -1337
- data/app/views/solidstats/gem_metadata/_panel.html.erb +419 -0
- data/config/routes.rb +5 -2
- 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 +97 -2
@@ -0,0 +1,111 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
module Solidstats
|
4
|
+
class <%= class_name %>ControllerTest < ActionDispatch::IntegrationTest
|
5
|
+
include Engine.routes.url_helpers
|
6
|
+
|
7
|
+
def setup
|
8
|
+
# Ensure we're in development mode for tests
|
9
|
+
Rails.env.stub(:development?, true) do
|
10
|
+
@service = <%= class_name %>Service.new
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
test "should get index in development" do
|
15
|
+
Rails.env.stub(:development?, true) do
|
16
|
+
get <%= file_name %>_path
|
17
|
+
assert_response :success
|
18
|
+
assert_template :index
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
test "should not get index in production" do
|
23
|
+
Rails.env.stub(:development?, false) do
|
24
|
+
get <%= file_name %>_path
|
25
|
+
assert_response :not_found
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
test "should get index as json" do
|
30
|
+
Rails.env.stub(:development?, true) do
|
31
|
+
get <%= file_name %>_path, as: :json
|
32
|
+
assert_response :success
|
33
|
+
assert_match "application/json", response.content_type
|
34
|
+
|
35
|
+
json_response = JSON.parse(response.body)
|
36
|
+
assert json_response.key?("value")
|
37
|
+
assert json_response.key?("items")
|
38
|
+
assert json_response.key?("breakdown")
|
39
|
+
assert json_response.key?("trends")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
test "should refresh data" do
|
44
|
+
Rails.env.stub(:development?, true) do
|
45
|
+
post refresh_<%= file_name %>_path if respond_to?(:refresh_<%= file_name %>_path)
|
46
|
+
|
47
|
+
# If refresh route doesn't exist, test the service directly
|
48
|
+
data = @service.fetch(true)
|
49
|
+
assert_not_nil data
|
50
|
+
assert data.key?(:value)
|
51
|
+
assert data.key?(:last_updated)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
test "should get summary as json" do
|
56
|
+
Rails.env.stub(:development?, true) do
|
57
|
+
get summary_<%= file_name %>_path if respond_to?(:summary_<%= file_name %>_path)
|
58
|
+
|
59
|
+
# If summary route doesn't exist, test the service directly
|
60
|
+
summary = @service.summary
|
61
|
+
assert_not_nil summary
|
62
|
+
assert summary.key?(:value)
|
63
|
+
assert summary.key?(:status)
|
64
|
+
assert summary.key?(:last_updated)
|
65
|
+
assert summary.key?(:count)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
test "should assign service data to view" do
|
70
|
+
Rails.env.stub(:development?, true) do
|
71
|
+
get <%= file_name %>_path
|
72
|
+
assert_response :success
|
73
|
+
assert_not_nil assigns(:data)
|
74
|
+
assert_kind_of Hash, assigns(:data)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
test "should handle service errors gracefully" do
|
79
|
+
Rails.env.stub(:development?, true) do
|
80
|
+
# Mock service to raise an error
|
81
|
+
<%= class_name %>Service.any_instance.stub(:detailed_data, -> { raise StandardError.new("Test error") }) do
|
82
|
+
assert_raises StandardError do
|
83
|
+
get <%= file_name %>_path
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
test "should validate required instance variables" do
|
90
|
+
Rails.env.stub(:development?, true) do
|
91
|
+
get <%= file_name %>_path
|
92
|
+
assert_response :success
|
93
|
+
|
94
|
+
# Check that controller sets up required data
|
95
|
+
assert_not_nil assigns(:data)
|
96
|
+
assert assigns(:data).key?(:value)
|
97
|
+
assert assigns(:data).key?(:items)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
test "should have proper security headers" do
|
102
|
+
Rails.env.stub(:development?, true) do
|
103
|
+
get <%= file_name %>_path
|
104
|
+
assert_response :success
|
105
|
+
|
106
|
+
# Verify development-only access is enforced
|
107
|
+
assert_not_nil response.headers
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|