forked from OpenNebula/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbump-version.rb
More file actions
executable file
·39 lines (30 loc) · 814 Bytes
/
bump-version.rb
File metadata and controls
executable file
·39 lines (30 loc) · 814 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
33
34
35
36
37
38
39
#!/usr/bin/env ruby
require 'colored'
if ARGV.length != 2
STDERR.puts "Usage: #{$0} <old_version> <new_version>"
STDERR.puts "Example: #{$0} 4.10 4.12"
exit 1
end
old_version, new_version = ARGV
Dir.chdir File.dirname(__FILE__)+"/source"
Dir['**/*'].each do |file|
next unless File.file? file
skip = false
%w(_ conf.py release_notes/ locale/ images/ ext/ toc.html opennebula-white.png).each do |d|
if file.start_with?(d)
skip = true
break
end
end
next if skip
text = File.read(file)
text_original = text.clone
text.gsub!(old_version, new_version)
if text != text_original
puts "* Changing: #{file}"
File.open(file,'w'){|f| f.write(text)}
end
end
puts
puts "*** Remember to update conf.py***"
puts