|
|
@@ -478,6 +478,7 @@ task :ci_site_update do
|
|
|
# Automatically bump copyright when crossing a new year and give instruction to clear the cache if so since the cache is of no use anyway because of massive changes
|
|
|
system "git add #{bump_copyright_year.join ' '} && if git commit -qm 'Travis CI: bump copyright to #{Time.now.year}.\n[ccache clear]'; then git push origin HEAD:#{ENV['TRAVIS_BRANCH']} -q >/dev/null 2>&1 && echo Bumped copyright - Happy New Year!; fi" or abort "Failed to push copyright update for #{ENV['TRAVIS_BRANCH']}"
|
|
|
['urho3d.github.io master', 'android-ndk ndk-update-trigger', 'rpi-sysroot sysroot-update-trigger', 'emscripten-sdk sdk-update-trigger'].each { |var| pair = var.split; system "if [ ! -d ../#{pair.first} ]; then git clone -q --depth 1 --branch #{pair.last} https://github.com/urho3d/#{pair.first} ../#{pair.first}; fi" or abort "Failed to clone urho3d/#{pair.first}"; system "cd ../#{pair.first} && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/urho3d/#{pair.first} && git add #{bump_copyright_year("../#{pair.first}").join ' '} && if git commit -qm 'Travis CI: bump copyright to #{Time.now.year}.\n[ci skip]'; then git push -q >/dev/null 2>&1; fi" or abort "Failed to push copyright update for urho3d/#{pair.first}"; }
|
|
|
+ ['urho3d.github.io master'].each { |var| pair = var.split; system "if [ ! -d ../#{pair.first} ]; then git clone -q --depth 1 --branch #{pair.last} https://github.com/urho3d/#{pair.first} ../#{pair.first}; fi" or abort "Failed to clone urho3d/#{pair.first}"; system "cd ../#{pair.first} && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/urho3d/#{pair.first} && git add #{bump_copyright_year("../#{pair.first}", '2014-[0-9]{4} Yao').join ' '} && if git commit -qm 'Travis CI: bump copyright to #{Time.now.year}.\n[ci skip]'; then git push -q >/dev/null 2>&1; fi" or abort "Failed to push copyright update for urho3d/#{pair.first}"; }
|
|
|
elsif system("git add Docs/*API* && git commit -qm 'Test commit to detect API documentation changes'")
|
|
|
# Automatically give instruction to do packaging when API has changed, unless the instruction is already given in this commit
|
|
|
bump_soversion 'Source/Urho3D/.soversion' or abort 'Failed to bump soversion'
|
|
|
@@ -878,12 +879,12 @@ def update_web_samples_data dir = '../urho3d.github.io/samples', filename = '../
|
|
|
end
|
|
|
end
|
|
|
|
|
|
-def bump_copyright_year dir='.'
|
|
|
+def bump_copyright_year dir='.', regex='2008-[0-9]{4} the Urho3D project'
|
|
|
begin
|
|
|
Dir.chdir dir do
|
|
|
- copyrighted = `git grep -El '2008-[0-9]{4} the Urho3D project'`.split
|
|
|
+ copyrighted = `git grep -El '#{regex}'`.split
|
|
|
copyrighted.each { |filename|
|
|
|
- replaced_content = File.read(filename).gsub(/2008-[0-9]{4} the Urho3D project/, "2008-#{Time.now.year} the Urho3D project")
|
|
|
+ replaced_content = File.read(filename).gsub(/#{regex}/, regex.gsub('[0-9]{4}', Time.now.year.to_s))
|
|
|
File.open(filename, 'w') { |file| file.puts replaced_content }
|
|
|
}
|
|
|
return copyrighted
|