dokuwiki-sandstorm/bin/upgrade_dokuwiki
2020-06-20 12:56:19 -04:00

51 lines
1.0 KiB
Ruby
Executable File

#!/usr/bin/env ruby
require 'time'
system("bin/cleanup_dokuwiki")
tag = ARGV[0]
unless tag
puts "Usage: #{$0} <tag>"
exit 1
end
Dir.chdir "dokuwiki" do
system("git fetch")
system("git checkout #{tag}")
if $? != 0
puts "Tag not found!"
exit 1
end
end
puts "#{tag} exists, updating files"
today = Time.now.strftime('%Y-%m-%d')
version = tag.gsub(/^release_(stable|candidate)_/, '')
File.open('.sandstorm/app-marketing-version', 'w') { |fh| fh.puts "#{version}~#{today}" }
lines = File.readlines('.sandstorm/sandstorm-pkgdef.capnp')
lines = lines.map do |line|
next line unless line['appVersion']
line.gsub(/= ([0-9])+,/) { |m| "= #{$1.to_i + 1}," }
end
File.open('.sandstorm/sandstorm-pkgdef.capnp', 'w') { |fh| fh.print lines.join }
puts "Now:"
puts
puts "vagrant-spk vm destroy"
puts "vagrant-spk vm up"
puts "vagrant-spk dev to Test locally"
puts "vagrant-spk pack ../dokuwiki-sandstorm-#{version}.pkg"
puts "Test upgrade"
puts "vagrant-spk publish ../dokuwiki-sandstorm-#{version}.pkg"