Commit d1442f4054f77f996cb3074ba3bddab3b9cbca60

Authored by Rodrigo Souto
1 parent cb0bc1a7

Fixing release authors verification

Showing 1 changed file with 11 additions and 24 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 'AUTHORS'" do |ok, res| 4 + sh "git status | grep -v 'AUTHORS' > /dev/null" do |ok, res|
5 return {:ok => ok, :res => res} 5 return {:ok => ok, :res => res}
6 end 6 end
7 end 7 end
8 8
9 def pendencies_on_repo 9 def pendencies_on_repo
10 - sh "git status | grep 'nothing.*commit'" do |ok, res| 10 + sh "git status | grep 'nothing.*commit' > /dev/null" do |ok, res|
11 return {:ok => ok, :res => res} 11 return {:ok => ok, :res => res}
12 end 12 end
13 end 13 end
@@ -78,34 +78,21 @@ EOF @@ -78,34 +78,21 @@ EOF
78 output.puts `git log --pretty=format:'%aN <%aE>' | sort | uniq` 78 output.puts `git log --pretty=format:'%aN <%aE>' | sort | uniq`
79 output.puts AUTHORS_FOOTER 79 output.puts AUTHORS_FOOTER
80 end 80 end
81 - sh "git status | grep 'AUTHORS' > /dev/null" do |ok, res|  
82 - if ok  
83 - puts "\nThere are changes in the AUTHORS file:"  
84 - sh 'git diff AUTHORS'  
85 - if confirm('Do you want to commit these changes?')  
86 - sh 'git add AUTHORS'  
87 - sh 'git commit -m "Updating authors file"'  
88 - else  
89 - sh 'git checkout AUTHORS'  
90 - abort 'There are new authors to be commited. Reverting changes and exiting...'  
91 - 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...'
92 end 90 end
93 end 91 end
94 rescue Exception => e 92 rescue Exception => e
95 rm_f 'AUTHORS' 93 rm_f 'AUTHORS'
96 raise e 94 raise e
97 end 95 end
98 - if pendencies_on_authors[:res]  
99 - puts 'The AUTHORS file was updated!'  
100 - sh 'git diff AUTHORS'  
101 - if confirm('Do you want to commit this changes to the author file')  
102 - default_message = 'Updating AUTHORS file'  
103 - message = ask("Commit message [#{default_message}]:")  
104 - message = message.present? ? message : default_message  
105 - sh 'git add AUTHORS'  
106 - sh "git commit -m '#{message}'"  
107 - end  
108 - end  
109 end 96 end
110 97
111 def ask(message) 98 def ask(message)