Skip to content

Commit

Permalink
Fixed some stupid mistakes. Released 0.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sten Roger Sandvik committed Jan 10, 2014
1 parent 78159e4 commit fa59f0d
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Setup the plugin like this:
jcenter()
}
dependencies {
classpath 'com.moowork.gradle:gradle-node-plugin:0.2'
classpath 'com.moowork.gradle:gradle-node-plugin:0.3'
}
}

Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ buildscript {
}

apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'bintray'

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Current version
#
version = 0.3-SNAPSHOT
version = 0.3

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NodeExtension

NodeExtension( final Project project )
{
this.workDir = new File( project.buildDir, 'node' )
this.workDir = new File( project.gradle.gradleUserHomeDir, 'nodejs' )
}

static NodeExtension get( final Project project )
Expand Down
11 changes: 8 additions & 3 deletions src/main/groovy/com/moowork/gradle/node/exec/ExecRunner.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ abstract class ExecRunner
public ExecRunner( final Project project )
{
this.project = project
this.ext = NodeExtension.get( this.project )
this.variant = VariantBuilder.build( this.ext )
}

protected final ExecResult run( final String exec, final List<?> args )
Expand Down Expand Up @@ -54,5 +52,12 @@ abstract class ExecRunner
} )
}

public abstract ExecResult execute();
public final ExecResult execute()
{
this.ext = NodeExtension.get( this.project )
this.variant = VariantBuilder.build( this.ext )
return doExecute()
}

protected abstract ExecResult doExecute()
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ class NodeExecRunner
}

@Override
ExecResult execute()
protected ExecResult doExecute()
{
println( this.ext.workDir )


def exec = 'node'
if ( this.ext.download )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class NpmExecRunner
}

@Override
ExecResult execute()
protected ExecResult doExecute()
{
if ( !this.ext.download )
{
Expand Down
16 changes: 2 additions & 14 deletions src/main/groovy/com/moowork/gradle/node/task/NpmInstallTask.groovy
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.moowork.gradle.node.task

import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputDirectory

class NpmInstallTask
extends NpmTask
{
Expand All @@ -13,17 +10,8 @@ class NpmInstallTask
this.group = 'Node'
this.description = 'Install node packages from package.json.'
setArgs( ['install'] )
}

@InputFile
File getPackageJson()
{
return new File( this.project.getProjectDir(), 'package.json' )
}

@OutputDirectory
File getNodeModules()
{
return new File( this.project.getProjectDir(), 'node_modules' )
getInputs().file( new File( this.project.getProjectDir(), 'package.json' ) )
getOutputs().dir( new File( this.project.getProjectDir(), 'node_modules' ) )
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.moowork.gradle.node.NodeExtension
import com.moowork.gradle.node.variant.Variant
import com.moowork.gradle.node.variant.VariantBuilder
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction

class SetupTask
Expand All @@ -25,12 +24,8 @@ class SetupTask
this.variant = VariantBuilder.build( this.ext )

this.enabled = this.ext.download
}

@OutputDirectory
File getOutputDir()
{
return this.variant.nodeDir
getOutputs().dir( this.variant.nodeDir )
}

@TaskAction
Expand Down

0 comments on commit fa59f0d

Please sign in to comment.