Package com.mooltiverse.oss.nyx.command
Class Mark
- java.lang.Object
-
- com.mooltiverse.oss.nyx.command.AbstractCommand
-
- com.mooltiverse.oss.nyx.command.Mark
-
- All Implemented Interfaces:
Command
public class Mark extends AbstractCommand
The Mark command takes care of tagging and committing into the Git repository. This class is not meant to be used in multi-threaded environments.
-
-
Constructor Summary
Constructors Constructor Description Mark(State state, Repository repository)Standard constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisUpToDate()Returnstrueif this command is up to date, which means that the internal state (Command.state()) would not change by running (Command.run()) the command again.Staterun()Commits pending changes to the Git repository, applies a release tags and pushes changes to remotes.-
Methods inherited from class com.mooltiverse.oss.nyx.command.AbstractCommand
getLatestCommit, isRepositoryClean, repository, state
-
-
-
-
Constructor Detail
-
Mark
public Mark(State state, Repository repository)
Standard constructor.- Parameters:
state- the state referencerepository- the repository reference- Throws:
NullPointerException- if a given argument isnull
-
-
Method Detail
-
isUpToDate
public boolean isUpToDate() throws DataAccessException, IllegalPropertyException, GitExceptionReturnstrueif this command is up to date, which means that the internal state (Command.state()) would not change by running (Command.run()) the command again. It other words, when this method returnstrueany invocation of the (Command.run()) method is needless and idempotent about the state. This method uses the quickest method to verify whether the state is up to date or not. This method must not rely on dependencies and it must always evaluate its own status independently.- Returns:
trueif this command is up to date- Throws:
DataAccessException- in case the configuration can't be loaded for some reason.IllegalPropertyException- in case the configuration has some illegal options.GitException- in case of unexpected issues when accessing the Git repository.- See Also:
Command.state(),Command.run()
-
run
public State run() throws DataAccessException, IllegalPropertyException, GitException, ReleaseException
Commits pending changes to the Git repository, applies a release tags and pushes changes to remotes.
Inputs to this task are:
- the Git repository and the commit history;
- thereleaseScope/initialCommitwith the SHA-1 of the initial commit in the release scope; ifnullthis task just exits taking no act -releaseScope/significant, whentruethe release scope contains significant commits (commits whose messages bring informations about new versions) and this task creates a new tag and, optionally, a commit. When this isfalseand thereleaseScope/initialCommitisnullthis task just exits taking no actions; if this isfalsebutreleaseScope/initialCommitis notnullthereleaseScope/finalCommitis set to the latest commit in the current branch
Outputs from this task are all stored in the State object, with more detail:
- thereleaseScope/finalCommitis defined with the SHA-1 of the last commit, which may be a new commit created by this task (if pending changes are found and if configured to do so) or the most recent commit that in the current branch; if the user overrides the version by configuration this value remainsnull- Returns:
- the updated reference to the state object. The returned object is the same instance passed in the constructor.
- Throws:
DataAccessException- in case the configuration can't be loaded for some reason.IllegalPropertyException- in case the configuration has some illegal options.GitException- in case of unexpected issues when accessing the Git repository.ReleaseException- if the task is unable to complete for reasons due to the release process.- See Also:
isUpToDate(),AbstractCommand.state()
-
-