Skip to content

Commit 0c97cc7

Browse files
author
Shelson Ferrari
committed
refatoracao script generateChangelogAndProjectVersion.groovy, remocao so script python q fazia a mesma coisa e insercao de i18n pt_br
1 parent 133ffff commit 0c97cc7

3 files changed

Lines changed: 27 additions & 135 deletions

File tree

i18n/pt_br.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
project.title=API de Conversão de Moedas
2-
project.description=API para conversão de taxas de câmbio
2+
project.description=API para conversão de taxas de câmbio
3+
project.description=API para conversão de taxas de câmbio
4+
label.project.change.log=Registro de Alterações do Projeto
5+
label.current.version=Versão atual

sys/generateChangelogAndProjectVersion.groovy

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ def projectDir = Paths.get("").toAbsolutePath().normalize().toString()
3333
// ---------------------------------
3434
// Read properties from project.properties
3535
// ---------------------------------
36-
def propertiesPath = Paths.get(projectDir, '.', 'project.properties')
37-
def properties = new Properties()
36+
def projectPropertiesPath = Paths.get(projectDir, '.', 'project.properties')
37+
def projectProperties = new Properties()
3838

3939
try {
40-
properties.load(Files.newInputStream(propertiesPath))
40+
projectProperties.load(Files.newInputStream(projectPropertiesPath))
4141
} catch (IOException e) {
42-
println("Error: Unable to load 'project.properties'. Please ensure the file exists at ${propertiesPath}.")
42+
println("Error: Unable to load 'project.properties'. Please ensure the file exists at ${projectPropertiesPath}.")
4343
return
4444
}
4545

4646
// ---------------------------------
4747
// user, repo and i18n from properties
4848
// ---------------------------------
49-
def user = properties['github.repo.user']
50-
def repo = properties['github.repo.name']
51-
def i18n = properties['i18n']
49+
def user = projectProperties['github.repo.user']
50+
def repo = projectProperties['github.repo.name']
51+
def i18n = projectProperties['i18n']
5252

5353
def i18nPropertiesPath = Paths.get(projectDir, 'i18n', "${i18n}.properties")
5454
def i18nProperties = new Properties()
@@ -62,9 +62,8 @@ try {
6262

6363
def projectTitle = i18nProperties['project.title']
6464
def projectDescription = i18nProperties['project.description']
65-
66-
println("projectTitle:${projectTitle}")
67-
println("projectDescription:${projectDescription}")
65+
def projectChangeLogDescription = i18nProperties['label.project.change.log']
66+
def currenceVersionDescription = i18nProperties['label.current.version']
6867

6968
// ---------------------------------
7069
// Executes the Git command to get the list of commits with hash, date, author, and message
@@ -129,12 +128,21 @@ commits.each { commit ->
129128
def commitUrl = "https://github.com/${user}/${repo}/commit/${commitHash}"
130129
lastCommitUrl = "https://github.com/${user}/${repo}/commit/${commitHash}"
131130

132-
// Ignore commits with the keyword "AUTO_COMMIT"
133-
if (message.contains("AUTO_COMMIT") || message.contains("AUTO_CHANGELOG")) {
131+
// ---------------------------------
132+
// Array of keywords to ignore
133+
// ---------------------------------
134+
def ignoreKeywords = ["AUTO_COMMIT", "AUTO_CHANGELOG"]
135+
136+
// ---------------------------------
137+
// Ignore commits with specified keywords
138+
// ---------------------------------
139+
if (ignoreKeywords.any { keyword -> message.contains(keyword) }) {
134140
return // Continue to next commit
135141
}
136142

143+
// ---------------------------------
137144
// Increment the version for each valid commit
145+
// ---------------------------------
138146
def version = "[${major}.${minor}.${patch}](${commitUrl})"
139147
lastVersion = "${major}.${minor}.${patch}"
140148
lastDate = date
@@ -158,9 +166,10 @@ commits.each { commit ->
158166
// ---------------------------------
159167
def header = new StringBuilder()
160168
header.append("""
161-
# Project Change Log
169+
# ${projectTitle} - ${projectChangeLogDescription}
170+
171+
**${currenceVersionDescription}:** [${lastVersion}](${lastCommitUrl}) (${lastAuthor}) - ${lastDate}
162172
163-
**Current version:** [${lastVersion}](${lastCommitUrl}) (${lastAuthor}) - ${lastDate}
164173
---
165174
""")
166175

sys/generateChangelogAndProjectVersion.py

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)