Skip to content

Commit

Permalink
Resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dixitdeepak committed Dec 2, 2024
1 parent 011ad7b commit 7997a4f
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -901,13 +901,17 @@ task createComponent {
print "\n\n"
println "Select rest api (r), screens (s), or both (B):"
def componentInput = System.in.newReader().readLine()
logger.warn("componentInput: ${componentInput}")
logger.warn("componentInput: ${componentInput == ''}")

if (componentInput == 'r') {
new File(newComponent, 'screen').deleteDir()
new File(newComponent, 'template').deleteDir()
new File(newComponent, 'data/AppSeedData.xml').delete()
new File(newComponent, 'MoquiConf.xml').delete()
def moquiConf = new File(newComponent, 'MoquiConf.xml')
moquiConf.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
"<!-- No copyright or license for configuration file, details here are not considered a creative work. -->\n" +
"<moqui-conf xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://moqui.org/xsd/moqui-conf-3.xsd\">\n" +
"</moqui-conf>")
println "Selected rest api so, deleted screen, template, and AppSeedData.xml\n"
} else if (componentInput == 's') {
new File(newComponent, "services/${component}.rest.xml").delete()
Expand Down Expand Up @@ -944,19 +948,21 @@ task createComponent {

def grgit = Grgit.init(dir: newComponent.path)
grgit.add(patterns: ['.'])
// grgit.commit(message: 'Initial commit', sign: false)
// Can't get signing to work easily. If signing works well then might as well commit
// grgit.commit(message: 'Initial commit')
println "Selected yes, so git is initialized\n"
// println "To push to remote repository, type the git remote url or enter to skip"
// def remoteUrl = System.in.newReader().readLine()
// if (remoteUrl != '') {
// grgit.remote.add(name: 'origin', url: remoteUrl)
// def branch = grgit.branch.current().name
// grgit.push(remote: 'origin', refsOrSpecs: [':refs/branch/'+branch])
// }
println "To setup the git remote origin, type the git remote url or enter to skip"
def remoteUrl = System.in.newReader().readLine()
if (remoteUrl != '') {
grgit.remote.add(name: 'origin', url: remoteUrl)
println "Run the following to push the git repository:\ncd runtime/component/${component} && git commit -m 'Initial commit' && git push && cd ../../.."
} else {
println "Run the following to push the git repository:\ncd runtime/component/${component} && git commit -m 'Initial commit' && git remote add origin git@github.com:yourgroup/${component} && git push && cd ../../.."
}
} else if (gitInput == 'n' || gitInput == 'N') {
new File(newComponent, '.git').deleteDir()
println "Selected no, so git is not initialized\n"
println "Run the following to initialize git repository:\ncd runtime/component/${component} && git init && git add . && git commit -m 'Initial commit' && cd ../../.."
println "Run the following to push the git repository:\ncd runtime/component/${component} && git commit -m 'Initial commit' && git remote add origin git@github.com:yourgroup/${component} && git push && cd ../../.."
} else {
println "Invalid input. Try again"
newComponent.deleteDir()
Expand All @@ -969,14 +975,14 @@ task createComponent {
def myaddonsFile = file('myaddons.xml')
if (myaddonsFile.exists()){
// Iterate through myaddons file and delete the lines that are </addons>
def iterator = myaddonsFile.readLines().iterator()
// Read the lines from the file
def lines = myaddonsFile.readLines()

while (iterator.hasNext()) {
def line = iterator.next()
if (line.contains("</addons>")) {
iterator.remove()
}
}
// Filter out the lines that contain </addons>
def filteredLines = lines.findAll { !it.contains("</addons>") }

// Write the filtered lines back to the file
myaddonsFile.text = filteredLines.join('\n')
} else {
println "myaddons.xml not found. Creating one\nEnter repository github (g), github-ssh (GS), bitbucket (b), or bitbucket-ssh (bs)"
def repositoryInput = System.in.newReader().readLine()
Expand Down

0 comments on commit 7997a4f

Please sign in to comment.