Class: Harbinger::Analyzers::RedisDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/harbinger/analyzers/redis_detector.rb

Overview

Detects Redis version from projects

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_path) ⇒ RedisDetector

Returns a new instance of RedisDetector.



11
12
13
# File 'lib/harbinger/analyzers/redis_detector.rb', line 11

def initialize(project_path)
  @project_path = project_path
end

Instance Attribute Details

#project_pathObject (readonly)

Returns the value of attribute project_path.



9
10
11
# File 'lib/harbinger/analyzers/redis_detector.rb', line 9

def project_path
  @project_path
end

Instance Method Details

#detectObject

Main detection method - returns version string or nil



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/harbinger/analyzers/redis_detector.rb', line 16

def detect
  return nil unless redis_detected?

  # Try docker-compose.yml first
  version = detect_from_docker_compose
  return version if version

  # Try shell command
  version = detect_from_shell
  return version if version

  # Fallback to gem version
  detect_from_gemfile_lock
end

#redis_detected?Boolean

Check if Redis is used in this project

Returns:

  • (Boolean)


32
33
34
# File 'lib/harbinger/analyzers/redis_detector.rb', line 32

def redis_detected?
  gemfile_has_redis? || docker_compose_has_redis?
end