lib/cocoapods-flutter/native/archive/remote.rb in cocoapods-flutter-dt-0.2.6 vs lib/cocoapods-flutter/native/archive/remote.rb in cocoapods-flutter-dt-0.2.7
- old
+ new
@@ -1,6 +1,7 @@
require 'rest-client'
+require 'open-uri'
class Remote
def initialize
if ENV['FLUTTER_BINARY_SERVER_BASEURL'].nil?
@@ -38,8 +39,35 @@
def download_url(name, version, tag)
uri = URI.join @base_url, "/frameworks/#{name}/#{version}/#{tag}"
resp = RestClient.get uri.to_s
json = JSON.parse(resp.body)
@base_url + json["data"]['download_url']
+ end
+
+ def download_flutter_sdk_dsym(version, hash, des_path)
+ uri = URI.join @base_url, "/dsyms/download/flutter/#{version}/#{hash}/file.zip"
+ Pod::UserInterface.info "Start download Flutter.framework.dSYM from #{uri.to_s}"
+ data = RestClient::Request.execute(:method => :get, :url => uri.to_s, :timeout => 3600, :raw_response => true)
+ file = File.new(des_path, 'w+')
+ file.write data
+ file.close
+ end
+
+ def upload_flutter_sdk_dsym(version, hash, file_path)
+ uri = URI.join @base_url, "/dsyms"
+ Pod::UserInterface.info "Start upload '#{file_path}' to #{uri.to_s}"
+ req = RestClient::Request.new(
+ :method => :post,
+ :url => uri.to_s,
+ :timeout => 3600,
+ :payload => {
+ :multipart => true,
+ :file => File.new(file_path, 'rb'),
+ :name => 'flutter',
+ :version => version,
+ :tag => hash
+ }
+ )
+ req.execute
end
end
\ No newline at end of file