Skip to content

Commit

Permalink
Added support for Groovy 3 version
Browse files Browse the repository at this point in the history
  • Loading branch information
Garlapati Anil Masthan Setty committed Nov 18, 2024
1 parent 1bcfbdd commit dff7b6b
Show file tree
Hide file tree
Showing 17 changed files with 129 additions and 27 deletions.
83 changes: 83 additions & 0 deletions src/main/groovy/com/urbancode/air/plugin/tool/AirPluginTool.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.urbancode.air.plugin.tool

/**
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/


class AirPluginTool {

//**************************************************************************
// CLASS
//**************************************************************************

//**************************************************************************
// INSTANCE
//**************************************************************************

final public def isWindows = (System.getProperty('os.name') =~ /(?i)windows/).find()

def out = System.out;
def err = System.err;

private def inPropsFile;
private def outPropsFile;

def outProps;

public AirPluginTool(def inFile, def outFile){
inPropsFile = inFile;
outPropsFile = outFile;
outProps = new Properties();
}

public Properties getStepProperties() {
def props = new Properties();
def inputPropsFile = this.inPropsFile;
def inputPropsStream = null;
try {
inputPropsStream = new FileInputStream(inputPropsFile);
props.load(inputPropsStream);
}
catch (IOException e) {
throw new RuntimeException(e);
}
finally {
inputPropsStream.close();
}
return props;
}

public void setOutputProperty(String name, String value) {
this.outProps.setProperty(name, value);
}

public void setOutputProperties() {
OutputStream outputPropsStream = null;
try {
outputPropsStream = new FileOutputStream(this.outPropsFile);
outProps.store(outputPropsStream, "");
}
finally {
if (outputPropsStream != null) {
outputPropsStream.close();
}
}
}

public String getAuthToken() {
String authToken = System.getenv("AUTH_TOKEN");
return "{\"token\" : \"" + authToken + "\"}";
}

public String getAuthTokenUsername() {
return "PasswordIsAuthToken";
}

public void storeOutputProperties() {
setOutputProperties();
}
}
5 changes: 3 additions & 2 deletions src/main/zip/apt.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/apt_key.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/ashell.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/command.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
6 changes: 4 additions & 2 deletions src/main/zip/copy.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
*
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/file.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/getBuiltinAnsibleProperties.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/get_url.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
3 changes: 3 additions & 0 deletions src/main/zip/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,8 @@
<release-note plugin-version="53">
The Ansible Toolkit is now built through Gradle. All Ant and Ivy build pieces have been removed.
</release-note>
<release-note plugin-version="54">
Added support for Groovy 3 version
</release-note>
</release-notes>
</pluginInfo>
5 changes: 3 additions & 2 deletions src/main/zip/lineinfile.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/pip.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
2 changes: 1 addition & 1 deletion src/main/zip/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<header>
<identifier id="com.urbancode.air.plugin.AnsibleToolkit" name="AnsibleToolkit" version="53"/>
<identifier id="com.urbancode.air.plugin.AnsibleToolkit" name="AnsibleToolkit" version="54"/>
<description>
This plug-in includes steps that integrate with Ansible.
</description>
Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/service.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/shell.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
5 changes: 3 additions & 2 deletions src/main/zip/unarchive.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.urbancode.air.plugin.tool.AirPluginTool

/**
* © Copyright IBM Corporation 2016, 2017.
* © Copyright IBM Corporation 2016, 2024.
* This is licensed under the following license.
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

import com.urbancode.air.AirPluginTool;

def apTool = new AirPluginTool(this.args[0], this.args[1]) //assuming that args[0] is input props file and args[1] is output props file

Expand Down
2 changes: 2 additions & 0 deletions src/main/zip/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@
</migrate>
<migrate to-version="53">
</migrate>
<migrate to-version="54">
</migrate>
</plugin-upgrade>

0 comments on commit dff7b6b

Please sign in to comment.