Skip to content

Commit

Permalink
Added execOverrides and ignoreExitValue on npmSetupTask (fixes #196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sten Roger Sandvik committed Jun 14, 2017
1 parent 334d7d2 commit fb8f931
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Version 1.2.0 *(unreleased)*
* Bumped Gradle wrapper version to 3.4.1
* New args can be added for npmSetup and yarnSetup (#226)
* Uses --no-save for npmSetup and yarnSetup (#222)
* Added execOverrides and ignoreExitValue on npmSetupTask (#196)
* ...

Version 1.1.1 *(2017-01-16)*
Expand Down
20 changes: 16 additions & 4 deletions src/main/groovy/com/moowork/gradle/node/npm/NpmSetupTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class NpmSetupTask
{
public final static String NAME = 'npmSetup'

private NpmExecRunner runner

private NodeExtension config

protected List<?> args = []
Expand All @@ -30,6 +32,8 @@ class NpmSetupTask
this.group = 'Node'
this.description = 'Setup a specific version of npm to be used by the build.'
this.enabled = false

this.runner = new NpmExecRunner( this.project )
}

@Input
Expand Down Expand Up @@ -83,13 +87,21 @@ class NpmSetupTask
this.args = value.toList()
}

void setIgnoreExitValue( final boolean value )
{
this.runner.ignoreExitValue = value
}

void setExecOverrides( final Closure closure )
{
this.runner.execOverrides = closure
}

@TaskAction
void exec()
{
def runner = new NpmExecRunner( this.project )
runner.arguments.addAll( this.args )

this.result = runner.execute()
this.runner.arguments.addAll( this.args )
this.result = this.runner.execute()
}

void configureVersion( String npmVersion )
Expand Down

0 comments on commit fb8f931

Please sign in to comment.