Class: Appydave::Tools::Dam::RepoStatus

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

Overview

Show git status for brand repositories

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(brand = nil) ⇒ RepoStatus

Returns a new instance of RepoStatus.



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

def initialize(brand = nil)
  return unless brand

  @brand_info = load_brand_info(brand)
  @brand = @brand_info.key
  @brand_path = Config.brand_path(@brand)
end

Instance Attribute Details

#brandObject (readonly)

Returns the value of attribute brand.



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

def brand
  @brand
end

#brand_infoObject (readonly)

Returns the value of attribute brand_info.



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

def brand_info
  @brand_info
end

#brand_pathObject (readonly)

Returns the value of attribute brand_path.



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

def brand_path
  @brand_path
end

Instance Method Details

#showObject

Show status for single brand



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/appydave/tools/dam/repo_status.rb', line 19

def show
  puts "🔍 Git Status: v-#{brand}"
  puts ''

  unless git_repo?
    puts "❌ Not a git repository: #{brand_path}"
    return
  end

  show_git_info
end

#show_allObject

Show status for all brands



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/appydave/tools/dam/repo_status.rb', line 32

def show_all
  puts '🔍 Git Status - All Brands'
  puts ''

  Appydave::Tools::Configuration::Config.configure
  brands_config = Appydave::Tools::Configuration::Config.brands

  brands_config.brands.each do |brand_info|
    @brand_info = brand_info
    @brand = brand_info.key
    @brand_path = Config.brand_path(@brand)

    next unless git_repo?

    puts "📦 v-#{brand}"
    show_git_info(indent: '  ')
    puts ''
  end
end