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
new File('.').eachFileRecurse(groovy.io.FileType.FILES) { | |
if (it.name.endsWith(".java")) { | |
def hits = it.text =~ /\/\/\s*DROP\s*\[\s*(.*)\s*\]\n/ | |
hits.each { match, key -> | |
def dropConditionForAGivenKey = dropConditions[(key)] | |
if (!dropConditionForAGivenKey) { | |
println("<!> Cannot find drop conditions for key '$key'") | |
return | |
} | |
try { |
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
Map dropConditions = [ | |
new_do_stuff_toggled : { cfg("new_do_stuff.enabled") == "true" }, | |
marketing_campaign_finished : { timeCame "09/04/2014" } | |
] | |
def timeCame(String date) { | |
def today = new Date() | |
def expirationDate = new Date().parse('dd/MM/yyyy', date) | |
today.after expirationDate | |
} |
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
pattern = ~/.*---(.*)$/ | |
def droppables = [] | |
manager.build.logFile.eachLine { line -> | |
matcher = pattern.matcher(line) | |
if(matcher.matches()) { | |
droppables << matcher.group(1) | |
} | |
} | |
pattern = ~/.*<!>(.*)$/ |
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 groovyx.net.http.HTTPBuilder | |
import groovyx.net.http.HttpResponseException | |
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.2') | |
version = args[0] | |
if (!version) { | |
throw new IllegalArgumentException("No version specified") | |
} | |
archive = "askfm-node-$version-docker.zip" | |
host = 'http://172.16.0.2:8081' |
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
package fm.ask.components.counter; | |
import static org.joda.time.Duration.standardDays; | |
import org.joda.time.Duration; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import com.rubylight.conf.IConfProperty; |
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
package fm.ask.components.counter; | |
import static org.joda.time.Duration.standardDays; | |
import org.joda.time.Duration; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import com.rubylight.conf.ConfFacade; |
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
@Retention(RetentionPolicy.RUNTIME) | |
@Target([ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER]) | |
@BindingAnnotation | |
@AutoBind | |
@interface MySQL { | |
String databaseName() | |
} |
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
String[] tokenize(String tokenizable) { | |
if (tokenizable == null || tokenizable.isEmpty()) { | |
return null; | |
} | |
tokenize ... | |
} |
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 "returns null if there is nothing to tokenize"() { | |
expect: | |
tokenizer.tokenize(tokenizable) == result | |
where: | |
tokenizable || result | |
null || null | |
"" || null | |
} |
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
String[] printingTokenizer(String tokenizable) { | |
String[] tokens = tokenizer(tokenizable); | |
if (tokens != null) {tokens.each(System::out::println) } | |
return tokens; | |
} |