-
Notifications
You must be signed in to change notification settings - Fork 0
Release Tools (adding/updating Copyright, License, Author(s), ...)
License
procinproc/release_tools
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Keyword addition / extension tool
When you release software, you will be required to insert text such as
copyright and license into each source file.
There are also texts that need to be updated with each release, such
as the version number.
This software saves you the trouble of inserting text in the source
file.
For example, suppose you are creating the following file called hello.c.
#include <stdio.h>
main ()
{
priintf ("hello, world \ n");
}
Prepare test.conf, for example, with the following contents to display
the copyright.
license HALLO_LICENSE This is hallo license. \
you can use this.
copyright RIKEN_COPYRIGHT Copyright% y RIKEN.
copyright2 RCCSPYRIGHT Copyright% y RIKEN R-CCS.
version HELLO_VERSION 0.2
here
$ add_keyword -config test -tag license, copyright, version hello.c
When you execute, the contents of hello.c will be the follwoing;
/ *
* $ HALLO_LICENSE: $
* $ RIKEN_COPYRIGHT: $
* $ HELLO_VERSION: $
* /
#include <stdio.h>
main ()
{
priintf ("hello, world \ n");
}
To put license and copyright
$ expand_keyword -config test -tag license, copyright hello.c
and you will get;
/ *
* $ HALLO_LICENSE: This is hallo license.
* you can use this. $
* $ RIKEN_COPYRIGHT: Copyright 2013 RIKEN. $
* $ HELLO_VERSION: $
* /
#include <stdio.h>
main ()
{
priintf ("hello, world \ n");
}
When releasing version0.1
$ expand_keyword -config test -tag license, copyright, version hello.c
You will get;
/ *
* $ HALLO_LICENSE: This is hallo license.
* you can use this. $
* $ RIKEN_COPYRIGHT: Copyright 2013 RIKEN. $
* $ HELLO_VERSION: 0.1 $
* /
#include <stdio.h>
main ()
{
priintf ("hello, world \ n");
}
When releasing version 0,2, put the version line in test.config
version HELLO_VERSION 0.2
Change to and again
$ expand_keyword -config test -tag license, copyright, version hello.c
To run. If this command is run in 2014, you will get;
/ *
* $ HALLO_LICENSE: This is hallo license.
* you can use this. $
* $ RIKEN_COPYRIGHT: Copyright 2013-2014 RIKEN. $
* $ HELLO_VERSION: 0.2 $
* /
#include <stdio.h>
main ()
{
priintf ("hello, world \ n");
}
Installation
Specify the install destination in the INSTALL_ROOT variable of the Makefile
$ make INSTALL_ROOT=<INSTALL_DIR>
$ make INSTALL_ROOT=<INSTALL_DIR> install
Can be installed with config file
The format of the config file is;
tag keyword contents
Here, -tag- is a tag to be specified on the command line.
-keyword- is a keyword to be inserted with add_keyword.
You can write multiple keywords in one tag.
-contents- is the text to insert with expand_keyword.
If you write %y in contents, the current year when expand_keyword
Replaces (or the year specified by -year).
If the item can be identified as a year, the current year is added to
that year. For example,
Copyright %y Riken
There is contents, and the corresponding part of the file is
Copyright 2012 Riken
When it was run in 2013
Copyright 2012-2013 Riken
To run in 2014
Copyright 2012,2014 Riken
Replaces with.
You can put multiple lines of text by putting \ at the end of the line.
The following config file is installed in the destination etc
copyright.conf Copyright related
license.conbf License related
How to use
install Add the destination bin to the path
add_keyword -config config_files -tag tags files
expand_keyword -config config_files -tag tags foles
Use like.
Multiple config_files and tas can be written by separating them with ",".
config files looks for etc in install directory and the current
directory in that order.
You can write multiple files.
You can also specify a directory and insert it into all files that can
be processed under the directory.
Enjoy!
About
Release Tools (adding/updating Copyright, License, Author(s), ...)
Resources
License
Stars
Watchers
Forks
Releases
No releases published