diff --git a/README.md b/README.md index 4a48e08..0d6dc4b 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in A libre and federated social network, fork of Mastodon. -**Shipped version:** 3.4.0-rc2~ynh1 +**Shipped version:** 2021-05-22~ynh2 diff --git a/README_fr.md b/README_fr.md index a6df7b3..f3fd27a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Un réseau social libre et fédéré, scission de Mastodon. -**Version incluse:** 3.4.0-rc2~ynh1 +**Version incluse:** 2021-05-22~ynh2 diff --git a/bump-version.rb b/bump-version.rb new file mode 100644 index 0000000..5da826a --- /dev/null +++ b/bump-version.rb @@ -0,0 +1,72 @@ +#!/usr/bin/env ruby + +# [For package maintainers] +# Edit the conf/app.src files with the latest commit +# +# Usage: +# ./bump-version.rb + +require 'digest' +require 'json' +require 'open-uri' + +module Yunohost + class AppSrcFile + def initialize(path = 'conf/app.src') + @path = path + end + + def update(url, sum) + src = File.read(@path) + replace_src_setting!(src, 'SOURCE_URL', url) + replace_src_setting!(src, 'SOURCE_SUM', sum) + replace_src_setting!(src, 'SOURCE_FILENAME', File.basename(URI.parse(url).path)) + File.write(@path, src) + end + + private + + def replace_src_setting!(str, setting, value) + str.gsub!(/^#{setting}=.*$/, "#{setting}=#{value}") + end + end + + class ManifestFile + def initialize(path = 'manifest.json') + @path = path + end + + def update_with_version(version) + manifest_file = File.read(@path) + manifest = JSON.parse(manifest_file) + + if manifest['version'].start_with? version + i = manifest['version'].scan(/~ynh(\d)/).flatten.first.to_i + 1 + manifest['version'] = "#{version}~ynh#{i}" + else + manifest['version'] = "#{version}~ynh1" + end + + manifest_file = JSON.pretty_generate(manifest, indent: ' ') + "\n" + File.write(@path, manifest_file) + end + end +end + +github = JSON.parse(URI.parse('https://api.github.com/repos/glitch-soc/mastodon/branches/main').read) +last_commit = github["commit"]["sha"] +version = Date.parse(github["commit"]["commit"]["author"]["date"]).to_s + +url = "https://github.com/glitch-soc/mastodon/archive/#{last_commit}.tar.gz" + +puts "Downloading last commit at #{url}" +release_file = URI.parse(url).read +sum = Digest::SHA256.hexdigest(release_file) + +# Update source file +Yunohost::AppSrcFile.new().update(url, sum) + +# Update manifest file +Yunohost::ManifestFile.new().update_with_version(version) + +puts "Done!" diff --git a/check_process b/check_process index 5060f43..9c0e57b 100644 --- a/check_process +++ b/check_process @@ -13,10 +13,8 @@ setup_public=1 upgrade=1 backup_restore=1 - multi_instance=1 + multi_instance=0 port_already_use=0 change_url=0 ;;; Options -Email=yalh@yahoo.com -Notification=all ;;; Upgrade options diff --git a/conf/app.src b/conf/app.src index 906ff25..6320061 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://github.com/glitch-soc/mastodon/archive/678e07c54485c6cc61b2ac18aa5ceaa290a6fcbd.tar.gz -SOURCE_SUM=4c970c6af2dc9652a1374c3d70c3ea5256ea4e04a76aa206ebbf9a3516fcbc64 +SOURCE_URL=https://github.com/glitch-soc/mastodon/archive/2024aef0f9b52297d814811f5825678a563f78ff.tar.gz +SOURCE_SUM=d22e21d0175837e6969cdf6b2658784a288cc841cbfda18fb43de5f90d783586 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= +SOURCE_FILENAME=2024aef0f9b52297d814811f5825678a563f78ff.tar.gz SOURCE_EXTRACT=true diff --git a/manifest.json b/manifest.json index d9b1a97..c8336ee 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A libre and federated social network, fork of Mastodon.", "fr": "Un réseau social libre et fédéré, scission de Mastodon." }, - "version": "3.4.0~ynh1", + "version": "2021-05-22~ynh2", "url": "https://github.com/glitch-soc/mastodon", "upstream": { "license": "free", @@ -25,7 +25,7 @@ "nginx" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain", @@ -47,8 +47,11 @@ "ask": { "en": "Choose the application language", "fr": "Choisissez la langue de l'application" - }, - "choices": ["en_EN", "fr_FR"], + }, + "choices": [ + "en_EN", + "fr_FR" + ], "default": "fr_FR" } ]