Class: Appydave::Tools::Dam::RepoPush

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

Overview

Push brand repository changes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(brand, project_id = nil) ⇒ RepoPush

Returns a new instance of RepoPush.



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

def initialize(brand, project_id = nil)
  @brand_info = load_brand_info(brand)
  @brand = @brand_info.key
  @brand_path = Config.brand_path(@brand)
  @project_id = project_id
end

Instance Attribute Details

#brandObject (readonly)

Returns the value of attribute brand.



8
9
10
# File 'lib/appydave/tools/dam/repo_push.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_push.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_push.rb', line 8

def brand_path
  @brand_path
end

#project_idObject (readonly)

Returns the value of attribute project_id.



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

def project_id
  @project_id
end

Instance Method Details

#pushObject

Push changes



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

def push
  puts "📤 Pushing: v-#{brand}"
  puts ''

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

  # If project specified, validate it exists in manifest
  validate_project if project_id

  perform_push
end