-
Notifications
You must be signed in to change notification settings - Fork 2
/
publish.rb
30 lines (24 loc) · 932 Bytes
/
publish.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
version = ARGV[0]
puts "Version:#{version}"
unless version =~ /^\d+\.\d\.\d(\-[a-z.0-9]+)?$/
STDERR.puts "Expected version as argument instead got: #{version}"
exit 1
end
path = File.join(File.dirname(__FILE__),
if version.split('.')[0] == "5"
'@react-native-mapbox-gl-mapbox-static.5.template.podspec.json'
else
'@react-native-mapbox-gl-mapbox-static.template.podspec.json'
end
)
lines = []
File.readlines(path).each do |line|
line = line.gsub(/\_\.\_\.\_/,version)
lines.push(line)
end
File.write(File.join(File.dirname(__FILE__), "@react-native-mapbox-gl-mapbox-static.podspec.json"), lines.join(""))
if ARGV[1] == "autopublish"
system("pod trunk push \"@react-native-mapbox-gl-mapbox-static.podspec.json\" --skip-import-validation --allow-warnings")
else
puts "Please execute: `pod trunk push \"@react-native-mapbox-gl-mapbox-static.podspec.json\" --skip-import-validation --allow-warnings`"
end