FEATURE: rake plugin:install_all_official

use this task to quickly install all official plugins
GIT_WRITE=1 to enable write access to repos (discourse staff only)
This commit is contained in:
Sam 2017-07-18 12:09:27 -04:00
parent 38daa61fc7
commit b92e181390
2 changed files with 49 additions and 1 deletions

View File

@ -25,7 +25,13 @@ class Plugin::Metadata
"poll",
"discourse-plugin-linkedin-auth",
"discourse-plugin-office365-auth",
"discourse-oauth2-basic"
"discourse-oauth2-basic",
"discourse-math",
"discourse-bbcode-color",
"discourse-bbcode",
"discourse-affiliate",
"discourse-translator",
"discourse-patreon"
])
FIELDS ||= [:name, :about, :version, :authors, :url, :required_version]

View File

@ -1,5 +1,47 @@
directory 'plugins'
desc 'install all official plugins'
task 'plugin:install_all_official' do
skip = Set.new([
'customer-flair',
'discourse-nginx-performance-report',
'hosted-site',
'lazyYT',
'poll',
])
map = {
'Canned Replies' => 'https://github.com/discourse/discourse-canned-replies',
'Spoiler Alert!' => 'https://github.com/discourse/discourse-spoiler-alert',
'staff-notes' => 'https://github.com/discourse/discourse-staff-notes',
'GitHub badges' => 'https://github.com/discourse/github_badges',
}
#require 'plugin/metadata'
Plugin::Metadata::OFFICIAL_PLUGINS.each do |name|
next if skip.include? name
repo = map[name] || "https://github.com/discourse/#{name}"
dir = repo.split('/').last
path = File.expand_path('plugins/' + dir)
if Dir.exist? path
STDERR.puts "Skipping #{dir} cause it already exists!"
next
end
if ENV['GIT_WRITE']
STDERR.puts "Allowing write to all repos!"
repo.gsub!("https://github.com/", "git@github.com:")
repo << ".git"
end
status = system("git clone #{repo} #{path}")
unless status
abort("Failed to clone #{repo}")
end
end
end
desc 'install plugin'
task 'plugin:install', :repo do |t, args|
repo = ENV['REPO'] || ENV['repo'] || args[:repo]