File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
lib/fastlane/plugin/wpmreleasetoolkit/models Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -49,21 +49,28 @@ def to_h
49
49
#
50
50
def send_metrics ( base_url :, api_token :)
51
51
uri = URI . parse ( base_url )
52
+ # Allow using a `file:` URI for debugging
53
+ if uri . is_a? ( URI ::File )
54
+ UI . message ( "Writing metrics payload to file #{ uri . path } (instead of sending it to a server)" )
55
+ File . write ( uri . path , to_h . to_json )
56
+ return
57
+ end
58
+
59
+ UI . message ( "Sending metrics to #{ uri } ..." )
52
60
headers = {
53
61
Authorization : "Bearer #{ api_token } " ,
54
62
Accept : 'application/json' ,
55
63
'Content-Type' : 'application/json' ,
56
64
'Content-Encoding' : 'gzip'
57
65
}
58
66
request = Net ::HTTP ::Post . new ( uri , headers )
59
-
60
67
request . body = Zlib . gzip ( to_h . to_json )
61
68
62
69
response = Net ::HTTP . start ( uri . hostname , uri . port , use_ssl : uri . scheme == 'https' ) do |http |
63
70
http . request ( request )
64
71
end
65
72
66
- UI . verbose ( " #{ response . code } #{ response . message } ")
73
+ UI . message ( "Metrics sent. (Received: #{ response . code } #{ response . message } ) ")
67
74
response . code . to_i
68
75
end
69
76
end
You can’t perform that action at this time.
0 commit comments