Last active
July 5, 2024 18:24
-
-
Save Joxebus/6ba83b3aab0c5498daf990b9ede10b19 to your computer and use it in GitHub Desktop.
Revisions
-
Joxebus revised this gist
Jan 31, 2021 . 6 changed files with 71 additions and 95 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,20 +3,17 @@ import groovy.yaml.YamlSlurper def slurper = new YamlSlurper() def configuration = ''' version: 3.0 environment: "dev" context: path: "/test" endpoints: url: "/people" operations: POST: "create" GET: "list or get" PUT: "/update" DELETE: "delete" ''' def yaml = slurper.parseText(configuration) This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,53 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ import groovy.yaml.YamlBuilder def yaml = new YamlBuilder() yaml { version 3.0 environment "dev" context { path "/test" } endpoints { url "/people" operations ("POST":"create", "GET":"list or get", "PUT":"update", "DELETE":"delete") } } println yaml This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,28 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ import groovy.yaml.YamlBuilder Map configuration = [ version : 3.0, environment : "dev", context : [path:"/test"], endpoints : [url:"/people", operations: [POST:"create", GET:"list or get", PUT:"update", DELETE:"delete"] ] ] def yaml = new YamlBuilder() yaml(configuration) println yaml This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ import groovy.yaml.YamlBuilder class Configuration { BigDecimal version String environment Map context Map endpoints } def configuration = new Configuration() configuration.with{ version = 3.0 environment = "dev" context = [path:"/test"] endpoints = [url:"/people", operations: [POST:"create", GET:"list or get", PUT:"update", DELETE:"delete"] ] } def yaml = new YamlBuilder() yaml(configuration) println yaml -
Joxebus revised this gist
Jan 18, 2021 . 4 changed files with 81 additions and 1 deletion.There are no files selected for viewing
File renamed without changes.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ import groovy.yaml.* import groovy.transform.* @Canonical class Service { String image String containerName List environment List ports List volumes } String dockerCompose = """ version: '3' services: postgres: image: postgres:11.5 containerName: postgresdb environment: - POSTGRES_USER=mses - POSTGRES_PASSWORD=t3cM0n - POSTGRES_DB=mses ports: - '5432:5432' volumes: - ./postgres-data:/var/lib/postgresql/data redis: containerName: mses-redis image: 'bitnami/redis:5.0' environment: # ALLOW_EMPTY_PASSWORD is recommended only for development. - ALLOW_EMPTY_PASSWORD=yes - REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL ports: - 6379:6379 volumes: - 'redis_data:/bitnami/redis/data' volumes: redis_data: driver: local """ def config = new YamlSlurper().parseText(dockerCompose) Service postgres = new Service(config.services.postgres) Service redis = new Service(config.services.redis) println postgres println redis This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ import groovy.yaml.* import groovy.transform.* @Canonical class Service { String image String containerName List environment List ports List volumes } Map configuration = [ version: '3', services: [ postgres : new Service("postgres:11.5", "postgresdb"), redis : new Service("bitnami/redis:5.0", "redisdb") ], volumes: [ redis_data: [driver:'local'] ] ] def yaml = new YamlBuilder() yaml(configuration) println yaml This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +0,0 @@ -
Joxebus created this gist
Dec 19, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ kjhasdf This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ import groovy.yaml.YamlSlurper def slurper = new YamlSlurper() def configuration = ''' language: groovy sudo: required dist: trusty matrix: include: # - jdk: oraclejdk11 - jdk: openjdk10 - jdk: oraclejdk9 - jdk: oraclejdk8 before_script: - | unset _JAVA_OPTIONS ''' def yaml = slurper.parseText(configuration) println "YAML keys: ${yaml.keySet()}" yaml.keySet().each { key -> println "Key: $key \t Type: ${yaml[key].getClass().name}" }