mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
DEV: support installing plugin gems in test images
- adds plugin:install_all_gems rake task - adds UPDATE_ALL_PLUGINS env variable in docker:test
This commit is contained in:
@ -117,6 +117,10 @@ task 'docker:test' do
|
|||||||
@good &&= run_or_fail("bundle exec rake plugin:install_all_official")
|
@good &&= run_or_fail("bundle exec rake plugin:install_all_official")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ENV["UPDATE_ALL_PLUGINS"]
|
||||||
|
@good &&= run_or_fail("bundle exec rake plugin:update_all")
|
||||||
|
end
|
||||||
|
|
||||||
if ENV["SKIP_PLUGINS"]
|
if ENV["SKIP_PLUGINS"]
|
||||||
@good &&= run_or_fail("bundle exec rake db:migrate")
|
@good &&= run_or_fail("bundle exec rake db:migrate")
|
||||||
else
|
else
|
||||||
|
@ -87,6 +87,30 @@ task 'plugin:update', :plugin do |t, args|
|
|||||||
abort('Unable to pull latest version of plugin') unless update_status
|
abort('Unable to pull latest version of plugin') unless update_status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'install all plugin gems'
|
||||||
|
task 'plugin:install_all_gems' do |t|
|
||||||
|
plugins = Dir.glob(File.expand_path('plugins/*')).select { |f| File.directory? f }
|
||||||
|
plugins.each do |plugin|
|
||||||
|
Rake::Task['plugin:install_gems'].invoke(plugin)
|
||||||
|
Rake::Task['plugin:install_gems'].reenable
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'install plugin gems'
|
||||||
|
task 'plugin:install_gems', :plugin do |t, args|
|
||||||
|
plugin = ENV['PLUGIN'] || ENV['plugin'] || args[:plugin]
|
||||||
|
plugin_path = plugin + "/plugin.rb"
|
||||||
|
|
||||||
|
if File.file?(plugin_path)
|
||||||
|
File.open(plugin_path).each do |l|
|
||||||
|
next if !l.start_with? "gem"
|
||||||
|
next unless /gem\s['"](.*)['"],\s['"](.*)['"]/.match(l)
|
||||||
|
puts "gem install #{$1} -v #{$2} -i #{plugin}/gems/#{RUBY_VERSION} --no-document --ignore-dependencies --no-user-install"
|
||||||
|
system("gem install #{$1} -v #{$2} -i #{plugin}/gems/#{RUBY_VERSION} --no-document --ignore-dependencies --no-user-install")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
desc 'run plugin specs'
|
desc 'run plugin specs'
|
||||||
task 'plugin:spec', :plugin do |t, args|
|
task 'plugin:spec', :plugin do |t, args|
|
||||||
args.with_defaults(plugin: "*")
|
args.with_defaults(plugin: "*")
|
||||||
|
Reference in New Issue
Block a user