mirror of
https://github.com/discourse/discourse.git
synced 2025-09-04 08:47:37 +08:00
DEV: Update script/promote_migrations (#13513)
Introduces the --plugins-base flag for updating plugins in a different directory. Followup to 49f39434c4
This commit is contained in:
parent
cf1e8b2764
commit
20070f5089
1 changed files with 14 additions and 3 deletions
|
@ -14,8 +14,19 @@ require 'open3'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
|
|
||||||
VERSION_REGEX = %r{\/(\d+)_}
|
VERSION_REGEX = %r{\/(\d+)_}
|
||||||
DRY_RUN = ARGV.include? '--dry-run'
|
|
||||||
PLUGINS = ARGV.include? '--plugins'
|
DRY_RUN = !!ARGV.delete('--dry-run')
|
||||||
|
|
||||||
|
if i = ARGV.find_index('--plugins-base')
|
||||||
|
ARGV.delete_at(i)
|
||||||
|
PLUGINS = true
|
||||||
|
PLUGINS_BASE = ARGV.delete_at(i)
|
||||||
|
elsif ARV.delete('--plugins')
|
||||||
|
PLUGINS = true
|
||||||
|
PLUGINS_BASE = 'plugins'
|
||||||
|
end
|
||||||
|
|
||||||
|
raise "Unknown arguments: #{ARGV.join(', ')}" if ARGV.length > 0
|
||||||
|
|
||||||
def run(*args, capture: true)
|
def run(*args, capture: true)
|
||||||
out, s = Open3.capture2(*args)
|
out, s = Open3.capture2(*args)
|
||||||
|
@ -60,7 +71,7 @@ promote_threshold = latest_stable_post_migration[VERSION_REGEX, 1].to_i
|
||||||
current_post_migrations =
|
current_post_migrations =
|
||||||
if PLUGINS
|
if PLUGINS
|
||||||
puts 'Looking in plugins...'
|
puts 'Looking in plugins...'
|
||||||
Dir.glob('plugins/*/db/post_migrate/*')
|
Dir.glob("#{PLUGINS_BASE}/**/db/post_migrate/*")
|
||||||
else
|
else
|
||||||
Dir.glob('db/post_migrate/*')
|
Dir.glob('db/post_migrate/*')
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue