1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/glitchsoc_ynh.git synced 2024-09-03 19:15:59 +02:00

Merge pull request #7 from YunoHost-Apps/testing

Fix level 1... now level 7!
This commit is contained in:
Tagada 2021-05-28 02:06:28 +02:00 committed by GitHub
commit 040eb4c672
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 85 additions and 12 deletions

View file

@ -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

View file

@ -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

72
bump-version.rb Normal file
View file

@ -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!"

View file

@ -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

View file

@ -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

View file

@ -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"
}
]