All Projects → atapas → Add Copyright

atapas / Add Copyright

Licence: other
This is a Script to Automate adding the Copyright text to one or more source files Recursively.

Programming Languages

javascript
184084 projects - #8 most used programming language
bash
514 projects
script
160 projects

Projects that are alternatives of or similar to Add Copyright

Linuxbashshellscriptforops
Linux Bash Shell Script and Python Script For Ops and Devops
Stars: ✭ 298 (+1003.7%)
Mutual labels:  bash-script, automation
Licenseplist
A license list generator of all your dependencies for iOS applications
Stars: ✭ 1,996 (+7292.59%)
Mutual labels:  automation, license
Webdriverio Jest
Example of a WebdriverIO test written with the Jest framework
Stars: ✭ 19 (-29.63%)
Mutual labels:  automation
Datacleaner
A Python tool that automatically cleans data sets and readies them for analysis.
Stars: ✭ 933 (+3355.56%)
Mutual labels:  automation
Bernard
Bernard is a voice assistant developed with gTTS. It can fulfill basic and simple tasks you give.
Stars: ✭ 24 (-11.11%)
Mutual labels:  automation
Automation Report
Automation report是一款可以解决很多行业领域中设涉及到报告生成的需求,本项目最开始的初衷是为公司内部简化人工流程的一个环节,主要实现目的是将实验室检测得出的下机数据结果与对应的报告模版批量结合生成报告(.pdf)。
Stars: ✭ 22 (-18.52%)
Mutual labels:  automation
Home Assistant Config
Home Assistant config files, rewritten to use the latest features, 100+ documented automations, automatically generated ToC 🏠 🤖
Stars: ✭ 926 (+3329.63%)
Mutual labels:  automation
Auto App
Crie um aplicativo com todas as tabelas de um dos seus bancos sem uma linha de código.
Stars: ✭ 18 (-33.33%)
Mutual labels:  automation
Ansiblecm
A Docker based Ansible control machine for running playbooks in a consistent environment.
Stars: ✭ 26 (-3.7%)
Mutual labels:  automation
Virtesk
An Open Source VDI management solution to allow running virtual desktops in a RHEV/Ovirt environment seamlessly
Stars: ✭ 23 (-14.81%)
Mutual labels:  automation
Ebook renamer
Rename multiple ebooks (pdf, epub, mobi) based on embedded meta-data.
Stars: ✭ 25 (-7.41%)
Mutual labels:  automation
Diffios
Cisco IOS diff tool
Stars: ✭ 23 (-14.81%)
Mutual labels:  automation
Supreme
A command line visual file manager for linux
Stars: ✭ 22 (-18.52%)
Mutual labels:  automation
Vkb
Bot for vk.com competitions
Stars: ✭ 24 (-11.11%)
Mutual labels:  automation
Pre Commit Terraform
pre-commit git hooks to take care of Terraform configurations
Stars: ✭ 902 (+3240.74%)
Mutual labels:  automation
Instagramfirstcommenter
This bot will post a predefined comment as fast as possible to a new post on the target profile. I used this to successfully win tickets for a big music festival.
Stars: ✭ 26 (-3.7%)
Mutual labels:  automation
Homebridge Garagedoor Command
Homebridge plugin to control a garage door using command line functions
Stars: ✭ 18 (-33.33%)
Mutual labels:  automation
Wsl Docker Git Setup
Shell script to configure Windows Subsystem for Linux (WSL) & Ubuntu on Windows to use docker and docker-compose as well as a git-enabled prompt
Stars: ✭ 23 (-14.81%)
Mutual labels:  bash-script
Craft Do Forge Recipe
Digital Ocean / Forge Recipe for CraftCMS websites
Stars: ✭ 24 (-11.11%)
Mutual labels:  bash-script
Work Dummy
Ever needed to faff or pretend to be seriously at work? This repository hosts a powershell script that'd make anyone think you definitely bursting your ass solving problems.
Stars: ✭ 26 (-3.7%)
Mutual labels:  bash-script

add-copyright

All Contributors FOSSA Status

This is a Script to Automate adding the Copyright text to one or more source files Recursively. The Copyright texts get added to the top of the source file. Ice on the Cake is, it doesn't duplicate the copyright text if it is added already!

Note: The same tool can be used to add any such text blocks like, License, File level Comments etc.

Here is an example of JavaScript(.js) file.

/*
 © Copyright 2020 tapasadhikary.com or one of its affiliates.
 * Some Sample Copyright Text Line
 * Some Sample Copyright Text Line
 * Some Sample Copyright Text Line
 * Some Sample Copyright Text Line
 * Some Sample Copyright Text Line
 * Some Sample Copyright Text Line
*/

const test = () => {
	console.log('test');
}

test();

To Run this on your Source Code

  • Clone the project. This project comes with a script file called addcopyright.sh and few test files to test out things before you feel comfortable to try it on your source code.
  • Browse to the folder where you have cloned the project.
  • Change directory to add-copyright folder.
  • Open a shell or Gitbash or any unix command supported prompt.
  • Execute this command:
     export COPYRIGHTLEN=`wc -l copyright.txt | cut -f1 -d ' '`
    
    The above command will set some variable value that will be used by the addcopyright.sh script.
  • Execute the following command to add the copyright/license text from the copyright.txt to your source code:
     find <SOURCE_CODE_DIRECTIRY> -type d -name "<EXCLUDE_DIRECTORY>" -prune -o -name "*.js" -print0 | xargs -0 ./addcopyright.sh
    
    Where the <SOURCE_CODE_DIRECTIRY> is the path of your source code. Where the <EXCLUDE_DIRECTORY> is the directory to exclude if it exists under <SOURCE_CODE_DIRECTIRY> for updating the Copyright information.

Usage

Make sure you have given the execute permission to the addcopyright.sh script file. You can provide the permission using following command:

chmod +x addcopyright.sh

If your user is not having root privileges, add your $USER to 'roots' group using command :

useradd -m -G root $USER

Alternatively:
Insert 'sudo' when executing the run command. For example:

 sudo find <SOURCE_CODE_DIRECTIRY> -type d -name "<EXCLUDE_DIRECTORY>" -prune -o -name "*.js" -print0 | sudo xargs -0 ./addcopyright.sh

Running it on Source Code without any Exclusions

For running the tool on the Source code without excluding any folders, use this command:

find <SOURCE_CODE_DIRECTIRY>  -name "*.js" -print0 | xargs -0 ./addcopyright.sh
  • For current directory use .(dot)
  • If your source code is in /home/atapas/code directory, use the above command as,
      find <SOURCE_CODE_DIRECTIRY>  -name "*.js" -print0 | xargs -0 ./addcopyright.sh
    

Running it on Source Code with Exclusions(Say, node_modules)

For Running the tool on the Source Code by excluding the folder of your desire(say, node_modules for nodeJs based applications), use this command:

 find /opt/atapas/code -type d -name "node_modules" -prune -o -name "*.js" -print0 | xargs -0 ./addcopyright.sh

Excluding multiple directories(Say, node_modules and test)

If your source code is in /home/atapas/code and want to exclude node_modules and test directories, use the above command as,

   find /opt/atapas/code -type d -name "node_modules" -prune -o -type d -name "test" -prune -o -name "*.js" -print0 | xargs -0 ./addcopyright.sh

Change the file Types

To Change the file type, just replace the *.js with any other extentions like, *.java, *.cpp etc.

Limitations

  • This tool can only be run from a Linux Bash Shell. For running it from windows use any bash shell like GitBash.

  • This tool can be made use for different language files like javascript, java, c, c++, html, shell-script etc. However the content of the copyright.txt should be changed according to the mult-line comment format. For example,

    For Javascript(.js) or Java(.java) files this is the format:

        
     /*
      This is a comment
     */
    

    For HTML(.htm or .html) file the format should be,

        
    <!-- 
       This is a HTML Comment
    -->
    

Contributors ✨

Thanks goes to these wonderful people (emoji key):


IAMLEGION98

⚠️

Tapas Adhikary

💻

Pradeep Repaka

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

License

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].