Skip to content
This repository has been archived by the owner on Jan 16, 2020. It is now read-only.

Host a tool for automatize the change of year #6

Open
Maks3w opened this issue Jan 4, 2016 · 2 comments
Open

Host a tool for automatize the change of year #6

Maks3w opened this issue Jan 4, 2016 · 2 comments

Comments

@Maks3w
Copy link
Member

Maks3w commented Jan 4, 2016

Every year we need to update the copyright for every place where the copyright holder.

These places are usually:

  • LICENSE, LICENSE.txt, LICENSE.md files
  • Any PHP file.
  • Any other kind of text file.

There are two patterns of copyrights:

  • First year: Copyright (c) 2015,
  • Following years: Copyright (c) 2015-2016,

We want a script tool for automatize the search and replace of the copyright years with the following rules.

  1. Files with Following years pattern must update the last year in the range with the actual one.
  2. Files with First year pattern must be replaced with the Following years pattern.

Tools can be proposed for to be merged on this repo or to be available for public use in any other repository,

We want you!

@DASPRiD
Copy link
Member

DASPRiD commented Jan 4, 2016

#!/bin/bash

YEAR=$(date +"%Y")

for file in $(find . -type f); do
    sed -i 's/\(Copyright (c) [0-9]\{4\}\)\(-[0-9]\{4\}\)\?/\1-'"$YEAR"'/' $file
done;

@Maks3w
Copy link
Member Author

Maks3w commented Jan 4, 2016

Please make a Pull Request ;-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants