rust-raspberrypi-OS-tutorials/utils/update_copyright.rb

18 lines
456 B
Ruby
Raw Normal View History

2021-01-01 10:28:32 +00:00
#!/usr/bin/env ruby
# frozen_string_literal: true
# SPDX-License-Identifier: MIT OR Apache-2.0
#
2022-01-15 20:50:11 +00:00
# Copyright (c) 2021-2022 Andre Richter <andre.o.richter@gmail.com>
2021-01-01 10:28:32 +00:00
require 'date'
files = `git ls-files`.split("\n")
files = files.delete_if { |f| File.symlink?(f) }
files = files.join(' ')
year = Date.today.year
2021-01-01 20:07:58 +00:00
`sed -i -- 's,\\(Copyright .* 20..\\)-20..,\\1-#{year},g' #{files}`
`sed -i -- 's,\\(Copyright .* #{year - 1}\\) ,\\1-#{year} ,g' #{files}`