From 7a06abd56e88b4e99b9cbb509fa6de000d31ecc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfredo=20Espa=C3=B1a?= Date: Sat, 3 Jul 2021 10:17:46 -0600 Subject: [PATCH] Add support for macOS in TerraformDownloader class --- README.md | 4 ++-- pom.xml | 2 +- terraform-client/pom.xml | 9 ++++++++- .../org/azbuilder/terraform/TerraformDownloader.java | 8 ++++++-- terraform-spring-boot-autoconfigure/pom.xml | 10 +++++++++- terraform-spring-boot-samples/pom.xml | 2 +- .../org/azbuilder/samples/SpringStarterSampleTest.java | 3 +++ terraform-spring-boot-starter/pom.xml | 2 +- 8 files changed, 31 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3351d71..f7077be 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Simply add the following dependency to your project's `pom.xml` will enable you org.azbuilder.terraform terraform-client - 0.2.1 + 0.3.0 ``` @@ -81,7 +81,7 @@ Let's still use the terraform file `storage.tf` under `/some/local/path/` folder org.azbuilder.terraform terraform-spring-boot-starter - 0.2.1 + 0.3.0 ``` diff --git a/pom.xml b/pom.xml index b535e73..9f15d53 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ UTF-8 - 0.2.1 + 0.3.0 true diff --git a/terraform-client/pom.xml b/terraform-client/pom.xml index f019267..7e0d4be 100644 --- a/terraform-client/pom.xml +++ b/terraform-client/pom.xml @@ -19,11 +19,12 @@ UTF-8 - 0.2.1 + 0.3.0 false 4.9.1 2.8.0 3.8.1 + 1.18.20 @@ -111,6 +112,12 @@ ${maven-artifact.version} + + org.projectlombok + lombok + ${lombok.version} + provided + diff --git a/terraform-client/src/main/java/org/azbuilder/terraform/TerraformDownloader.java b/terraform-client/src/main/java/org/azbuilder/terraform/TerraformDownloader.java index 9f29fc4..4b6383f 100644 --- a/terraform-client/src/main/java/org/azbuilder/terraform/TerraformDownloader.java +++ b/terraform-client/src/main/java/org/azbuilder/terraform/TerraformDownloader.java @@ -85,7 +85,11 @@ public String downloadTerraformVersion(String terraformVersion) throws IOExcepti String terraformFilePath = ""; if (version != null) { for (TerraformBuild terraformBuild : version.getBuilds()) { - if (terraformBuild.getArch().equals(SystemUtils.OS_ARCH) && (SystemUtils.IS_OS_WINDOWS && terraformBuild.getOs().equals("windows") || SystemUtils.IS_OS_LINUX && terraformBuild.getOs().equals("linux"))) { + if (terraformBuild.getArch().equals(SystemUtils.OS_ARCH) && ( + SystemUtils.IS_OS_WINDOWS && terraformBuild.getOs().equals("windows") || + SystemUtils.IS_OS_LINUX && terraformBuild.getOs().equals("linux")) || + SystemUtils.IS_OS_MAC && terraformBuild.getOs().equals("darwin") + ) { String terraformZipReleaseURL = terraformBuild.getUrl(); String fileName = terraformBuild.getFilename(); @@ -172,7 +176,7 @@ private String unzipTerraformVersion(String terraformVersion, File terraformZipF } fos.close(); - if(SystemUtils.IS_OS_LINUX){ + if(SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC){ File updateAccess = new File(newFilePath); updateAccess.setExecutable(true,true); } diff --git a/terraform-spring-boot-autoconfigure/pom.xml b/terraform-spring-boot-autoconfigure/pom.xml index ef806a8..4f0fc67 100644 --- a/terraform-spring-boot-autoconfigure/pom.xml +++ b/terraform-spring-boot-autoconfigure/pom.xml @@ -18,8 +18,9 @@ UTF-8 - 0.2.1 + 0.3.0 false + 1.18.20 @@ -84,5 +85,12 @@ terraform-client ${revision} + + + org.projectlombok + lombok + ${lombok.version} + provided + diff --git a/terraform-spring-boot-samples/pom.xml b/terraform-spring-boot-samples/pom.xml index ea12e43..0160d1c 100644 --- a/terraform-spring-boot-samples/pom.xml +++ b/terraform-spring-boot-samples/pom.xml @@ -18,7 +18,7 @@ UTF-8 - 0.2.1 + 0.3.0 true diff --git a/terraform-spring-boot-samples/spring-starter-sample/src/test/java/org/azbuilder/samples/SpringStarterSampleTest.java b/terraform-spring-boot-samples/spring-starter-sample/src/test/java/org/azbuilder/samples/SpringStarterSampleTest.java index bc8307a..43bed5c 100644 --- a/terraform-spring-boot-samples/spring-starter-sample/src/test/java/org/azbuilder/samples/SpringStarterSampleTest.java +++ b/terraform-spring-boot-samples/spring-starter-sample/src/test/java/org/azbuilder/samples/SpringStarterSampleTest.java @@ -1,6 +1,7 @@ package org.azbuilder.samples; import org.azbuilder.terraform.TerraformClient; +import org.azbuilder.terraform.TerraformDownloader; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -18,5 +19,7 @@ public class SpringStarterSampleTest { @Test void contextLoads() throws IOException, ExecutionException, InterruptedException { Assert.notNull(terraformClient,"TerraformClient is null"); + //TerraformDownloader terraformDownloader = new TerraformDownloader(); + //terraformDownloader.downloadTerraformVersion("0.15.0"); } } diff --git a/terraform-spring-boot-starter/pom.xml b/terraform-spring-boot-starter/pom.xml index 6397d41..0dc2c06 100644 --- a/terraform-spring-boot-starter/pom.xml +++ b/terraform-spring-boot-starter/pom.xml @@ -13,7 +13,7 @@ UTF-8 - 0.2.1 + 0.3.0 false