File indexing completed on 2024-04-21 04:45:39

0001 #!/usr/bin/env ruby
0002 #
0003 # This is a convenience script for bumping Amarok's plugin framework version
0004 # in the various engine desktop files and in pluginmanager.h.
0005 #
0006 # The script should be run once before each release, in order to ensure that
0007 # no old and perhaps incompatible engines are getting loaded. After running, don't
0008 # forget to commit and push. The script must be started from the amarok/ folder.
0009 #
0010 # (c) 2005-2010 Mark Kretschmann <kretschmann@kde.org>
0011 # License: GNU General Public License V2
0012 
0013 
0014 def bump_desktop_files
0015     files = Dir["**/*.desktop"]
0016 
0017     files.each do |path|
0018         file = File.new(path, File::RDWR)
0019         str = file.read
0020         unless str[/X-KDE-Amarok-framework-version=[0-9]*/].nil?
0021             puts path
0022             str.sub!( /X-KDE-Amarok-framework-version=[0-9]*/, "X-KDE-Amarok-framework-version=#{@version}" )
0023             file.rewind
0024             file.truncate(0)
0025             file << str
0026         end
0027         file.close
0028     end
0029 end
0030 
0031 
0032 # Make sure the current working directory is amarok
0033 if not Dir::getwd().split( "/" ).last() == "amarok"
0034     print "ERROR: This script must be started from the amarok/ folder. Aborting.\n\n"
0035     exit()
0036 end
0037 
0038 
0039 # Bump s_pluginFrameworkVersion in PluginManager.h
0040 file = File.new( "src/PluginManager.cpp", File::RDWR )
0041 str = file.read()
0042 file.rewind()
0043 file.truncate( 0 )
0044 temp = str.scan( /const int Plugins::PluginManager::s_pluginFrameworkVersion = [0-9]*;/ )
0045 @version = temp.join().scan( /[0-9]*/ ).join().to_i()
0046 @version = @version + 1
0047 
0048 print "Bumping the plugin framework version to: #{@version}"
0049 
0050 str.sub!( /const int Plugins::PluginManager::s_pluginFrameworkVersion = [0-9]*;/, "const int Plugins::PluginManager::s_pluginFrameworkVersion = #{@version};" )
0051 file << str
0052 file.close()
0053 
0054 
0055 # Bump plugin desktop files
0056 puts
0057 puts
0058 bump_desktop_files
0059 
0060 
0061 puts
0062 puts
0063 print "Done :) Now commit the source to git."
0064 puts
0065 puts
0066