Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn rather than fail when git repository does not exist or has no in…
…itial commit
- Loading branch information
1 parent
69d8642
commit 40813ac
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/integTest/groovy/nebula/plugin/release/ReleasePluginNewProjectIntegrationSpec.groovy
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package nebula.plugin.release | ||
import nebula.test.IntegrationSpec | ||
import org.ajoberstar.grgit.Grgit | ||
import org.gradle.api.plugins.JavaPlugin | ||
/** | ||
* Verify the behavior of nebula-release under various states for a new project (e.g. no git repo yet initialized, no | ||
* initial commit) | ||
*/ | ||
class ReleasePluginNewProjectIntegrationSpec extends IntegrationSpec { | ||
def 'release tasks unavailable when no git repository has been initialized'() { | ||
when: | ||
buildFile << """ | ||
${applyPlugin(ReleasePlugin)} | ||
${applyPlugin(JavaPlugin)} | ||
""" | ||
|
||
then: | ||
runTasksSuccessfully('build') | ||
runTasksWithFailure('snapshot') | ||
} | ||
|
||
def 'release tasks unavailable when git repository has no commits'() { | ||
setup: // equivalent of having completed `git init` but no initial commit | ||
def origin = new File(projectDir.parent, "${projectDir.name}.git") | ||
origin.mkdirs() | ||
Grgit.init(dir: origin) | ||
|
||
when: | ||
buildFile << """ | ||
${applyPlugin(ReleasePlugin)} | ||
${applyPlugin(JavaPlugin)} | ||
""" | ||
|
||
then: | ||
runTasksSuccessfully('build') | ||
runTasksWithFailure('snapshot') | ||
} | ||
} |
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