copyright-header 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +27 -21
- data/README.md +26 -5
- data/Rakefile +19 -0
- data/contrib/syntax.yml +26 -0
- data/lib/copyright_header/parser.rb +4 -4
- data/lib/copyright_header/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fc3436be953ca7c6da2ea31a722f0f54cc805b3
|
4
|
+
data.tar.gz: 4ae1ea01106bb3f543f92e2478813b0624b0c335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a399426f069be6a688bbbb935fa2f2b4ed82392d85f21eb2e1bf5731724cf04fa6b6b144cde5c78a6be6c55a6707acd8a602858b77bfb56bb2add92d29156c3f
|
7
|
+
data.tar.gz: 547a90296f7ebc5d28015427bc66b2ef093df1d8bafcdd011641df51a7d9780acd55710c66e696c167333f02e3bc896da73803ccd5b4e5dcdbdc9fd8336b3c94
|
data/Makefile
CHANGED
@@ -1,35 +1,41 @@
|
|
1
|
-
COPYRIGHT_CMD ?= copyright-header
|
2
|
-
|
1
|
+
#COPYRIGHT_CMD ?= copyright-header
|
2
|
+
COPYRIGHT_CMD ?= docker run --rm --volume `pwd`:$(COPYRIGHT_OUTPUT_DIR) osterman/copyright-header:latest
|
3
3
|
COPYRIGHT_LICENSE ?= GPL3
|
4
4
|
COPYRIGHT_HOLDER ?= Erik Osterman <e@osterman.com>
|
5
|
-
COPYRIGHT_YEAR ?= 2012-
|
5
|
+
COPYRIGHT_YEAR ?= 2012-2017
|
6
6
|
COPYRIGHT_SOFTWARE ?= Copyright Header
|
7
7
|
COPYRIGHT_SOFTWARE_DESCRIPTION ?= A utility to manipulate copyright headers on source code files
|
8
8
|
COPYRIGHT_OUTPUT_DIR ?= /usr/src
|
9
9
|
COPYRIGHT_WORD_WRAP ?= 100
|
10
|
+
COPYRIGHT_PATHS ?= lib/:bin/:contrib/
|
10
11
|
|
11
12
|
remove-copyright:
|
12
13
|
$(COPYRIGHT_CMD) \
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
--license $(COPYRIGHT_LICENSE) \
|
15
|
+
--remove-path $(COPYRIGHT_PATHS) \
|
16
|
+
--guess-extension \
|
17
|
+
--copyright-holder '$(COPYRIGHT_HOLDER)' \
|
18
|
+
--copyright-software '$(COPYRIGHT_SOFTWARE)' \
|
19
|
+
--copyright-software-description '$(COPYRIGHT_SOFTWARE_DESCRIPTION)' \
|
20
|
+
--copyright-year $(COPYRIGHT_YEAR) \
|
21
|
+
--word-wrap $(COPYRIGHT_WORD_WRAP) \
|
22
|
+
--output-dir $(COPYRIGHT_OUTPUT_DIR)
|
22
23
|
|
23
24
|
add-copyright:
|
24
25
|
$(COPYRIGHT_CMD) \
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
--license $(COPYRIGHT_LICENSE) \
|
27
|
+
--add-path $(COPYRIGHT_PATHS) \
|
28
|
+
--guess-extension \
|
29
|
+
--copyright-holder '$(COPYRIGHT_HOLDER)' \
|
30
|
+
--copyright-software '$(COPYRIGHT_SOFTWARE)' \
|
31
|
+
--copyright-software-description '$(COPYRIGHT_SOFTWARE_DESCRIPTION)' \
|
32
|
+
--copyright-year $(COPYRIGHT_YEAR) \
|
33
|
+
--word-wrap $(COPYRIGHT_WORD_WRAP) \
|
34
|
+
--output-dir $(COPYRIGHT_OUTPUT_DIR)
|
34
35
|
|
35
36
|
|
37
|
+
bump:
|
38
|
+
gem bump
|
39
|
+
|
40
|
+
release:
|
41
|
+
rake release
|
data/README.md
CHANGED
@@ -46,7 +46,7 @@ Full list of supported arguments:
|
|
46
46
|
--copyright-software-description DESC
|
47
47
|
The detailed description for this piece of software (e.g. "A utility to manipulate copyright headers on source code files")
|
48
48
|
--copyright-holder NAME The legal owner of the copyright for the software. (e.g. "Erik Osterman <e@osterman.com>"). Repeat argument for multiple names.
|
49
|
-
--copyright-year YEAR The years for which the copyright exists (e.g. "2012"). Repeat argument for multiple years.
|
49
|
+
--copyright-year YEAR The years for which the copyright exists (e.g. "2012-2017"). Repeat argument for multiple years.
|
50
50
|
-w, --word-wrap LEN Maximum number of characters per line for license (default: 80)
|
51
51
|
-a, --add-path PATH Recursively insert header in all files found in path (allows multiple paths separated by platform path-separator ":")
|
52
52
|
-r, --remove-path PATH Recursively remove header in all files found in path (allows multiple paths separated by platform path-separator ":")
|
@@ -69,7 +69,7 @@ Add a GPL3 License header to a file:
|
|
69
69
|
--copyright-holder 'Joe Shmoe' \
|
70
70
|
--copyright-software 'Example Software' \
|
71
71
|
--copyright-software-description "This is the description of the software." \
|
72
|
-
--copyright-year 2012 \
|
72
|
+
--copyright-year 2012-2017 \
|
73
73
|
--output-dir /tmp \
|
74
74
|
--dry-run
|
75
75
|
|
@@ -80,7 +80,7 @@ Remove the header created in the previous step (without --dry-run argument):
|
|
80
80
|
--copyright-holder 'Joe Shmoe' \
|
81
81
|
--copyright-software 'Example Software' \
|
82
82
|
--copyright-software-description 'This is the description of the software.' \
|
83
|
-
--copyright-year 2012 \
|
83
|
+
--copyright-year 2012-2017 \
|
84
84
|
--output-dir /tmp \
|
85
85
|
--dry-run
|
86
86
|
|
@@ -92,7 +92,7 @@ Command used to generate copyright headers for this script:
|
|
92
92
|
--copyright-holder 'Erik Osterman <e@osterman.com>' \
|
93
93
|
--copyright-software 'Copyright Header' \
|
94
94
|
--copyright-software-description "A utility to manipulate copyright headers on source code files" \
|
95
|
-
--copyright-year 2012 \
|
95
|
+
--copyright-year 2012-2017 \
|
96
96
|
--word-wrap 100 \
|
97
97
|
--output-dir ./
|
98
98
|
|
@@ -115,7 +115,7 @@ The above example can be performed as rake task inside a Rakefile:
|
|
115
115
|
:copyright_software => 'Copyright Header',
|
116
116
|
:copyright_software_description => "A utility to manipulate copyright headers on source code files",
|
117
117
|
:copyright_holders => ['Erik Osterman <e@osterman.com>'],
|
118
|
-
:copyright_years => ['2012'],
|
118
|
+
:copyright_years => ['2012-2017'],
|
119
119
|
:add_path => 'lib',
|
120
120
|
:output_dir => '.'
|
121
121
|
}
|
@@ -124,6 +124,27 @@ The above example can be performed as rake task inside a Rakefile:
|
|
124
124
|
command_line.execute
|
125
125
|
end
|
126
126
|
|
127
|
+
## Docker
|
128
|
+
|
129
|
+
```
|
130
|
+
docker run --rm --volume `pwd`:/usr/src/ osterman/copyright-header:latest \
|
131
|
+
--license GPL3 \
|
132
|
+
--add-path . \
|
133
|
+
--guess-extension \
|
134
|
+
--copyright-holder 'Erik Osteman <e@osterman.com>' \
|
135
|
+
--copyright-software 'Copyright Header' \
|
136
|
+
--copyright-software-description 'A utility to manipulate copyright headers on source code files' \
|
137
|
+
--copyright-year 2012-2017 \
|
138
|
+
--word-wrap 100 \
|
139
|
+
--output-dir /usr/src/
|
140
|
+
```
|
141
|
+
|
142
|
+
## Make
|
143
|
+
|
144
|
+
Here is how we typically use it in our [`Makefile`](Makefile).
|
145
|
+
|
146
|
+
Check out the Cloud Posse [`build-harness`](https://github.com/cloudposse/build-harness/) for other neat tricks.
|
147
|
+
|
127
148
|
|
128
149
|
Contributors
|
129
150
|
------------
|
data/Rakefile
CHANGED
@@ -1 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Header - A utility to manipulate copyright headers on source code files
|
3
|
+
# Copyright (C) 2017 Erik Osteman <e@osterman.com>
|
4
|
+
#
|
5
|
+
# This file is part of Copyright Header.
|
6
|
+
#
|
7
|
+
# Copyright Header is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# Copyright Header is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Copyright Header. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
1
20
|
require "bundler/gem_tasks"
|
data/contrib/syntax.yml
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Header - A utility to manipulate copyright headers on source code files
|
3
|
+
# Copyright (C) 2012-2017 Erik Osterman <e@osterman.com>
|
4
|
+
#
|
5
|
+
# This file is part of Copyright Header.
|
6
|
+
#
|
7
|
+
# Copyright Header is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# Copyright Header is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Copyright Header. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
1
20
|
ruby:
|
2
21
|
ext: ['.rb', '.rake']
|
3
22
|
after: ['^#!', '^#.*encoding:']
|
@@ -174,3 +193,10 @@ vhdl:
|
|
174
193
|
open: '--\n'
|
175
194
|
close: '--\n\n'
|
176
195
|
prefix: '-- '
|
196
|
+
|
197
|
+
elm:
|
198
|
+
ext: ['.elm']
|
199
|
+
comment:
|
200
|
+
open: '{-\n'
|
201
|
+
close: '-}\n\n'
|
202
|
+
prefix: ' '
|
@@ -89,7 +89,7 @@ module CopyrightHeader
|
|
89
89
|
text = ""
|
90
90
|
if @config.has_key?(:after) && @config[:after].instance_of?(Array)
|
91
91
|
copyright_written = false
|
92
|
-
lines = @contents.split(/\n
|
92
|
+
lines = @contents.split(/\n/, -1)
|
93
93
|
head = lines.shift(10)
|
94
94
|
while(head.size > 0)
|
95
95
|
line = head.shift
|
@@ -155,7 +155,7 @@ module CopyrightHeader
|
|
155
155
|
def ext(file)
|
156
156
|
extension = File.extname(file)
|
157
157
|
if @guess_extension && (extension.nil? || extension.empty?)
|
158
|
-
extension = Linguist::FileBlob.new(file).language.
|
158
|
+
extension = Linguist::FileBlob.new(file).language.extensions.first
|
159
159
|
end
|
160
160
|
return extension
|
161
161
|
end
|
@@ -208,7 +208,7 @@ module CopyrightHeader
|
|
208
208
|
paths.each do |path|
|
209
209
|
begin
|
210
210
|
if File.file?(path)
|
211
|
-
if
|
211
|
+
if File.basename(path).match(Regexp.union(@exclude))
|
212
212
|
STDERR.puts "SKIP #{path}; excluded"
|
213
213
|
next
|
214
214
|
end
|
@@ -264,4 +264,4 @@ module CopyrightHeader
|
|
264
264
|
end
|
265
265
|
end
|
266
266
|
end
|
267
|
-
end
|
267
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: copyright-header
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Osterman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github-linguist
|