Skip to content

Commit

Permalink
Merge pull request #2 from AzBuilder/macos-support
Browse files Browse the repository at this point in the history
Add support for macOS in TerraformDownloader class
  • Loading branch information
alfespa17 authored Jul 3, 2021
2 parents 5d3f9c2 + 7a06abd commit d947a37
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Simply add the following dependency to your project's `pom.xml` will enable you
<dependency>
<groupId>org.azbuilder.terraform</groupId>
<artifactId>terraform-client</artifactId>
<version>0.2.1</version>
<version>0.3.0</version>
</dependency>
```

Expand Down Expand Up @@ -81,7 +81,7 @@ Let's still use the terraform file `storage.tf` under `/some/local/path/` folder
<dependency>
<groupId>org.azbuilder.terraform</groupId>
<artifactId>terraform-spring-boot-starter</artifactId>
<version>0.2.1</version>
<version>0.3.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0.2.1</revision>
<revision>0.3.0</revision>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

Expand Down
9 changes: 8 additions & 1 deletion terraform-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0.2.1</revision>
<revision>0.3.0</revision>
<maven.deploy.skip>false</maven.deploy.skip>
<okhttp.version>4.9.1</okhttp.version>
<commons-io.version>2.8.0</commons-io.version>
<maven-artifact.version>3.8.1</maven-artifact.version>
<lombok.version>1.18.20</lombok.version>
</properties>

<licenses>
Expand Down Expand Up @@ -111,6 +112,12 @@
<version>${maven-artifact.version}</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);
}
Expand Down
10 changes: 9 additions & 1 deletion terraform-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0.2.1</revision>
<revision>0.3.0</revision>
<maven.deploy.skip>false</maven.deploy.skip>
<lombok.version>1.18.20</lombok.version>
</properties>

<licenses>
Expand Down Expand Up @@ -84,5 +85,12 @@
<artifactId>terraform-client</artifactId>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion terraform-spring-boot-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0.2.1</revision>
<revision>0.3.0</revision>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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");
}
}
2 changes: 1 addition & 1 deletion terraform-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0.2.1</revision>
<revision>0.3.0</revision>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>

Expand Down

0 comments on commit d947a37

Please sign in to comment.