discourse.plugins: Update all plugins to their latest versions

Also, add support for updating plugins which keep gem versions in
files at the root of the repo (discourse-prometheus) and replace the
`up-plugin.sh` script with a README file pointing to the plugin
packaging documentation.
This commit is contained in:
talyz 2021-11-26 14:59:09 +01:00
parent e2415dbb8f
commit ab042d6452
No known key found for this signature in database
GPG key ID: 2DED2151F4671A2B
27 changed files with 63 additions and 87 deletions

View file

@ -297,7 +297,7 @@ services.discourse = {
the script:
<programlisting language="bash">
./update.py update-plugins
</programlisting>.
</programlisting>
</para>
<para>

View file

@ -0,0 +1,4 @@
Run the nixpkgs/pkgs/servers/web-apps/discourse/update.py script to
update plugins! See the Plugins section of the Discourse chapter in
the NixOS manual (https://nixos.org/manual/nixos/unstable/index.html#module-services-discourse)
for more info.

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-assign";
rev = "5124ba0f67e26a075f0a0fc8993273f1211d1c28";
sha256 = "1zd2irp5siza0vd5rlwzmjfvcdfw785988jc526xc741flazk1lr";
rev = "91d0712b0440b6bb0c2fedbf6c31191cdeb991fe";
sha256 = "sha256-ATWLu0vJZFquRcAUpFKaU8mqjjVOv3PziAsHR3aemWk=";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-docs";

View file

@ -8,14 +8,14 @@ GEM
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
concurrent-ruby (1.1.9)
i18n (1.8.10)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
minitest (5.14.4)
rrule (0.4.2)
activesupport (>= 4.1)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
zeitwerk (2.4.2)
zeitwerk (2.5.1)
PLATFORMS
ruby

View file

@ -6,8 +6,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-calendar";
rev = "2f76cdd3064735d484be1df77f43100aca21aea6";
sha256 = "1skpc8p5br1jkii1rksha1q95ias6xxyvi5bnli3q41w7fz1h5j2";
rev = "fbc617a5fa9f3a22bcc72bc2b32ea3cbdf6087c5";
sha256 = "sha256-qBtq8IvxdKYIFNL9DwdRqZceMMO/qgd6jTr3kk3so3Y=";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-calendar";

View file

@ -26,10 +26,10 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0g2fnag935zn2ggm5cn6k4s4xvv53v2givj1j90szmvavlpya96a";
sha256 = "0vdd1kii40qhbr9n8qx71k2gskq6rkl8ygy8hw5hfj8bb5a364xf";
type = "gem";
};
version = "1.8.10";
version = "1.8.11";
};
minitest = {
groups = ["default"];
@ -68,9 +68,9 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1746czsjarixq0x05f7p3hpzi38ldg6wxnxxw74kbjzh1sdjgmpl";
sha256 = "18l4r6layck0d80ydc692mv1lxak5xbf6w2paj1x7m2ggbggzxgj";
type = "gem";
};
version = "2.4.2";
version = "2.5.1";
};
}

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-chat-integration";
rev = "8ade892b387f0ce843d5e78ef4a271b0d35847ff";
sha256 = "1qn1bm09i9gzmh74ws32zgc89hrqzyhmh63qvmv0h00r52rmgxvx";
rev = "ae0389ca89f26401a6c4cffaaae6adcf14af0e15";
sha256 = "sha256-wT9S2mMz2MOpWpYv/FrHYhZibStRIGC4P2Vrqs04bkA=";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-chat-integration";

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-checklist";
rev = "48855d81b7c3a3274f7f78a64312125c344d92d1";
sha256 = "0139v5wpyglfzvd07ka6gic1ssfysisgfiq09dsbjy519gnc9kjw";
rev = "d8012abd3d6dccb72eec83e6a96ef4809dcad681";
sha256 = "1ngjql65939c571gyaqj8ydcxy5kkril2qlkxqf579vvwzpvxw13";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-checklist";

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-data-explorer";
rev = "23287ece952cb45203819e7b470ebc194c58cb13";
sha256 = "1vc2072r72fkvcfpy6vpn9x4gl9lpjk29pnj8095xs22im8j5in1";
rev = "3ce778ec6d96a300a06ffe0581f4681fbed8df7f";
sha256 = "1555k1anrijfbm0qfraby3ivh6h76177d541nxhnarj85mjx0hjb";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-data-explorer";

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-docs";
rev = "72cdd8d415ae3f797c0d5e2c857370714a42c54a";
sha256 = "07hvw8lpg8873vhwh8rrbml3s5hq606b7sw93r2xv38gxfhmx5lq";
rev = "d3eee7008b7a703774331808e302e36f2f8b4eae";
sha256 = "1p3aqfpv207pvlbis43znwgw56yqsn41320yaw1gdcaakf5s2rsx";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-docs";

View file

@ -6,8 +6,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-github";
rev = "9aaf4350968fb758f9bff3588f78e3ad24ddb4b0";
sha256 = "0nmpkh1rr0jv68a655f5610v2mn09xriiqv049a0gklap2lgv7p8";
rev = "8cd8c0703991c16cb2fa8cb1fd22a9c3849c7ae2";
sha256 = "17ga31a10sm3fqjpf40mz7fk62vynyng2a243pia9fjdq9py8slx";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-github";

View file

@ -2,6 +2,9 @@
source "https://rubygems.org"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
gem 'pyu-ruby-sasl', '0.0.3.3', require: false
gem 'rubyntlm', '0.3.4', require: false
gem 'net-ldap', '0.14.0'

View file

@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
hashie (4.1.0)
hashie (5.0.0)
net-ldap (0.14.0)
omniauth (1.9.1)
hashie (>= 3.4.6)
@ -16,7 +16,7 @@ GEM
rubyntlm (0.3.4)
PLATFORMS
x86_64-linux
ruby
DEPENDENCIES
net-ldap (= 0.14.0)
@ -25,4 +25,4 @@ DEPENDENCIES
rubyntlm (= 0.3.4)
BUNDLED WITH
2.2.20
2.2.24

View file

@ -6,8 +6,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "jonmbake";
repo = "discourse-ldap-auth";
rev = "eca02c560f2f2bf42feeb1923bc17e074f16b891";
sha256 = "sha256-HLNoDvvxkBMvqP6WbRrJY0CYnK92W77nzSpuwgl0VPA=";
rev = "1c10221836393c3cfac470a7b08de6f31150c802";
sha256 = "sha256-IiAl3OTADXSUnL+OKKHJY9Xqd4zCNJ2wOrgTN3nm5Yw=";
};
meta = with lib; {
homepage = "https://github.com/jonmbake/discourse-ldap-auth";

View file

@ -4,10 +4,10 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "02bsx12ihl78x0vdm37byp78jjw2ff6035y7rrmbd90qxjwxr43q";
sha256 = "1nh3arcrbz1rc1cr59qm53sdhqm137b258y8rcb4cvd3y98lwv4x";
type = "gem";
};
version = "4.1.0";
version = "5.0.0";
};
net-ldap = {
groups = ["default"];

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-math";
rev = "d7d0180352dd5a7dcb76c0817bfbb08c2a0f08c7";
sha256 = "0y72impvnq965ibbfc9877hr78fxkrwav1xmgyy3r9w87952vcwa";
rev = "cacbd04bb239db3c772ff5a37c19fe39d127ff3d";
sha256 = "1bhs7wslb4rdf2b6h6klw1mpjf9pjpfpf2zg2mj8vg0acyaqvv9d";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-math";

View file

@ -6,8 +6,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-openid-connect";
rev = "615038bd65f4fbe4dfdf8444b2f5eb06986b80b8";
sha256 = "n8feZkP80iNc+BzTPyKD7kEgFSIkk091eJYuqonN/NU=";
rev = "0e1511fcec2bbb26ef08e453920e955d4140df42";
sha256 = "02knx3z0ycz83cdarld2hmmpl6f9nkd2snp0qsbk9mjvbfvpfkni";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-openid-connect";

View file

@ -2,7 +2,7 @@
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
gem 'prometheus_exporter', '0.5.0'
gem 'prometheus_exporter', File.read(File.expand_path("../prometheus_exporter_version", __FILE__)).strip

View file

@ -10,4 +10,4 @@ DEPENDENCIES
prometheus_exporter (= 0.5.0)
BUNDLED WITH
2.1.4
2.2.24

View file

@ -6,8 +6,8 @@
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-prometheus";
rev = "46260710e8770344af438f86b47409d864a1c499";
sha256 = "0nmpi0nysp59x4hyn1c3niypvxw1jkz86acb6m8acacw0c6682k2";
rev = "08138ae4f89da76dd577781a2116b2ab66f8f547";
sha256 = "1x4awgx9fj0a6drsix3mi39ynj56rca3km0fz2xb3g6vxgc7d2z1";
};
patches = [

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-solved";
rev = "55cb184f7ef2954326561cc44fc8134798b8a9e0";
sha256 = "0pv5i216zn0v8xfwlndvhvr06vkmxaynj8xjfnc5amy1sp6k76w7";
rev = "40277e50d43e4bdaab99efab44f59f6e33d74740";
sha256 = "02n266swdslws8r26xf99l3ghpqd3dryd0qfp7kiqk3ksy8hh5n2";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-solved";

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-spoiler-alert";
rev = "0b93227ea8e2c72afe72029382081ebff89c3638";
sha256 = "0x0dxb41ss15sv5ph7z7q55ayf8a7r22bgkmr17924mny5440b5a";
rev = "790380d9d321f9368c7a16d8ed87718fc6047bf2";
sha256 = "079w4x2wlbsx164wv0zb373r8552wb5fvrb9pqzmrfvy0ybwf328";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-spoiler-alert";

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-voting";
rev = "fc4d23174eba1a57ddcba93eaf4a4e75d469d4a4";
sha256 = "07mj667qn387kaafg475f36pgnannsrb2bdqi0zj487av43252qb";
rev = "36a41c2969c1ddfd8980e3f766b730b849726a08";
sha256 = "0ns2i8liwpd29kbn44wzx9yb0jfpyz70h0hmrs71hz6fdalzm4ph";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-voting";

View file

@ -5,8 +5,8 @@ mkDiscoursePlugin {
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse-yearly-review";
rev = "cb040562f6af3163d70e8932867b530c6640ab9a";
sha256 = "07h6nq4bafs27ly2f5chkn5vb1wdy909qffwkgp5k1fanhbqvhvs";
rev = "683327574ea1a67c9c4182c887d6ba85171ca02b";
sha256 = "0y0hvb2ir9254ilpf7mnbn9xvv9anyqj4qwh97cw7jly7n2mga4m";
};
meta = with lib; {
homepage = "https://github.com/discourse/discourse-yearly-review";

View file

@ -1,39 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash curl ruby.devEnv git sqlite libpcap postgresql libxml2 libxslt pkg-config bundix gnumake
# src https://nixos.wiki/wiki/Packaging/Ruby
# This script should be ran afte rupdating a plugin that has a gemset.nix
# Usage: ./up-plugin.sh <plugin-id>
# NOTE: Script must be ran directly as ./up-plugin, otherwise the nix-shell won't work
set -exuo pipefail
PLUGIN="$1"
SELF="$(dirname "$(readlink -f "$0")")"
PL_DIR="$SELF/$PLUGIN"
TOP="$SELF/../../../../.."
TMP=$(mktemp -d)
pushd "$TMP"
if cat "$PL_DIR/default.nix" | grep gemdir >/dev/null; then
nix-build -A discourse.plugins.$PLUGIN.src "$TOP"
if [ -e result/Gemfile ]; then
cp result/Gemfile Gemfile
if [ -e result/Gemfile.lock ]; then
cp result/Gemfile.lock Gemfile.lock
fi
else
echo '# frozen_string_literal: true
source "https://rubygems.org"' > Gemfile
cat result/plugin.rb | grep "^gem" >> Gemfile
fi
if [ ! -e Gemfile.lock ]; then
bundle install
fi
bundix
cp Gemfile Gemfile.lock gemset.nix "$PL_DIR"
fi

View file

@ -212,9 +212,8 @@ def update_plugins():
{'name': 'discourse-ldap-auth', 'owner': 'jonmbake'},
{'name': 'discourse-math'},
{'name': 'discourse-migratepassword', 'owner': 'discoursehosting'},
# We can't update this automatically at the moment because the plugin.rb
# tries to load a version number which breaks bundler called by this script.
# {'name': 'discourse-prometheus'},
{'name': 'discourse-prometheus'},
{'name': 'discourse-openid-connect'},
{'name': 'discourse-saved-searches'},
{'name': 'discourse-solved'},
{'name': 'discourse-spoiler-alert'},
@ -302,11 +301,19 @@ def update_plugins():
rubyenv_dir = Path(filename).parent
gemfile = rubyenv_dir / "Gemfile"
version_file_regex = re.compile(r'.*File\.expand_path\("\.\./(.*)", __FILE__\)')
gemfile_text = ''
for line in repo.get_file('plugin.rb', repo.latest_commit_sha).splitlines():
if 'gem ' in line:
gemfile_text = gemfile_text + line + os.linesep
version_file_match = version_file_regex.match(line)
if version_file_match is not None:
filename = version_file_match.groups()[0]
content = repo.get_file(filename, repo.latest_commit_sha)
with open(rubyenv_dir / filename, 'w') as f:
f.write(content)
if len(gemfile_text) > 0:
if os.path.isfile(gemfile):
os.remove(gemfile)