This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
#!/usr/bin/env ruby |
| 2 |
# |
| 3 |
# This is a convenience script for bumping Amarok's plugin framework version |
| 4 |
# in the various engine desktop files and in pluginmanager.h. |
| 5 |
# |
| 6 |
# The script should be run once before each release, in order to ensure that |
| 7 |
# no old and perhaps incompatible engines are getting loaded. After running, don't |
| 8 |
# forget to commit to svn. The script must be started from the amarok/ folder. |
| 9 |
# |
| 10 |
# (c) 2005-2008 Mark Kretschmann <kretschmann@kde.org> |
| 11 |
# License: GNU General Public License V2 |
| 12 |
|
| 13 |
|
| 14 |
def bump_desktop_files |
| 15 |
files = Dir["**/*.desktop"] |
| 16 |
|
| 17 |
files.each do |path| |
| 18 |
file = File.new(path, File::RDWR) |
| 19 |
str = file.read |
| 20 |
unless str[/X-KDE-Amarok-framework-version=[0-9]*/].nil? |
| 21 |
puts path |
| 22 |
str.sub!( /X-KDE-Amarok-framework-version=[0-9]*/, "X-KDE-Amarok-framework-version=#{@version}" ) |
| 23 |
file.rewind |
| 24 |
file.truncate(0) |
| 25 |
file << str |
| 26 |
end |
| 27 |
file.close |
| 28 |
end |
| 29 |
end |
| 30 |
|
| 31 |
|
| 32 |
# Make sure the current working directory is amarok |
| 33 |
if not Dir::getwd().split( "/" ).last() == "amarok" |
| 34 |
print "ERROR: This script must be started from the amarok/ folder. Aborting.\n\n" |
| 35 |
exit() |
| 36 |
end |
| 37 |
|
| 38 |
|
| 39 |
# Bump FrameworkVersion in pluginmanager.h |
| 40 |
file = File.new( "src/PluginManager.h", File::RDWR ) |
| 41 |
str = file.read() |
| 42 |
file.rewind() |
| 43 |
file.truncate( 0 ) |
| 44 |
temp = str.scan( /static const int FrameworkVersion = [0-9]*;/ ) |
| 45 |
@version = temp.join().scan( /[0-9]*/ ).join().to_i() |
| 46 |
@version = @version + 1 |
| 47 |
|
| 48 |
print "Bumping the plugin framework version to: #{@version}" |
| 49 |
|
| 50 |
str.sub!( /static const int FrameworkVersion = [0-9]*;/, "static const int FrameworkVersion = #{@version};" ) |
| 51 |
file << str |
| 52 |
file.close() |
| 53 |
|
| 54 |
|
| 55 |
# Bump plugin desktop files |
| 56 |
puts |
| 57 |
puts |
| 58 |
bump_desktop_files |
| 59 |
|
| 60 |
|
| 61 |
puts |
| 62 |
puts |
| 63 |
print "Done :) Now commit the source to SVN." |
| 64 |
puts |
| 65 |
puts |