namespace :noosfero do desc 'checks if there are uncommitted changes in the repo' task :check_repo do sh "git status | grep 'nothing.*commit'" do |ok, res| if !ok raise "******** There are uncommited changes in the repository, cannot continue" end end end version = Noosfero::VERSION desc 'checks if there is already a tag for the current version' task :check_tag do sh "git tag | grep '^#{version}$' >/dev/null" do |ok, res| if ok raise "******** There is already a tag for version #{version}, cannot continue" end end puts "Not found tag for version #{version}, we can go on." end AUTHORS_HEADER = < Guilherme Rocha Raphael Rousseau Théo Bondolfi Vicente Aguiar EOF desc 'updates the AUTHORS file' task :authors do begin File.open("AUTHORS", 'w') do |output| output.puts AUTHORS_HEADER output.puts `git log --pretty=format:'%aN <%aE>' | sort | uniq` output.puts AUTHORS_FOOTER end rescue Exception => e rm_f 'AUTHORS' raise e end end desc 'prepares a release tarball' task :release => [ :check_tag, 'noosfero:doc:translate', 'noosfero:error-pages:translate', :authors, :check_repo ] do sh 'rake -f Rakefile.pkg' sh "git tag #{version}" puts "I: please upload the tarball to the website!" puts "I: please push the tag for version #{version} that was just created!" end end