Class: Appydave::Tools::Dam::RepoSync
- Inherits:
-
Object
- Object
- Appydave::Tools::Dam::RepoSync
- Defined in:
- lib/appydave/tools/dam/repo_sync.rb
Overview
Sync (git pull) brand repositories
Instance Attribute Summary collapse
-
#brand ⇒ Object
readonly
Returns the value of attribute brand.
-
#brand_info ⇒ Object
readonly
Returns the value of attribute brand_info.
-
#brand_path ⇒ Object
readonly
Returns the value of attribute brand_path.
Instance Method Summary collapse
-
#initialize(brand = nil) ⇒ RepoSync
constructor
A new instance of RepoSync.
-
#sync ⇒ Object
Sync single brand.
-
#sync_all ⇒ Object
Sync all brands.
Constructor Details
#initialize(brand = nil) ⇒ RepoSync
10 11 12 13 14 15 16 |
# File 'lib/appydave/tools/dam/repo_sync.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
#brand ⇒ Object (readonly)
Returns the value of attribute brand.
8 9 10 |
# File 'lib/appydave/tools/dam/repo_sync.rb', line 8 def brand @brand end |
#brand_info ⇒ Object (readonly)
Returns the value of attribute brand_info.
8 9 10 |
# File 'lib/appydave/tools/dam/repo_sync.rb', line 8 def brand_info @brand_info end |
#brand_path ⇒ Object (readonly)
Returns the value of attribute brand_path.
8 9 10 |
# File 'lib/appydave/tools/dam/repo_sync.rb', line 8 def brand_path @brand_path end |
Instance Method Details
#sync ⇒ Object
Sync single brand
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/appydave/tools/dam/repo_sync.rb', line 19 def sync puts "🔄 Syncing: v-#{brand}" puts '' unless git_repo? puts "❌ Not a git repository: #{brand_path}" return end perform_sync end |
#sync_all ⇒ Object
Sync all brands
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/appydave/tools/dam/repo_sync.rb', line 32 def sync_all puts '🔄 Syncing All Brands' puts '' Appydave::Tools::Configuration::Config.configure brands_config = Appydave::Tools::Configuration::Config.brands results = [] 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}" result = perform_sync(indent: ' ') results << result puts '' end show_summary(results) end |