cocoapods-marstransfer 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b912439a56d59601f7d3cb6786f212787ce63d9e173381e6f7d1d1354f9b09
|
4
|
+
data.tar.gz: d4b751236ef27c78fe5918bc48e9e00d8af3a99540f92ae18cc9b0c70e40f210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4a677b0ace23bf04220a7e72dcf6cf56c4e672e604f4b25343e0c4ba332a6acd6a61b642cc9a64da14fb2815cdbf9c511bf3ef0f62392b613bc9878e414aeea
|
7
|
+
data.tar.gz: e4fd408bcf5bac5610d13b600c7b28d0405509635b41e836a7d632076bacec0f9f8ea35b25a6d6f5bdfda55098c8c0a545e1191326998647d8beac9f15019c62
|
@@ -15,6 +15,47 @@ module Pod
|
|
15
15
|
end
|
16
16
|
|
17
17
|
|
18
|
+
def upload_file(file_path)
|
19
|
+
url = ""
|
20
|
+
if @tos_domain.include?("http")
|
21
|
+
url = "#{@tos_domain}/open_oss/upload_file"
|
22
|
+
else
|
23
|
+
url = "http://#{@tos_domain}/open_oss/upload_file"
|
24
|
+
end
|
25
|
+
uri = URI(url)
|
26
|
+
req = Net::HTTP::Post.new(uri)
|
27
|
+
req['Host'] = uri.hostname
|
28
|
+
req['Content-Type'] = "multipart/form-data"
|
29
|
+
req['Content-Length'] = File.size(file_path)
|
30
|
+
form_data = [['file', File.open(file_path)],['file_path',@tos_bucket],['token',@tos_key]] # or File.open() in case of local file
|
31
|
+
req.set_form(form_data, 'multipart/form-data')
|
32
|
+
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
33
|
+
http.request(req)
|
34
|
+
end
|
35
|
+
puts "[MARS] Upload file to TOS: Sending PUT #{url} with key #{@tos_key} bucket #{@tos_bucket}"
|
36
|
+
puts "[MARS] Response #{response.code} #{response.message}"
|
37
|
+
# puts "Headers: #{response.to_hash.inspect}"
|
38
|
+
data = JSON.parse(response.body)
|
39
|
+
puts "[MARS] Response #{response.body}"
|
40
|
+
zip_url = data["data"][0]
|
41
|
+
zip_url
|
42
|
+
end
|
43
|
+
|
44
|
+
def transfer_demo()
|
45
|
+
download_url = "https://github.com/volcengine/ve_Template_iOS/archive/refs/heads/main.zip"
|
46
|
+
ve_template_dir = File.join(Dir.pwd, ["ve_Template_iOS.zip"])
|
47
|
+
File.open(ve_template_dir, "wb") do |file|
|
48
|
+
file.write URI.open(download_url).read
|
49
|
+
end
|
50
|
+
demo_url = upload_file(ve_template_dir)
|
51
|
+
if !demo_url.nil?
|
52
|
+
puts "[MARS] Transfer Demo Success: #{demo_url}"
|
53
|
+
else
|
54
|
+
puts "[MARS] Transfer Demo Failed"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
18
59
|
def transfer_pod(pod)
|
19
60
|
puts "[MARS] =========== Start Transfer #{pod} =============="
|
20
61
|
version = @lockfile.version(pod)
|
@@ -28,8 +69,7 @@ module Pod
|
|
28
69
|
source = json["source"]
|
29
70
|
source_url = source["git"] unless !source.has_key?("git")
|
30
71
|
source_tag = source["tag"] unless !source.has_key?("tag")
|
31
|
-
|
32
|
-
zip_url = ""
|
72
|
+
zip_url = nil
|
33
73
|
if !source_url.nil? && !source_tag.nil?
|
34
74
|
Dir.chdir("source") do
|
35
75
|
cmd = "git clone #{source_url} #{pod} --branch #{source_tag} --config advice.detachedHead=false"
|
@@ -43,30 +83,10 @@ module Pod
|
|
43
83
|
zip_file.add( file.sub( "#{ archive_directory_path }/", "" ), file )
|
44
84
|
end
|
45
85
|
end
|
46
|
-
|
47
|
-
url = "http://#{@tos_domain}/open_oss/upload_file"
|
48
|
-
uri = URI(url)
|
49
|
-
req = Net::HTTP::Post.new(uri)
|
50
|
-
req['Host'] = uri.hostname
|
51
|
-
# req['User-Agent'] = "tos-sdk-go"
|
52
|
-
req['Content-Type'] = "multipart/form-data"
|
53
|
-
req['Content-Length'] = File.size(archive_zip_path)
|
54
|
-
# puts "filesize:#{File.size(archive_zip_path)}"
|
55
|
-
form_data = [['file', File.open(archive_zip_path)],['file_path',@tos_bucket],['token',@tos_key]] # or File.open() in case of local file
|
56
|
-
req.set_form(form_data, 'multipart/form-data')
|
57
|
-
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
58
|
-
http.request(req)
|
59
|
-
end
|
60
|
-
puts "[MARS] Upload file to TOS: Sending PUT #{url} with key #{@tos_key} bucket #{@tos_bucket}"
|
61
|
-
puts "[MARS] Response #{response.code} #{response.message}"
|
62
|
-
# puts "Headers: #{response.to_hash.inspect}"
|
63
|
-
data = JSON.parse(response.body)
|
64
|
-
puts "[MARS] Response #{response.body}"
|
65
|
-
response_code = response.code
|
66
|
-
zip_url = data["data"][0]
|
86
|
+
zip_url = upload_file(archive_zip_path)
|
67
87
|
end
|
68
88
|
|
69
|
-
if
|
89
|
+
if !zip_url.nil?
|
70
90
|
puts "[MARS] Upload Success: url #{zip_url}"
|
71
91
|
json["source"] = {"http" => zip_url}
|
72
92
|
pod_spec_url = Dir.pwd + "/podspec/" + "#{pod}.podspec.json"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-marstransfer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shangguanchengyang.1
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|