Class: Appydave::Tools::Dam::SsdStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/appydave/tools/dam/ssd_status.rb

Overview

Show SSD mount status for all brands

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(brands_config: nil) ⇒ SsdStatus

Returns a new instance of SsdStatus.



10
11
12
13
14
15
16
17
# File 'lib/appydave/tools/dam/ssd_status.rb', line 10

def initialize(brands_config: nil)
  if brands_config
    @brands_config = brands_config
  else
    Appydave::Tools::Configuration::Config.configure
    @brands_config = Appydave::Tools::Configuration::Config.brands
  end
end

Instance Attribute Details

#brands_configObject (readonly)

Returns the value of attribute brands_config.



8
9
10
# File 'lib/appydave/tools/dam/ssd_status.rb', line 8

def brands_config
  @brands_config
end

Instance Method Details

#show(brand_key) ⇒ Object

Show SSD status for a specific brand



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/appydave/tools/dam/ssd_status.rb', line 53

def show(brand_key)
  brand_info = @brands_config.get_brand(brand_key)
  ssd_path = brand_info.locations.ssd_backup

  puts "💾 SSD Status: #{brand_info.name} (#{brand_info.key})"
  puts ''

  if ssd_path.nil? || ssd_path.empty? || ssd_path == 'NOT-SET'
    puts '⚠️  SSD backup not configured for this brand'
    puts ''
    puts 'To configure, add ssd_backup to brands.json:'
    puts ''
    puts '  "locations": {'
    puts '    "video_projects": "/path/to/projects",'
    puts '    "ssd_backup": "/Volumes/T7/youtube-PUBLISHED/appydave"'
    puts '  }'
    return
  end

  puts "Path: #{ssd_path}"
  puts ''

  if Dir.exist?(ssd_path)
    display_mounted_details(brand_info, ssd_path)
  else
    display_unmounted_details(ssd_path)
  end
end

#show_allObject

Show SSD status for all brands



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/appydave/tools/dam/ssd_status.rb', line 20

def show_all
  results = collect_brand_statuses

  # Identify unique volumes
  volumes = results.select { |r| r[:configured] }
                   .map { |r| extract_volume_name(r[:ssd_path]) }
                   .compact
                   .uniq

  if volumes.empty?
    puts '⚠️  No SSD volumes configured'
    return
  end

  # Show simple mount status for each volume
  volumes.each do |volume|
    volume_path = "/Volumes/#{volume}"
    if Dir.exist?(volume_path)
      puts "#{volume} is MOUNTED"
    else
      puts "#{volume} is NOT MOUNTED"
    end
  end

  puts ''
  puts '| Brand          | Path                                   | Status       |'
  puts '|----------------|----------------------------------------|--------------|'
  results.each do |result|
    display_brand_row(result)
  end
end