Commit 055a20285dec2462e716ecd4de5eb7eda095872a
1 parent
a8958475
Exists in
master
and in
22 other branches
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 | 1 | namespace :noosfero do |
2 | 2 | |
3 | 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 | 6 | end |
7 | 7 | end |
8 | 8 | |
... | ... | @@ -12,6 +12,25 @@ namespace :noosfero do |
12 | 12 | end |
13 | 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 | 34 | desc 'checks if there are uncommitted changes in the repo' |
16 | 35 | task :check_repo do |
17 | 36 | if !pendencies_on_repo[:ok] |
... | ... | @@ -78,17 +97,7 @@ EOF |
78 | 97 | output.puts `git log --pretty=format:'%aN <%aE>' | sort | uniq` |
79 | 98 | output.puts AUTHORS_FOOTER |
80 | 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 | 101 | rescue Exception => e |
93 | 102 | rm_f 'AUTHORS' |
94 | 103 | raise e |
... | ... | @@ -208,16 +217,25 @@ EOF |
208 | 217 | release_kind = args[:release_kind] || 'stable' |
209 | 218 | |
210 | 219 | Rake::Task['noosfero:set_version'].invoke(release_kind) |
220 | + | |
211 | 221 | puts "==> Checking tags..." |
212 | 222 | Rake::Task['noosfero:check_tag'].invoke |
223 | + | |
213 | 224 | puts "==> Checking debian package version..." |
214 | 225 | Rake::Task['noosfero:check_debian_package'].invoke |
226 | + | |
215 | 227 | puts "==> Checking translations..." |
216 | 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 | 233 | puts "==> Updating authors..." |
218 | 234 | Rake::Task['noosfero:authors'].invoke |
235 | + | |
219 | 236 | puts "==> Checking repository..." |
220 | 237 | Rake::Task['noosfero:check_repo'].invoke |
238 | + | |
221 | 239 | puts "==> Preparing debian packages..." |
222 | 240 | Rake::Task['noosfero:debian_packages'].invoke |
223 | 241 | if confirm('Do you want to upload the packages') |
... | ... | @@ -234,6 +252,7 @@ EOF |
234 | 252 | end |
235 | 253 | |
236 | 254 | sh "rm tmp/pending-release" if Dir["tmp/pending-release"].first.present? |
255 | + | |
237 | 256 | puts "I: please upload the tarball and Debian packages to the website!" |
238 | 257 | puts "I: please push the tag for version #{version} that was just created!" if !push_tags |
239 | 258 | puts "I: notify the community about this sparkling new version!" | ... | ... |