2023-09-21 16:02:15 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Renombrar todos los repositorios que apunten a skel como su origin
|
|
|
|
class SiteRenameOriginToUpstream < ActiveRecord::Migration[6.1]
|
|
|
|
# Renombrar
|
|
|
|
def up
|
|
|
|
Site.find_each do |site|
|
|
|
|
next unless site.repository.origin&.url == ENV['SKEL_SUTTY']
|
|
|
|
|
|
|
|
site.repository.rugged.remotes.rename('origin', 'upstream')
|
2023-09-21 16:04:25 +00:00
|
|
|
Rails.logger.info "#{site.name}: renamed origin to upstream"
|
2023-09-21 16:02:15 +00:00
|
|
|
rescue Rugged::Error => e
|
|
|
|
Rails.logger.warn "#{site.name}: #{e.message}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# No se puede deshacer
|
|
|
|
def down; end
|
|
|
|
end
|