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
import spock.lang.Specification | |
class HeaderSpec extends Specification { | |
def "header characterization test"() { | |
when: | |
def proc = "pandoc header.md -o header.html".execute() | |
proc.waitFor() | |
then: | |
def result = new File("header.html").getText('UTF-8') | |
"" == result |
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
import spock.lang.Specification | |
class HeaderSpec extends Specification { | |
def "header characterization test"() { | |
when: | |
def proc = "pandoc header.md -o header.html".execute() | |
proc.waitFor() | |
then: | |
def result = new File("header.html").getText('UTF-8') | |
"""<h1 id="header-test">Header Test</h1> |
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
import spock.lang.Specification | |
class HeaderSpec extends Specification { | |
def "header characterization test"() { | |
when: | |
def proc = "pandoc header.md -o header.html".execute() | |
proc.waitFor() | |
then: | |
def result = new File("header.html").getText('UTF-8') | |
"""<h1 id="header-test">Header Test</h1> |
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
def reader = new File('in.txt').newReader('UTF-8') | |
def writer = new File('out.txt').newWriter('UTF-8') | |
reader.eachLine{ | |
println it | |
writer.writeLine(it) | |
} | |
writer.close() |
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
task readPassword << { | |
// Get password from user input. | |
def console = System.console() | |
console.writer().write "\n" | |
def password = console.readPassword('%s: ', 'Please enter the password') | |
println password | |
} |
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
apply plugin: 'groovy' | |
apply plugin: 'eclipse' | |
task mkdirs << { | |
sourceSets.all { | |
it.groovy.srcDirs.each { it.mkdirs() } | |
it.resources.srcDirs.each { it.mkdirs() } | |
} | |
} |
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
apply plugin: 'java' | |
apply plugin: 'eclipse' | |
dependencies { compile 'commons-lang:commons-lang:2.6' } | |
repositories { | |
// Maven central repository | |
mavenCentral() | |
// local repository |
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
defaultTasks 'dbsetting' | |
def envList = ['dev', 'qa', 'prod'] | |
if (!hasProperty('env')) { | |
ext.env = System.env['GRADLE_ENV'] ?: envList[0] | |
} | |
if(!envList.find{it == ext.env}){ | |
throw new Exception("There is no environment named '$ext.env'") |
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
apply plugin: 'java' | |
apply plugin: 'maven' | |
// If archivesBaseName is not specified, the project name is used for name | |
archivesBaseName = 'myapp' | |
group = 'com.mycompany.app' | |
version ='0.1' | |
uploadArchives { | |
repositories { |
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
task hello (type: GreetingTask){ | |
} | |
task hi (type: GreetingTask){ | |
greeting = 'Hi' | |
} | |
class GreetingTask extends DefaultTask { | |
def greeting = 'Hello' | |
@TaskAction |
OlderNewer