2020-04-26 20:51:55 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'httparty'
|
|
|
|
require 'time'
|
|
|
|
|
|
|
|
version = ARGV[0]
|
|
|
|
|
|
|
|
unless version
|
|
|
|
puts "Usage: #{$0} <version>"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
2021-06-12 14:54:30 +00:00
|
|
|
verify_url = "https://github.com/gohugoio/hugo/releases/download/v#{version}/hugo_extended_#{version}_Linux-64bit.deb"
|
2020-04-26 20:51:55 +00:00
|
|
|
|
|
|
|
response = HTTParty.get(verify_url)
|
|
|
|
|
|
|
|
unless response.code >= 200 && response.code < 300
|
|
|
|
puts "Error verifying release exists!"
|
|
|
|
puts " URL checked: #{verify_url}"
|
|
|
|
puts " Response code: #{response.code}"
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
|
|
|
puts "#{version} exists, updating files"
|
|
|
|
|
|
|
|
today = Time.now.strftime('%Y-%m-%d')
|
|
|
|
|
|
|
|
File.open('hugo-version', 'w') { |fh| fh.puts version }
|
|
|
|
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']
|
|
|
|
|
2020-06-26 15:58:24 +00:00
|
|
|
line.gsub(/= ([0-9]+),/) { |m| "= #{$1.to_i + 1}," }
|
2020-04-26 20:51:55 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
File.open('.sandstorm/sandstorm-pkgdef.capnp', 'w') { |fh| fh.print lines.join }
|
|
|
|
|
|
|
|
puts <<-TXT
|
|
|
|
|
|
|
|
Now do this:
|
|
|
|
|
2020-07-28 10:59:12 +00:00
|
|
|
* bin/test_hugo
|
2020-04-26 20:51:55 +00:00
|
|
|
* Test fresh install
|
2020-05-25 15:08:41 +00:00
|
|
|
* vagrant-spk pack ../hugo-sandstorm.spk
|
2020-04-26 20:51:55 +00:00
|
|
|
* Test upgrade install
|
|
|
|
TXT
|