-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrelease.rb
More file actions
executable file
·34 lines (27 loc) · 838 Bytes
/
release.rb
File metadata and controls
executable file
·34 lines (27 loc) · 838 Bytes
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
31
32
#!/usr/bin/env ruby
LIB_NAME = 'everscale-client-ruby'
script_file_path = File.expand_path(File.dirname(__FILE__))
GEM_DIR = "#{script_file_path}"
version_file = "#{GEM_DIR}/lib/#{LIB_NAME}/version.rb"
file = File.read(version_file)
p 'check version'
if file[/VERSION = "(\d+)\.(\d+)\.(\d+)"/]
major = $1
minor = $2
current = $3
version = "#{major}.#{minor}.#{current.to_i + 1}"
p version
data = file
data.gsub!(/VERSION\s+=[\s\S]+?$/, "VERSION = \"#{version}\"")
p data
p version_file
p 'update version'
puts "make release? Y/N"
File.open(version_file, 'wb') { |f| f.write(data) }
option = gets
if option.strip.downcase == 'y'
system(%{cd #{GEM_DIR} && git add .})
system(%{cd #{GEM_DIR} && git commit -m 'version #{version}'})
system(%{cd #{GEM_DIR} && bash -lc 'rake release'})
end
end