Class: QueryGuard::CLI::SourceMetadataCollector
- Inherits:
-
Object
- Object
- QueryGuard::CLI::SourceMetadataCollector
- Defined in:
- lib/query_guard/cli/source_metadata_collector.rb
Overview
Collects source and CI environment metadata for SaaS dashboards and PR views.
Captures:
- Git information (SHA, branch, repository name)
- CI provider detection (GitHub Actions, CircleCI, Jenkins, etc.)
- Pull request information when available
- Graceful fallbacks for local development
Design:
- Modular detection for each CI provider
- Fails gracefully (returns what's available)
- No external dependencies (pure stdlib)
- Suitable for SaaS platform ingestion
Example:
collector = QueryGuard::CLI::SourceMetadataCollector.new
= collector.collect
# => { git: { sha: '...' }, ci: { provider: 'github_actions', ... } }
Instance Method Summary collapse
-
#collect ⇒ Object
Collect all available source and CI metadata Returns: Hash with git and ci information.
-
#initialize ⇒ SourceMetadataCollector
constructor
A new instance of SourceMetadataCollector.
Constructor Details
#initialize ⇒ SourceMetadataCollector
Returns a new instance of SourceMetadataCollector.
24 25 26 |
# File 'lib/query_guard/cli/source_metadata_collector.rb', line 24 def initialize @env = ENV.to_h end |
Instance Method Details
#collect ⇒ Object
Collect all available source and CI metadata Returns: Hash with git and ci information
30 31 32 33 34 35 |
# File 'lib/query_guard/cli/source_metadata_collector.rb', line 30 def collect { git: , ci: }.compact end |