-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #265 from fundacionjala/develop
version 1.1.4
- Loading branch information
Showing
41 changed files
with
246 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,50 @@ | ||
## 1.1.4 - 2015-11-04 | ||
|
||
### Features | ||
|
||
* Add 'location' parameter to shows credentials from home directory and project directory | ||
|
||
This can be used as: | ||
|
||
>$ gradle showCredentials | ||
:showCredentials | ||
********************************************* | ||
Credentials | ||
********************************************* | ||
Id : iterum | ||
User name : [email protected] | ||
Type : Production/Developer | ||
|
||
Id : test | ||
User name : [email protected] | ||
Type : dev (Specified) | ||
|
||
********************************************* | ||
Those credentials are located at /home/user_directory/credentials.dat | ||
|
||
>$ gradle showCredentials -Plocation=project | ||
:showCredentials | ||
********************************************* | ||
Credentials | ||
********************************************* | ||
Id : myId | ||
User name : [email protected] | ||
Type : jeje (Specified) | ||
|
||
Id : demo | ||
User name : [email protected] | ||
Type : Production/Developer | ||
|
||
********************************************* | ||
Those credentials are located at /home/user_directory/project_directory/credentials.dat | ||
|
||
### Enhancements | ||
|
||
* Support new components called lightning. | ||
|
||
|
||
## 1.1.3 - 2015-10-19 | ||
|
||
### Features | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
package org.fundacionjala.gradle.plugins.enforce.tasks.credentialmanager | ||
|
||
import org.fundacionjala.gradle.plugins.enforce.credentialmanagement.CredentialFileManager | ||
import org.fundacionjala.gradle.plugins.enforce.credentialmanagement.CredentialManager | ||
import org.fundacionjala.gradle.plugins.enforce.credentialmanagement.CredentialManagerInput | ||
import org.fundacionjala.gradle.plugins.enforce.credentialmanagement.CredentialMessage | ||
import org.fundacionjala.gradle.plugins.enforce.utils.Constants | ||
import org.fundacionjala.gradle.plugins.enforce.wsc.Credential | ||
|
||
/** | ||
* Gives all credentials registered on Enforce. | ||
*/ | ||
class CredentialGiver extends CredentialManagerTask { | ||
|
||
private CredentialFileManager credentialFileManager | ||
private final String PROJECT_OPTION = 'project' | ||
private final String CREDENTIAL_LOCATION_INFO = 'Those credentials are located at' | ||
private final String WARNING_TAG = "[Warning]" | ||
private final String WARNING_MESSAGE = "doesn't exist, \nYou should add credential here using parameter location: " + | ||
"\n\t${'$'}gradle addCredential -Pid=my [email protected] -Ppassword=qweasd456fgh -Plocation=" | ||
/** | ||
* Sets description and group task | ||
* @param description is description tasks | ||
|
@@ -21,18 +27,29 @@ class CredentialGiver extends CredentialManagerTask { | |
|
||
@Override | ||
void runTask() { | ||
CredentialManager credentialManager = new CredentialManager() | ||
CredentialFileManager credentialFileManager = new CredentialFileManager(credentialManager.pathCredentials,''); | ||
String credentialsFilePath = getCredentialsFilePath() | ||
if (!new File(credentialsFilePath).exists()) { | ||
throw new Exception("${WARNING_TAG} ${credentialsFilePath} ${WARNING_MESSAGE}${location}") | ||
} | ||
credentialFileManager = new CredentialFileManager(credentialsFilePath, Constants.EMPTY) | ||
showCredentials() | ||
} | ||
|
||
/** | ||
* Shows credentials from home or project directory | ||
*/ | ||
private void showCredentials() { | ||
logger.quiet("*********************************************") | ||
logger.quiet(" Credentials ") | ||
logger.quiet("*********************************************") | ||
for (Credential credential in credentialFileManager.getCredentials()) { | ||
logger.quiet("") | ||
logger.quiet("Id : $credential.id") | ||
logger.quiet("User name : $credential.username") | ||
logger.quiet("Type : ${getOrganizationType(credential.loginFormat)}") | ||
logger.quiet("") | ||
} | ||
logger.quiet("*********************************************") | ||
logger.quiet("${CREDENTIAL_LOCATION_INFO} ${getCredentialsFilePath()}") | ||
} | ||
|
||
/** | ||
|
@@ -41,17 +58,29 @@ class CredentialGiver extends CredentialManagerTask { | |
* @return a friendly message that represents credential type. | ||
*/ | ||
private String getOrganizationType(String loginFormat) { | ||
String enviorement | ||
String environment | ||
switch (loginFormat) { | ||
case CredentialMessage.LOGIN.value(): | ||
enviorement = CredentialMessage.DEVELOPER_ENVIRONMENT.value() | ||
environment = CredentialMessage.DEVELOPER_ENVIRONMENT.value() | ||
break | ||
case CredentialMessage.TEST.value(): | ||
enviorement = CredentialMessage.TEST_ENVIRONMENT.value() | ||
environment = CredentialMessage.TEST_ENVIRONMENT.value() | ||
break | ||
default: | ||
enviorement = "$loginFormat ${CredentialMessage.OTHER_ENVIRONMENT.value()}" | ||
environment = "$loginFormat ${CredentialMessage.OTHER_ENVIRONMENT.value()}" | ||
} | ||
return environment | ||
} | ||
|
||
/** | ||
* Gets the path of credentials.dat file, by default it gets home directory | ||
* @return the path of credentials.dat file | ||
*/ | ||
private String getCredentialsFilePath() { | ||
String credentialsFilePath = CredentialManagerInput.HOME_PATH | ||
if (location == PROJECT_OPTION) { | ||
credentialsFilePath = CredentialManagerInput.PROJECT_PATH | ||
} | ||
return enviorement | ||
return credentialsFilePath | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.