Skip to content

Commit

Permalink
got a working clone
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandunn committed Mar 15, 2016
1 parent 401ffb2 commit 843932b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 53 deletions.
86 changes: 36 additions & 50 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//import org.ajoberstar.grgit.*
//import org.ajoberstar.gradle.git.tasks.*
import org.ajoberstar.grgit.*

/*
* This build file was auto generated by running the Gradle 'init' task
Expand All @@ -9,18 +8,15 @@
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/2.11/userguide/tutorial_java_projects.html
*/
ant.importBuild 'build.xml'

// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'idea'

//buildscript {
// repositories { mavenCentral() }
// dependencies { classpath 'org.ajoberstar:gradle-git:1.4.2' }
//}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.4.2'
}
}

// In this section you declare where to find the dependencies of your project
repositories {
Expand All @@ -29,6 +25,16 @@ repositories {
jcenter()
}


ant.importBuild 'build.xml'

// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'idea'
//apply plugin: "de.qaware.seu.as.code.git"

// In this section you declare the dependencies for your production and test code
dependencies {
// The production code uses the SLF4J logging API at compile time
Expand All @@ -47,6 +53,18 @@ def jbrowsePlugins
def pluginsDirectory = "jbrowse-download/plugins"
def currentPlugin


task cloneTask(type: CloneTask)

class CloneTask extends DefaultTask {

@TaskAction
def clone() {
def grgit = Grgit.clone(dir: 'asdf', uri: 'https://github.com/GMOD/myvariantviewer')
}
}


task evaluateJBrowseConfigs {
// gradle read in Config.groovy
def config = new ConfigSlurper().parse(new File("grails-app/conf/Config.groovy").toURI().toURL())
Expand Down Expand Up @@ -82,37 +100,12 @@ task installJBrowse(dependsOn: "setup-jbrowse") << {

task setupJBrowse(dependsOn: "setup-jbrowse") << {}

//task cloneGitRepo(type: GitClone) {
// def destination = file("abcd")
// uri = "https://github.org/GMOD/myvariantviewer"
// destinationPath = destination
// bare = false
// enabled = !destination.exists() //to clone only once
//}

task cloneGitExec(type: Exec) {
onlyIf { Task task ->
println "TRYING TO CLOEN ${currentPlugin}"
workingDir "jbrowse-download/plugins/${currentPlugin.key}"

println "CLONNING "
// execCommand "git"
commandLine "git", "clone", currentPlugin.value.git
println "CLONED ABC"
standardOutput = new ByteArrayOutputStream()
println "STARNDARD OUTPUT ${standardOutput}"
return currentPlugin != null
}
}


task installJBrowsePlugins << {
println "installing jbrowse plugins ${jbrowsePlugins}"

for (plugin in jbrowsePlugins) {
currentPlugin = plugin
println "KEY ${plugin.key}"
println "GIT ${plugin.value}"
def path = pluginsDirectory + "/" + plugin.key
def pluginExists = confirmPlugin(path)
if (plugin.value.included == true) {
Expand All @@ -129,20 +122,12 @@ task installJBrowsePlugins << {
println "git checkout proper directory"
} else {
println "git clone to the proper directory"
// def grgit = Grgit.clone(dir: pluginsDirectory, uri: '[email protected]:ajoberstar/grgit.git')
println "cloning from ${plugin.value.git} into ${path}"
currentPlugin = plugin
// tasks["cloneGitExec"].execute()
if (currentPlugin) {
cloneGitExec.execute()
File testFile = new File(".")
"/usr/bin/git clone ${plugin.value.git}".execute(null,testFile)
}
println "current plugin ${currentPlugin}"
println "attemptping to clone from '${plugin.value.git}' into '${path}'"
def grgit = Grgit.clone(dir: path , uri: plugin.value.git)
println "CLONED from ${plugin.value.git} into ${path}"

// def grgit = Grgit.clone(dir: path, uri: plugin.value.git)
// def grgit = Grgit.clone(dir: "ASdf", uri: plugin.value.git)
// ["git","clone",plugin.value.git].execute()
}
} else if (plugin.value.url == true) {
if (!pluginExists) {
Expand All @@ -163,4 +148,5 @@ task handleJBrowse(dependsOn: ['evaluateJBrowseConfigs', 'installJBrowse', 'inst
def confirmPlugin(String path) {
File file = new File(path)
return file.exists() && file.isDirectory() && file.canRead()
}
}

4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Mar 14 12:08:11 PDT 2016
#Mon Mar 14 22:13:59 PDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
2 changes: 1 addition & 1 deletion grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ jbrowse {
included = true
}
MyVariantInfo {
git = 'https://github.org/GMOD/myvariantviewer'
git = 'https://github.com/GMOD/myvariantviewer'
// git = '[email protected]:GMOD/myvariantviewer.git'
branch = 'master'
alwaysRecheck = "true"
Expand Down

0 comments on commit 843932b

Please sign in to comment.