diff --git a/.gitignore b/.gitignore index 01d0a08..3cf00ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,12 @@ pkg/ +# Compiled files +*.tfstate +*.tfstate.backup + +# Module directory +.terraform +.idea +*.iml + +.build-harness +build-harness diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5a55a8f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +addons: + apt: + packages: + - git + - make + - curl + +install: + - make init \ No newline at end of file diff --git a/Makefile b/Makefile index d59dd91..2d9827a 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +SHELL := /bin/bash + +-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness) + #COPYRIGHT_CMD ?= copyright-header COPYRIGHT_CMD ?= docker run --rm --volume `pwd`:$(COPYRIGHT_OUTPUT_DIR) osterman/copyright-header:latest COPYRIGHT_LICENSE ?= GPL3 diff --git a/README.md b/README.md index c17f7d8..bb24aa0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ -Copyright Header -=============== + + +[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com) + +# copyright-header [![Build Status](https://travis-ci.org/cloudposse/copyright-header.svg?branch=master)](https://travis-ci.org/cloudposse/copyright-header) [![Latest Release](https://img.shields.io/github/release/cloudposse/copyright-header.svg)](https://github.com/cloudposse/copyright-header/releases) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com) + Copyright Header is a utility to manipulate licenses on source code. @@ -31,8 +35,23 @@ Install Copyright Header from RubyForge: gem install copyright-header -Usage ------ +--- + +This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps. + + + + + + +It's 100% Open Source and licensed under the [GNU General Public License](LICENSE). + + + + + + +## Usage Full list of supported arguments: @@ -55,8 +74,10 @@ Full list of supported arguments: -V, --version Display version information -h, --help Display this screen -Examples --------- + + + +## Examples Discover available parameters by passing the `--help` argument @@ -71,7 +92,7 @@ Add a GPL3 License header to a file: --copyright-software-description "This is the description of the software." \ --copyright-year 2012-2017 \ --output-dir /tmp \ - --dry-run + --dry-run Remove the header created in the previous step (without --dry-run argument): @@ -82,7 +103,7 @@ Remove the header created in the previous step (without --dry-run argument): --copyright-software-description 'This is the description of the software.' \ --copyright-year 2012-2017 \ --output-dir /tmp \ - --dry-run + --dry-run Command used to generate copyright headers for this script: @@ -101,8 +122,7 @@ Paths can be either files or directories. It will recursively traverse the direc You can specify an alternative syntax configuration file using the `--syntax` argument. -Rake ----- +## Rake The above example can be performed as rake task inside a Rakefile: @@ -141,29 +161,167 @@ docker run --rm --volume `pwd`:/usr/src/ osterman/copyright-header:latest \ ## Make -Here is how we typically use it in our [`Makefile`](Makefile). +Here is how we typically use it in our [`Makefile`](Makefile). Check out the Cloud Posse [`build-harness`](https://github.com/cloudposse/build-harness/) for other neat tricks. -Contributors ------------- - - -Contributing ------------- -1. Fork it -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Added some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request -Contact Information -------------------- +## Help + +**Got a question?** + +File a GitHub [issue](https://github.com/cloudposse/copyright-header/issues), send us an [email][email] or join our [Slack Community][slack]. + +## Commerical Support + +Work directly with our team of DevOps experts via email, slack, and video conferencing. + +We provide *commercial support* for all of our [Open Source][github] projects. As a *Dedicated Support* customer, you have access to our team of subject matter experts at a fraction of the cost of a fulltime engineer. + +[![E-Mail](https://img.shields.io/badge/email-hello@cloudposse.com-blue.svg)](mailto:hello@cloudposse.com) + +- **Questions.** We'll use a Shared Slack channel between your team and ours. +- **Troubleshooting.** We'll help you triage why things aren't working. +- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback. +- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects. +- **Build New Terraform Modules.** We'll develop original modules to provision infrastructure. +- **Cloud Architecture.** We'll assist with your cloud strategy and design. +- **Implementation.** We'll provide hands on support to implement our reference architectures. + + +## Community Forum + +Get access to our [Open Source Community Forum][slack] on Slack. It's **FREE** to join for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build *sweet* infrastructure. + +## Contributing + +### Bug Reports & Feature Requests + +Please use the [issue tracker](https://github.com/cloudposse/copyright-header/issues) to report any bugs or file feature requests. + +### Developing + +If you are interested in being a contributor and want to get involved in developing this project or [help out](https://github.com/orgs/cloudposse/projects/3) with our other projects, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com). + +In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. + + 1. **Fork** the repo on GitHub + 2. **Clone** the project to your own machine + 3. **Commit** changes to your own branch + 4. **Push** your work back up to your fork + 5. Submit a **Pull Request** so that we can review your changes + +**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request! + + +## Copyright + +Copyright © 2017-2018 [Cloud Posse, LLC](https://cloudposse.com) + + + + + + + + + + +## License + +[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +## Trademarks + +All other trademarks referenced herein are the property of their respective owners. + +## About + +This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at + +[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com) + +We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We love [Open Source Software](https://github.com/cloudposse/)! + +We offer paid support on all of our projects. + +Check out [our other projects][github], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation. + + [docs]: https://docs.cloudposse.com/ + [website]: https://cloudposse.com/ + [github]: https://github.com/cloudposse/ + [jobs]: https://cloudposse.com/jobs/ + [hire]: https://cloudposse.com/contact/ + [slack]: https://slack.cloudposse.com/ + [linkedin]: https://www.linkedin.com/company/cloudposse + [twitter]: https://twitter.com/cloudposse/ + [email]: mailto:hello@cloudposse.com + + +### Contributors + +| [![Erik Osterman][osterman_avatar]][osterman_homepage]
[Erik Osterman][osterman_homepage] | [![Leo O'Donnell][leopoldodonnell_avatar]][leopoldodonnell_homepage]
[Leo O'Donnell][leopoldodonnell_homepage] | [![Christian Meier][mkristian_avatar]][mkristian_homepage]
[Christian Meier][mkristian_homepage] | [![Gabriel de Perthuis][g2p_avatar]][g2p_homepage]
[Gabriel de Perthuis][g2p_homepage] | [![Thomas Russell Murphy][thomasrussellmurphy_avatar]][thomasrussellmurphy_homepage]
[Thomas Russell Murphy][thomasrussellmurphy_homepage] | [![Kongqun Yang][kqyang_avatar]][kqyang_homepage]
[Kongqun Yang][kqyang_homepage] | [![Vincent Billey][Fenntasy_avatar]][Fenntasy_homepage]
[Vincent Billey][Fenntasy_homepage] | [![arximboldi][arximboldi_avatar]][arximboldi_homepage]
[arximboldi][arximboldi_homepage] | [![David][TAGC_avatar]][TAGC_homepage]
[David][TAGC_homepage] | [![Rafał Rzepecki][dividedmind_avatar]][dividedmind_homepage]
[Rafał Rzepecki][dividedmind_homepage] | [![David Yip][yipdw_avatar]][yipdw_homepage]
[David Yip][yipdw_homepage] | [![Daniel Freedman][azakus_avatar]][azakus_homepage]
[Daniel Freedman][azakus_homepage] | [![Mitch Souders][crzysdrs_avatar]][crzysdrs_homepage]
[Mitch Souders][crzysdrs_homepage] | [![Mads Bondo Dydensborg][mbd-dbc-dk_avatar]][mbd-dbc-dk_homepage]
[Mads Bondo Dydensborg][mbd-dbc-dk_homepage] | [![Psy-Q][psy-q_avatar]][psy-q_homepage]
[Psy-Q][psy-q_homepage] | [![Bryan][bstopp_avatar]][bstopp_homepage]
[Bryan][bstopp_homepage] | [![Colin Dean][colindean_avatar]][colindean_homepage]
[Colin Dean][colindean_homepage] | [![Wahaj Shamim][wshamim_avatar]][wshamim_homepage]
[Wahaj Shamim][wshamim_homepage] | [![halo][halo_avatar]][halo_homepage]
[halo][halo_homepage] | [![Lloyd Dewolf][lloydde_avatar]][lloydde_homepage]
[Lloyd Dewolf][lloydde_homepage] | +|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| + + [osterman_homepage]: https://github.com/osterman + [osterman_avatar]: https://github.com/osterman.png?size=150 + [leopoldodonnell_homepage]: https://github.com/leopoldodonnell + [leopoldodonnell_avatar]: https://github.com/leopoldodonnell.png?size=150 + [mkristian_homepage]: https://github.com/mkristian + [mkristian_avatar]: https://github.com/mkristian.png?size=150 + [g2p_homepage]: https://github.com/g2p + [g2p_avatar]: https://github.com/g2p.png?size=150 + [thomasrussellmurphy_homepage]: https://github.com/thomasrussellmurphy + [thomasrussellmurphy_avatar]: https://github.com/thomasrussellmurphy.png?size=150 + [kqyang_homepage]: https://github.com/kqyang + [kqyang_avatar]: https://github.com/kqyang.png?size=150 + [Fenntasy_homepage]: https://github.com/Fenntasy + [Fenntasy_avatar]: https://github.com/Fenntasy.png?size=150 + [arximboldi_homepage]: https://github.com/arximboldi + [arximboldi_avatar]: https://github.com/arximboldi.png?size=150 + [TAGC_homepage]: https://github.com/TAGC + [TAGC_avatar]: https://github.com/TAGC.png?size=150 + [dividedmind_homepage]: https://github.com/dividedmind + [dividedmind_avatar]: https://github.com/dividedmind.png?size=150 + [yipdw_homepage]: https://github.com/yipdw + [yipdw_avatar]: https://github.com/yipdw.png?size=150 + [azakus_homepage]: https://github.com/azakus + [azakus_avatar]: https://github.com/azakus.png?size=150 + [crzysdrs_homepage]: https://github.com/crzysdrs + [crzysdrs_avatar]: https://github.com/crzysdrs.png?size=150 + [mbd-dbc-dk_homepage]: https://github.com/mbd-dbc-dk + [mbd-dbc-dk_avatar]: https://github.com/mbd-dbc-dk.png?size=150 + [psy-q_homepage]: https://github.com/psy-q + [psy-q_avatar]: https://github.com/psy-q.png?size=150 + [bstopp_homepage]: https://github.com/bstopp + [bstopp_avatar]: https://github.com/bstopp.png?size=150 + [colindean_homepage]: https://github.com/colindean + [colindean_avatar]: https://github.com/colindean.png?size=150 + [wshamim_homepage]: https://github.com/wshamim + [wshamim_avatar]: https://github.com/wshamim.png?size=150 + [halo_homepage]: https://github.com/halo + [halo_avatar]: https://github.com/halo.png?size=150 + [lloydde_homepage]: https://github.com/lloydde + [lloydde_avatar]: https://github.com/lloydde.png?size=150 -Author: Erik Osterman -E-mail: -Homepage: diff --git a/README.yaml b/README.yaml new file mode 100644 index 0000000..b960352 --- /dev/null +++ b/README.yaml @@ -0,0 +1,221 @@ +--- +# +# This is the canonical configuration for the `README.md` +# Run `make readme` to rebuild the `README.md` +# + +# Name of this project +name: copyright-header + +# Logo for this project +#logo: docs/logo.png + +# License of this project +license: "GPL3" + +# Canonical GitHub repo +github_repo: cloudposse/copyright-header + +# Badges to display +badges: + - name: "Build Status" + image: "https://travis-ci.org/cloudposse/copyright-header.svg?branch=master" + url: "https://travis-ci.org/cloudposse/copyright-header" + - name: "Latest Release" + image: "https://img.shields.io/github/release/cloudposse/copyright-header.svg" + url: "https://github.com/cloudposse/copyright-header/releases" + - name: "Slack Community" + image: "https://slack.cloudposse.com/badge.svg" + url: "https://slack.cloudposse.com" + +# Short description of this project +description: |- + Copyright Header is a utility to manipulate licenses on source code. + + Features + -------- + + * Add/remove a copyright headers recursively on source files + * Customize the syntax configuration for how to write out comments + * Built-in support for GPL3 and MIT licenses + * Supports custom licenes with `--license-file` argument + * ERB template support + + Caveats + ------- + * Will only remove headers to files that have exactly the same header as the one we added + * Will only add headers to files which do not contain the case-sensitive pattern `/[Cc]opyright|[Lc]icense/` in the first `N` lines + * Will not properly format arguments that contain new-line ("`\n`") characters. + + Requirements + ------------ + + * Ruby 1.9.2 (supported version, might work with older rubies but not guaranteed) + + Installation + ------------ + + Install Copyright Header from RubyForge: + + gem install copyright-header + +# How to use this project +usage: |- + Full list of supported arguments: + + Usage: copyright-header options [file] + -n, --dry-run Output the parsed files to STDOUT + -o, --output-dir DIR Use DIR as output directory + --license-file FILE Use FILE as header (instead of using --license argument) + --license [AGPL3|ASL2|BSD-2-CLAUSE|BSD-3-CLAUSE|BSD-4-CLAUSE|GPL3|MIT] + Use LICENSE as header + --copyright-software NAME The common name for this piece of software (e.g. "Copyright Header") + --copyright-software-description DESC + The detailed description for this piece of software (e.g. "A utility to manipulate copyright headers on source code files") + --copyright-holder NAME The legal owner of the copyright for the software. (e.g. "Erik Osterman "). Repeat argument for multiple names. + --copyright-year YEAR The years for which the copyright exists (e.g. "2012-2017"). Repeat argument for multiple years. + -w, --word-wrap LEN Maximum number of characters per line for license (default: 80) + -a, --add-path PATH Recursively insert header in all files found in path (allows multiple paths separated by platform path-separator ":") + -r, --remove-path PATH Recursively remove header in all files found in path (allows multiple paths separated by platform path-separator ":") + -g, --guess-extension Use the GitHub Linguist gem to guess the extension of the source code when no extension can be determined (experimental). + -c, --syntax FILE Syntax configuration file + -V, --version Display version information + -h, --help Display this screen + +# Example usage + +examples: |- + Discover available parameters by passing the `--help` argument + + copyright-header --help + + Add a GPL3 License header to a file: + + copyright-header --add-path /tmp/test.rb \ + --license GPL3 \ + --copyright-holder 'Joe Shmoe' \ + --copyright-software 'Example Software' \ + --copyright-software-description "This is the description of the software." \ + --copyright-year 2012-2017 \ + --output-dir /tmp \ + --dry-run + + Remove the header created in the previous step (without --dry-run argument): + + copyright-header --remove-path /tmp/test.rb \ + --license GPL3 \ + --copyright-holder 'Joe Shmoe' \ + --copyright-software 'Example Software' \ + --copyright-software-description 'This is the description of the software.' \ + --copyright-year 2012-2017 \ + --output-dir /tmp \ + --dry-run + + Command used to generate copyright headers for this script: + + copyright-header --license GPL3 \ + --add-path lib/:bin/ \ + --guess-extension \ + --copyright-holder 'Erik Osterman ' \ + --copyright-software 'Copyright Header' \ + --copyright-software-description "A utility to manipulate copyright headers on source code files" \ + --copyright-year 2012-2017 \ + --word-wrap 100 \ + --output-dir ./ + + + Paths can be either files or directories. It will recursively traverse the directory tree ignoring all dot files. + + You can specify an alternative syntax configuration file using the `--syntax` argument. + + ## Rake + + The above example can be performed as rake task inside a Rakefile: + + task :headers do + require 'rubygems' + require 'copyright_header' + + args = { + :license => 'GPL3', + :copyright_software => 'Copyright Header', + :copyright_software_description => "A utility to manipulate copyright headers on source code files", + :copyright_holders => ['Erik Osterman '], + :copyright_years => ['2012-2017'], + :add_path => 'lib', + :output_dir => '.' + } + + command_line = CopyrightHeader::CommandLine.new( args ) + command_line.execute + end + + ## Docker + + ``` + docker run --rm --volume `pwd`:/usr/src/ osterman/copyright-header:latest \ + --license GPL3 \ + --add-path . \ + --guess-extension \ + --copyright-holder 'Erik Osteman ' \ + --copyright-software 'Copyright Header' \ + --copyright-software-description 'A utility to manipulate copyright headers on source code files' \ + --copyright-year 2012-2017 \ + --word-wrap 100 \ + --output-dir /usr/src/ + ``` + + ## Make + + Here is how we typically use it in our [`Makefile`](Makefile). + + Check out the Cloud Posse [`build-harness`](https://github.com/cloudposse/build-harness/) for other neat tricks. + +# Example goes here... + +# How to get started quickly +#quickstart: |- +# Here's how to get started... + +# Contributors to this project +contributors: + - name: "Erik Osterman" + github: "osterman" + - name: "Leo O'Donnell" + github: "leopoldodonnell" + - name: "Christian Meier" + github: "mkristian" + - name: "Gabriel de Perthuis" + github: "g2p" + - name: "Thomas Russell Murphy" + github: "thomasrussellmurphy" + - name: "Kongqun Yang" + github: "kqyang" + - name: "Vincent Billey" + github: "Fenntasy" + - name: "arximboldi" + github: "arximboldi" + - name: "David" + github: "TAGC" + - name: "Rafał Rzepecki" + github: "dividedmind" + - name: "David Yip" + github: "yipdw" + - name: "Daniel Freedman" + github: "azakus" + - name: "Mitch Souders" + github: "crzysdrs" + - name: "Mads Bondo Dydensborg" + github: "mbd-dbc-dk" + - name: "Psy-Q" + github: "psy-q" + - name: "Bryan" + github: "bstopp" + - name: "Colin Dean" + github: "colindean" + - name: "Wahaj Shamim" + github: "wshamim" + - name: "halo" + github: "halo" + - name: "Lloyd Dewolf" + github: "lloydde" \ No newline at end of file