Skip to content

Commit e027db2

Browse files
committed
[skip ci] update license scripts to take a target directory
1 parent d07505e commit e027db2

11 files changed

Lines changed: 22 additions & 11 deletions

etc/bin/add-license-adoc.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ under the License.
4141
4242
'''
4343

44-
def root = Paths.get(".").toRealPath()
44+
String targetPath = args && args[0] ? args[0] : '.'
45+
def root = Paths.get(targetPath).toRealPath()
4546

4647
Files.walk(root)
4748
.filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".adoc") }

etc/bin/add-license-css.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def HEADER = '''/*
4141
4242
'''
4343

44-
def root = Paths.get(".").toRealPath()
44+
String targetPath = args && args[0] ? args[0] : '.'
45+
def root = Paths.get(targetPath).toRealPath()
4546

4647
Files.walk(root)
4748
.filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".css") }

etc/bin/add-license-gradle.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def HEADER = '''/*
4141
4242
'''
4343

44-
def root = Paths.get(".").toRealPath()
44+
String targetPath = args && args[0] ? args[0] : '.'
45+
def root = Paths.get(targetPath).toRealPath()
4546

4647
Files.walk(root)
4748
.filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".gradle") }

etc/bin/add-license-groovy-java.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def HEADER = '''/*
4343
4444
'''
4545

46-
def root = Paths.get(".").toRealPath()
46+
String targetPath = args && args[0] ? args[0] : '.'
47+
def root = Paths.get(targetPath).toRealPath()
4748

4849
Files.walk(root)
4950
.filter { path -> Files.isRegularFile(path) && (path.toString().endsWith(".groovy") || path.toString().endsWith(".java")) }

etc/bin/add-license-gson.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def HEADER = '''/*
4141
4242
'''
4343

44-
def root = Paths.get(".").toRealPath()
44+
String targetPath = args && args[0] ? args[0] : '.'
45+
def root = Paths.get(targetPath).toRealPath()
4546

4647
Files.walk(root)
4748
.filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".gson") }

etc/bin/add-license-gsp.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def HEADER = '''<%--
4040
--%>
4141
'''
4242

43-
def root = Paths.get(".").toRealPath()
43+
String targetPath = args && args[0] ? args[0] : '.'
44+
def root = Paths.get(targetPath).toRealPath()
4445

4546
Files.walk(root)
4647
.filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".gsp") }

etc/bin/add-license-js.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def HEADER = '''/*
4141
4242
'''
4343

44-
def root = Paths.get(".").toRealPath()
44+
String targetPath = args && args[0] ? args[0] : '.'
45+
def root = Paths.get(targetPath).toRealPath()
4546

4647
Files.walk(root)
4748
.filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".js") }

etc/bin/add-license-md.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ limitations under the License.
3838
3939
'''
4040

41-
def root = Paths.get(".").toRealPath()
41+
String targetPath = args && args[0] ? args[0] : '.'
42+
def root = Paths.get(targetPath).toRealPath()
4243

4344
Files.walk(root)
4445
.filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".md") }

etc/bin/add-license-properties.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def HEADER = '''#
4040
#
4141
'''
4242

43-
def root = Paths.get(".").toRealPath()
43+
String targetPath = args && args[0] ? args[0] : '.'
44+
def root = Paths.get(targetPath).toRealPath()
4445

4546
Files.walk(root)
4647
.filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".properties") }

etc/bin/add-license-raw.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ under the License.
4141
4242
'''
4343

44-
def root = Paths.get(".").toRealPath()
44+
String targetPath = args && args[0] ? args[0] : '.'
45+
def root = Paths.get(targetPath).toRealPath()
4546

4647
Files.walk(root)
4748
.filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".raw") }

0 commit comments

Comments
 (0)