Commit 055a20285dec2462e716ecd4de5eb7eda095872a

Authored by Rodrigo Souto
1 parent a8958475

Supporting public error pages commit during release script

Showing 1 changed file with 32 additions and 13 deletions   Show diff stats
lib/tasks/release.rake
1 namespace :noosfero do 1 namespace :noosfero do
2 2
3 def pendencies_on_authors 3 def pendencies_on_authors
4 - sh "git status | grep -v 'AUTHORS' > /dev/null" do |ok, res|  
5 - return {:ok => ok, :res => res} 4 + sh "git status | grep 'AUTHORS' > /dev/null" do |ok, res|
  5 + return {:ok => !ok, :res => res}
6 end 6 end
7 end 7 end
8 8
@@ -12,6 +12,25 @@ namespace :noosfero do @@ -12,6 +12,25 @@ namespace :noosfero do
12 end 12 end
13 end 13 end
14 14
  15 + def pendencies_on_public_errors
  16 + sh "git status | grep -e '500.html' -e '503.html' > /dev/null" do |ok, res|
  17 + return {:ok => !ok, :res => res}
  18 + end
  19 + end
  20 +
  21 + def commit_changes(files, commit_message)
  22 + files = files.join(' ')
  23 + puts "\nThere are changes in the following files:"
  24 + sh "git diff #{files}"
  25 + if confirm('Do you want to commit these changes')
  26 + sh "git add #{files}"
  27 + sh "git commit -m '#{commit_message}'"
  28 + else
  29 + sh "git checkout #{files}"
  30 + abort 'There are changes to be commited. Reverting changes and exiting...'
  31 + end
  32 + end
  33 +
15 desc 'checks if there are uncommitted changes in the repo' 34 desc 'checks if there are uncommitted changes in the repo'
16 task :check_repo do 35 task :check_repo do
17 if !pendencies_on_repo[:ok] 36 if !pendencies_on_repo[:ok]
@@ -78,17 +97,7 @@ EOF @@ -78,17 +97,7 @@ EOF
78 output.puts `git log --pretty=format:'%aN <%aE>' | sort | uniq` 97 output.puts `git log --pretty=format:'%aN <%aE>' | sort | uniq`
79 output.puts AUTHORS_FOOTER 98 output.puts AUTHORS_FOOTER
80 end 99 end
81 - if !pendencies_on_authors[:ok]  
82 - puts "\nThere are changes in the AUTHORS file:"  
83 - sh 'git diff AUTHORS'  
84 - if confirm('Do you want to commit these changes')  
85 - sh 'git add AUTHORS'  
86 - sh 'git commit -m "Updating authors file"'  
87 - else  
88 - sh 'git checkout AUTHORS'  
89 - abort 'There are new authors to be commited. Reverting changes and exiting...'  
90 - end  
91 - end 100 + commit_changes(['AUTHORS'], 'Updating AUTHORS file') if !pendencies_on_authors[:ok]
92 rescue Exception => e 101 rescue Exception => e
93 rm_f 'AUTHORS' 102 rm_f 'AUTHORS'
94 raise e 103 raise e
@@ -208,16 +217,25 @@ EOF @@ -208,16 +217,25 @@ EOF
208 release_kind = args[:release_kind] || 'stable' 217 release_kind = args[:release_kind] || 'stable'
209 218
210 Rake::Task['noosfero:set_version'].invoke(release_kind) 219 Rake::Task['noosfero:set_version'].invoke(release_kind)
  220 +
211 puts "==> Checking tags..." 221 puts "==> Checking tags..."
212 Rake::Task['noosfero:check_tag'].invoke 222 Rake::Task['noosfero:check_tag'].invoke
  223 +
213 puts "==> Checking debian package version..." 224 puts "==> Checking debian package version..."
214 Rake::Task['noosfero:check_debian_package'].invoke 225 Rake::Task['noosfero:check_debian_package'].invoke
  226 +
215 puts "==> Checking translations..." 227 puts "==> Checking translations..."
216 Rake::Task['noosfero:error-pages:translate'].invoke 228 Rake::Task['noosfero:error-pages:translate'].invoke
  229 + if !pendencies_on_public_errors[:ok]
  230 + commit_changes(['public/500.html', 'public/503.html'], 'Updating public error pages')
  231 + end
  232 +
217 puts "==> Updating authors..." 233 puts "==> Updating authors..."
218 Rake::Task['noosfero:authors'].invoke 234 Rake::Task['noosfero:authors'].invoke
  235 +
219 puts "==> Checking repository..." 236 puts "==> Checking repository..."
220 Rake::Task['noosfero:check_repo'].invoke 237 Rake::Task['noosfero:check_repo'].invoke
  238 +
221 puts "==> Preparing debian packages..." 239 puts "==> Preparing debian packages..."
222 Rake::Task['noosfero:debian_packages'].invoke 240 Rake::Task['noosfero:debian_packages'].invoke
223 if confirm('Do you want to upload the packages') 241 if confirm('Do you want to upload the packages')
@@ -234,6 +252,7 @@ EOF @@ -234,6 +252,7 @@ EOF
234 end 252 end
235 253
236 sh "rm tmp/pending-release" if Dir["tmp/pending-release"].first.present? 254 sh "rm tmp/pending-release" if Dir["tmp/pending-release"].first.present?
  255 +
237 puts "I: please upload the tarball and Debian packages to the website!" 256 puts "I: please upload the tarball and Debian packages to the website!"
238 puts "I: please push the tag for version #{version} that was just created!" if !push_tags 257 puts "I: please push the tag for version #{version} that was just created!" if !push_tags
239 puts "I: notify the community about this sparkling new version!" 258 puts "I: notify the community about this sparkling new version!"