Skip to content

Instantly share code, notes, and snippets.

View musketyr's full-sized avatar
🖥️
I may be slow to respond.

Vladimir Orany musketyr

🖥️
I may be slow to respond.
View GitHub Profile
@musketyr
musketyr / gaelyk-sample.groovy
Created March 25, 2011 14:12
How should be Gaelyk plugins defined in Gradle build
// since the missing task arguments, the plugins will be defined in gaelyk block
apply plugin: 'gaelyk'
gaelyk {
// during each build will be checked this plugins against installed and any missing
// will be installed automatically
apply git: 'https://github.com/bmuschko/gaelyk-datastore-viewer-plugin.git'
apply zip: 'path/to/zipped/plugin.zip'
// if I delete or comment some installed plugin, it will be uninstalled automatically
@musketyr
musketyr / build.gradle
Created April 1, 2011 20:49
How could be simply passed arguments to the Gradle build
task args
args.map = [:]
tasks.addRule("Pattern: <property>=<value>: Passes arguments to the scripts") { String taskName ->
def match = taskName =~ /(.*?)=(.*?$)/
if(match){
args.map[match[0][1]] = match[0][2]
task(taskName) << {
println "Used to pass value ${match[0][2]} to args.map.${match[0][1]}"
}
import java.util.concurrent.Future;
// Things to discuss
// # are there any ways how to promote dsls to templates like gtpl?
// # are there any ways to check operators like left shift?
// # is there any way to handle generics like Key<Entity>?
// # how to handle closure parameters?
class EnvDescriptor {
String name
import java.lang.reflect.Method;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import groovyx.gaelyk.GaelykCategory;
// scaffolds DSLD for category class to the system console
// setup
@musketyr
musketyr / gist:980544
Created May 19, 2011 11:13
shortcutFor pointcut
def shortcutFor = { type ->
currentType(type) &
enclosingScript(sourceFolderOfCurrentType('war/WEB-INF/groovy'))
}
shortcutFor('com.google.appengine.api.images.Image').accept {
provider = 'Gaelyk'
// contributions
}
@musketyr
musketyr / gist:980549
Created May 19, 2011 11:16
groovlets contributions
(sourceFolderOfCurrentType('war/WEB-INF/groovy') & enclosingScript()).accept {
provider = 'Gaelyk Groovlet'
property name: 'datastore',
type: 'com.google.appengine.api.datastore.DatastoreService'
// many more here
method name: 'forward',
type: 'void',
params: [path: 'java.lang.String'],
@musketyr
musketyr / gist:980550
Created May 19, 2011 11:17
image manipulations language
(enclosingCallName("transform") &
inClosure() &
enclosingCallDeclaringType('com.google.appengine.api.images.Image')).accept{
provider = 'Gaelyk'
method name: 'feeling',
type: 'com.google.appengine.api.images.Image',
params: [lucky: boolean],
doc: 'Applies the "I\'m feeling lucky" transformation.'
class GSQL {
static SelectBuilder select(Object... what){
SelectBuilder builder = []
if(All.ALL in what){
builder.all = true
} else {
builder.columns = what
}
builder
}
@Canonical
class QueryBuilder {
String spreadsheet
String worksheet
String query
String order
String contains
boolean all
@Canonical
class OrderBuilder{
QueryBuilder queryBuilder
QueryBuilder column(int position){
queryBuilder.order = '' + position
queryBuilder
}