Package org.exoplatform.crowdin.mojo
Class AbstractCrowdinMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.exoplatform.crowdin.mojo.AbstractCrowdinMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
DownloadTranslationsMojo,RestoreTranslationMojo,UpdateCrowdInMojo,UpdateSourcesMojo,UploadTranslationMojo
public abstract class AbstractCrowdinMojo
extends org.apache.maven.plugin.AbstractMojo
- Author:
- Philippe Aristote
-
Field Summary
FieldsFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidThe core method of the Mojo.protected voidprotected voidexecGit(File workingDirectory, String params, org.twdata.maven.mojoexecutor.MojoExecutor.Element... successCodes) voidexecute()org.apache.maven.execution.MavenSessionorg.apache.maven.plugin.BuildPluginManagerorg.apache.maven.project.MavenProjectThe Maven Project Objectprotected voidCreate parent directories of a fileprotected voidinitTranslations(CrowdinFile _master) A function that initializes translations of the master file given in parameter then upload these translations into Crowdin accordinglyprotected booleanbooleanisDryRun()booleanisForce()protected PropertiesloadProperties(String _propertiesFile) A convenience method to load properties fileprotected voidprepareAndUploadTranslation(String transName, CrowdinFile _master, File file, boolean autoApprovedImported) prepareCrowdinTranslation and uploadTranslationprotected StringprintFileContent(File file) voidsetTranslationsArchivePath(String translationsArchivePath) voidsetTranslationsRegistryFilePath(String translationsRegistryFilePath) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
DEFAULT_TRANSLATIONS_REGISTRY_FILE_PATH
- See Also:
-
crowdInArchive
-
-
Constructor Details
-
AbstractCrowdinMojo
public AbstractCrowdinMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
loadProperties
A convenience method to load properties file- Parameters:
_propertiesFile- the name/path of the file to load- Returns:
- the Properties file
- Throws:
IOException
-
crowdInMojoExecute
public abstract void crowdInMojoExecute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionThe core method of the Mojo. Has to be overriden in each concrete Mojo.- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getWorkingDir
-
isDryRun
public boolean isDryRun() -
isForce
public boolean isForce() -
getHelper
-
getFactory
-
getProjectId
-
getProjectKey
-
getTranslationsArchivePath
-
setTranslationsArchivePath
-
getTranslationsRegistryFilePath
-
setTranslationsRegistryFilePath
-
getLanguages
-
getApplyApprovedOnlyOption
-
getProject
public org.apache.maven.project.MavenProject getProject()The Maven Project Object -
getMavenSession
public org.apache.maven.execution.MavenSession getMavenSession() -
getPluginManager
public org.apache.maven.plugin.BuildPluginManager getPluginManager() -
getProperties
- Returns:
- The list of properties files that contain pointers to each file to manage with Crowdin
Format: project-name-version=path/to/file.properties
Example: cs-2.2.x=cs-2.2.x.properties
-
initDir
Create parent directories of a file- Parameters:
_filePath- the full path of the parent of that file
-
isAllPropertyFilesExisted
protected boolean isAllPropertyFilesExisted() -
initTranslations
A function that initializes translations of the master file given in parameter then upload these translations into Crowdin accordingly- Parameters:
_master- The master file of which translations will be detected and uploaded.
-
prepareAndUploadTranslation
protected void prepareAndUploadTranslation(String transName, CrowdinFile _master, File file, boolean autoApprovedImported) prepareCrowdinTranslation and uploadTranslation- Parameters:
transName-_master-file-
-
printFileContent
-
execGit
protected void execGit(File workingDirectory, String params) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
execGit
protected void execGit(File workingDirectory, String params, org.twdata.maven.mojoexecutor.MojoExecutor.Element... successCodes) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-