mirror of
https://github.com/VigorousPro/TS3-Translation_zh-CN
synced 2025-01-01 20:25:08 +08:00
update script - todo error handling
This commit is contained in:
parent
18d1af92d9
commit
d1cbff9004
13
Gemfile.lock
13
Gemfile.lock
@ -1,13 +0,0 @@
|
|||||||
GEM
|
|
||||||
remote: https://rubygems.org/
|
|
||||||
specs:
|
|
||||||
rubyzip (1.2.2)
|
|
||||||
|
|
||||||
PLATFORMS
|
|
||||||
x64-mingw32
|
|
||||||
|
|
||||||
DEPENDENCIES
|
|
||||||
rubyzip
|
|
||||||
|
|
||||||
BUNDLED WITH
|
|
||||||
1.17.2
|
|
17
maker.rb
17
maker.rb
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
require "zip"
|
require "zip"
|
||||||
|
require 'net/http'
|
||||||
require "open3"
|
require "open3"
|
||||||
|
|
||||||
Zip.setup do |c|
|
Zip.setup do |c|
|
||||||
@ -65,8 +66,20 @@ end
|
|||||||
|
|
||||||
def send_progress(done, total)
|
def send_progress(done, total)
|
||||||
percentage = Rational(done*100,total).round(2).to_f
|
percentage = Rational(done*100,total).round(2).to_f
|
||||||
puts "当前进度:\n#{done}/#{total}", percentage
|
info = "当前进度:\n#{done}/#{total}\n#{percentage}%\n".freeze
|
||||||
# TODO: push to telegram
|
puts info
|
||||||
|
telegram_push(info)
|
||||||
|
end
|
||||||
|
|
||||||
|
def telegram_push(string)
|
||||||
|
tg_api = ENV['TG_API']
|
||||||
|
group_id = ENV['TG_GROUP_ID']
|
||||||
|
uri = URI("https://api.telegram.org/bot#{tg_api}/sendMessage")
|
||||||
|
querystring = {chat_id: group_id ,text: string}
|
||||||
|
uri.query = URI.encode_www_form(querystring)
|
||||||
|
res = Net::HTTP.get_response(uri)
|
||||||
|
puts res.code
|
||||||
|
# TODO: error handling
|
||||||
end
|
end
|
||||||
|
|
||||||
def make_package(zipfile_name, build_version=nil, log_url=nil)
|
def make_package(zipfile_name, build_version=nil, log_url=nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user