Revert previous commit, was incorrect
[amarok.git] / release_scripts / bump_plugin_version.rb
blob218b00a752af44c1268cac4d511eef3c47158e8d
1 #!/usr/bin/env ruby
3 # This is a convenience script for bumping Amarok's plugin framework version
4 # in the various engine desktop files and in pluginmanager.h.
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.
10 # (c) 2005 Mark Kretschmann <markey@web.de>
11 # License: GNU General Public License V2
14 def bump_desktop_files( folder )
15     Dir.foreach( folder ) do |x|
16         next if x[0, 1] == "."
17         if FileTest.directory?( "#{folder}/#{x}" )
18             print x + "\n"
19             files = Dir["#{folder}/#{x}/*.desktop"].delete_if { |a| a.include?( "install.desktop" ) }
20             file = File.new( files.join(), File::RDWR )
21             str = file.read()
22             file.rewind()
23             file.truncate( 0 )
24             str.sub!( /X-KDE-Amarok-framework-version=[0-9]*/, "X-KDE-Amarok-framework-version=#{@version}" )
25             file << str
26             file.close()
27         end
28     end
29 end
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
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
48 print "Bumping the plugin framework version to: #{@version}"
50 str.sub!( /static const int FrameworkVersion = [0-9]*;/, "static const int FrameworkVersion = #{@version};" )
51 file << str
52 file.close()
55 # Bump plugin desktop files
56 print "\n\n"
57 Dir.chdir( "src" )
58 bump_desktop_files( "engine" )
59 bump_desktop_files( "mediadevice" )
60 bump_desktop_files( "device" )
64 print "\n"
65 print "\n"
66 print "Done :) Now commit the source to SVN."
67 print "\n\n"