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 1 namespace :noosfero do
2 2  
3 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 5 return {:ok => ok, :res => res}
6 6 end
7 7 end
8 8  
9 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 11 return {:ok => ok, :res => res}
12 12 end
13 13 end
... ... @@ -78,34 +78,21 @@ EOF
78 78 output.puts `git log --pretty=format:'%aN <%aE>' | sort | uniq`
79 79 output.puts AUTHORS_FOOTER
80 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 90 end
93 91 end
94 92 rescue Exception => e
95 93 rm_f 'AUTHORS'
96 94 raise e
97 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 96 end
110 97  
111 98 def ask(message)
... ...