├── docs ├── poi-package-list └── dokka │ ├── poink │ ├── package-list │ ├── index.html │ ├── com.github.nwillc.poink │ │ ├── -poink-dsl │ │ │ ├── -init-.html │ │ │ └── index.html │ │ ├── -p-workbook │ │ │ ├── write.html │ │ │ ├── -init-.html │ │ │ ├── cell-style.html │ │ │ ├── sheet.html │ │ │ └── index.html │ │ ├── -p-sheet │ │ │ ├── -init-.html │ │ │ ├── row.html │ │ │ └── index.html │ │ ├── workbook.html │ │ └── index.html │ ├── alltypes │ │ └── index.html │ └── index-outline.html │ └── style.css ├── gradle.properties ├── settings.gradle.kts ├── poink.png ├── src ├── test │ ├── resources │ │ └── test.xlsx │ └── kotlin │ │ └── com │ │ └── github │ │ └── nwillc │ │ └── poink │ │ ├── PoinkTest.kt │ │ └── PWorkbookTest.kt └── main │ └── kotlin │ └── com │ └── github │ └── nwillc │ └── poink │ ├── PoinkDsl.kt │ ├── PWorkbook.kt │ └── PSheet.kt ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .editorConfig ├── .github └── workflows │ └── cicd.yml ├── LICENSE.md ├── README.md ├── gradlew.bat └── gradlew /docs/poi-package-list: -------------------------------------------------------------------------------- 1 | org.apache.poi.ss.usermodel 2 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | 3 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "poink" 2 | -------------------------------------------------------------------------------- /poink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwillc/poink/HEAD/poink.png -------------------------------------------------------------------------------- /src/test/resources/test.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwillc/poink/HEAD/src/test/resources/test.xlsx -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | out 3 | .gradle 4 | .gradle.kts 5 | build 6 | *.iml 7 | .java-version 8 | /test.xlsx 9 | -------------------------------------------------------------------------------- /docs/dokka/poink/package-list: -------------------------------------------------------------------------------- 1 | $dokka.format:html 2 | $dokka.linkExtension:html 3 | 4 | com.github.nwillc.poink 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwillc/poink/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /docs/dokka/poink/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | poink 5 | 6 | 7 | 8 | poink
9 |
10 |

Packages

11 | 12 | 13 | 14 | 17 | 19 | 20 | 21 |
15 |

com.github.nwillc.poink

16 |
18 |
22 |

Index

23 | All Types 24 | 25 | 26 | -------------------------------------------------------------------------------- /.editorConfig: -------------------------------------------------------------------------------- 1 | root=true 2 | 3 | [*] 4 | insert_final_newline = true 5 | end_of_line = lf 6 | charset = utf-8 7 | # tab_width = 4 8 | 9 | [*.md] 10 | trim_trailing_whitespace = true 11 | 12 | [Jenkinsfile] 13 | indent_style = space 14 | indent_size = 4 15 | trim_trailing_whitespace = true 16 | 17 | [*.{kt,kts,java,sql}] 18 | indent_style = space 19 | indent_size = 4 20 | trim_trailing_whitespace = true 21 | disabled_rules=import-ordering 22 | 23 | [*.{json,yml,yaml}] 24 | indent_style = space 25 | indent_size = 2 26 | 27 | [*.bat] 28 | end_of_line = crlf 29 | 30 | [Makefile] 31 | indent_style = tab 32 | -------------------------------------------------------------------------------- /.github/workflows/cicd.yml: -------------------------------------------------------------------------------- 1 | 2 | name: CICD 3 | 4 | on: 5 | push: 6 | branches: [ master ] 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | - uses: actions/setup-java@v1 15 | with: 16 | java-version: 1.8 17 | 18 | - name: Assemble 19 | run: ./gradlew assemble 20 | 21 | - name: Check 22 | run: ./gradlew check 23 | 24 | - name: Upload coverage to Codecov 25 | uses: codecov/codecov-action@v1 26 | 27 | - name: Publish Releases 28 | env: 29 | BINTRAY_USER: ${{ secrets.BINTRAY_USER }} 30 | BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }} 31 | run: ./gradlew bintrayUpload 32 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-poink-dsl/-init-.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PoinkDsl.<init> - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PoinkDsl / <init>
9 |
10 |

<init>

11 | 12 | PoinkDsl() 13 |

Tagging annotation for classes in the poink DSL.

14 | 15 | 16 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020, nwillc@gmail.com 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-poink-dsl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PoinkDsl - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PoinkDsl
9 |
10 |

PoinkDsl

11 | @DslMarker annotation class PoinkDsl 12 |

Tagging annotation for classes in the poink DSL.

13 |

Constructors

14 | 15 | 16 | 17 | 20 | 23 | 24 | 25 |
18 |

<init>

19 |
21 |

Tagging annotation for classes in the poink DSL.

22 | PoinkDsl()
26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/kotlin/com/github/nwillc/poink/PoinkDsl.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, nwillc@gmail.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.github.nwillc.poink 18 | 19 | /** 20 | * Tagging annotation for classes in the _poink_ DSL. 21 | */ 22 | @DslMarker 23 | annotation class PoinkDsl 24 | -------------------------------------------------------------------------------- /docs/dokka/poink/alltypes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | alltypes - poink 5 | 6 | 7 | 8 |

All Types

9 | 10 | 11 | 12 |
com.github.nwillc.poink.PoinkDsl
13 |

Tagging annotation for classes in the poink DSL.

14 | 15 | 16 |
com.github.nwillc.poink.PSheet
17 |

The poink DSL facade for the Apache POI Sheet.

18 | 19 | 20 |
com.github.nwillc.poink.PWorkbook
21 |

The poink DSL facade for the Apache POI Workbook.

22 | 23 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-p-workbook/write.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PWorkbook.write - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PWorkbook / write
9 |
10 |

write

11 | 12 | fun write(path: String): Unit 13 |

Write the workbook out to a file.

14 |

Parameters

15 |

16 | path - name of the output file.

17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-p-sheet/-init-.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PSheet.<init> - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PSheet / <init>
9 |
10 |

<init>

11 | 12 | PSheet(sheet: Sheet) 13 |

The poink DSL facade for the Apache POI Sheet.

14 |

Parameters

15 |

16 | sheet - The Sheet to act as a facade for.

17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-p-workbook/-init-.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PWorkbook.<init> - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PWorkbook / <init>
9 |
10 |

<init>

11 | 12 | PWorkbook(workbook: XSSFWorkbook = XSSFWorkbook()) 13 |

The poink DSL facade for the Apache POI Workbook.

14 |

Parameters

15 |

16 | workbook - The Workbook to act as a facade for.

17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Coverage](https://codecov.io/gh/nwillc/poink/branch/master/graphs/badge.svg?branch=master)](https://codecov.io/gh/nwillc/poink) 2 | [![license](https://img.shields.io/github/license/nwillc/poink.svg)](https://tldrlegal.com/license/-isc-license) 3 | [![Build Status](https://github.com/nwillc/poink/workflows/CICD/badge.svg)](https://github.com/nwillc/poink/actions?query=workflow%3ACICD) 4 | [![Download](https://api.bintray.com/packages/nwillc/maven/poink/images/download.svg)](https://bintray.com/nwillc/maven/poink/_latestVersion) 5 | --- 6 | ![Poink!](poink.png) 7 | # POI iN Kotlin 8 | 9 | A Kotlin DSL to read/write XLSX files via Apache POI. 10 | 11 | Really almost nothing here, the DSL is a facade for Apache POI, providing for somewhat simpler use. 12 | 13 | ## Generating 14 | 15 | ```kotlin 16 | workbook { 17 | // Create a named cell style 18 | val headerStyle = cellStyle("Header") { 19 | fillForegroundColor = IndexedColors.GREY_25_PERCENT.index 20 | fillPattern = FillPatternType.SOLID_FOREGROUND 21 | } 22 | sheet("One") { 23 | // Add a row with a style 24 | row(listOf("a", "b", "c"), headerStyle) 25 | // Add a row without style 26 | row(listOf(1, 2.0, 3L)) 27 | } 28 | sheet { 29 | row(listOf("A very wide cell")) 30 | row(listOf("An even wider column")) 31 | // Auto size the width of a column 32 | autoSizeColumn(0) 33 | } 34 | }.write("test.xlsx") 35 | ``` 36 | 37 | ## Reading 38 | 39 | ```kotlin 40 | workbook("test.xlsx") { 41 | sheet("One") { 42 | iterator().forEach { row -> 43 | row.iterator().forEach { cell -> 44 | println(cell.stringCellValue) 45 | } 46 | } 47 | } 48 | } 49 | ``` 50 | 51 | ## See Also 52 | - [Apache POI](https://poi.apache.org/) 53 | - [Poink API Docs](https://nwillc.github.io/poink/dokka/poink) 54 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-p-workbook/cell-style.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PWorkbook.cellStyle - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PWorkbook / cellStyle
9 |
10 |

cellStyle

11 | 12 | fun cellStyle(name: String, block: CellStyle.() -> Unit = {}): CellStyle 13 |

Get a named CellStyle, or create if absent, in the workbook for future use.

14 |

Parameters

15 |

16 | name - to use for created style.

17 |

18 | block - Lambda to apply to the created style.

19 |

Return
20 | The created CellStyle

21 | 22 | 23 | -------------------------------------------------------------------------------- /src/test/kotlin/com/github/nwillc/poink/PoinkTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, nwillc@gmail.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.github.nwillc.poink 18 | 19 | import java.time.LocalDate 20 | import java.time.LocalDateTime 21 | import java.util.Calendar 22 | import org.apache.poi.ss.usermodel.FillPatternType 23 | import org.apache.poi.ss.usermodel.IndexedColors 24 | import org.junit.jupiter.api.Test 25 | 26 | class PoinkTest { 27 | @Test 28 | fun `create an example xlsx`() { 29 | workbook { 30 | val headerStyle = cellStyle("header") { 31 | fillForegroundColor = IndexedColors.GREY_25_PERCENT.index 32 | fillPattern = FillPatternType.SOLID_FOREGROUND 33 | } 34 | sheet("One") { 35 | row(listOf("a", "b", "c"), headerStyle) 36 | val cells = row(listOf("1", "2", "3")) 37 | cells[0].cellStyle = headerStyle 38 | } 39 | sheet { 40 | row(listOf("A very wide cell")) 41 | row(listOf("An even wider column")) 42 | autoSizeColumn(0) 43 | } 44 | sheet("Types") { 45 | val list = listOf( 46 | "hello", 47 | 42, 48 | 3.142, 49 | LocalDateTime.now(), 50 | LocalDate.now(), 51 | Calendar.getInstance(), 52 | "key" to "value" 53 | ) 54 | // Without style 55 | row(list) 56 | // With style 57 | row(list, headerStyle) 58 | } 59 | }.write("test.xlsx") 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/test/kotlin/com/github/nwillc/poink/PWorkbookTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, nwillc@gmail.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.github.nwillc.poink 18 | 19 | import org.assertj.core.api.Assertions.assertThat 20 | import org.junit.jupiter.api.Test 21 | 22 | class PWorkbookTest { 23 | @Test 24 | fun `should be able to create workbook`() { 25 | val xlsx = workbook { } 26 | assertThat(xlsx).isNotNull 27 | } 28 | 29 | @Test 30 | fun `should be able to add sheet`() { 31 | val xlsx = workbook { 32 | sheet { } 33 | } 34 | 35 | assertThat(xlsx.numberOfSheets).isEqualTo(1) 36 | assertThat(xlsx.getSheetAt(0).sheetName).isEqualTo("Sheet 1") 37 | } 38 | 39 | @Test 40 | fun `should be able to add sheet with name`() { 41 | val name = "foo" 42 | val xlsx = workbook { 43 | sheet(name) { } 44 | } 45 | 46 | assertThat(xlsx.numberOfSheets).isEqualTo(1) 47 | assertThat(xlsx.getSheet(name)).isNotNull 48 | } 49 | 50 | @Test 51 | fun `should be able to create a cell style by name`() { 52 | val HEADER = "header" 53 | workbook { 54 | val style = cellStyle(HEADER) 55 | assertThat(cellStyle(HEADER)).isEqualTo(style) 56 | } 57 | } 58 | 59 | @Test 60 | fun `should open existing workbook`() { 61 | workbook("src/test/resources/test.xlsx") { 62 | assertThat(this).isInstanceOf(PWorkbook::class.java) 63 | sheet("One") { 64 | assertThat(this).isInstanceOf(PSheet::class.java) 65 | assertThat(iterator().asSequence().count()).isEqualTo(2) 66 | iterator().forEach { row -> 67 | assertThat(row.lastCellNum).isEqualTo(3) 68 | } 69 | } 70 | sheet(1) { 71 | assertThat(this).isInstanceOf(PSheet::class.java) 72 | assertThat(iterator().asSequence().count()).isEqualTo(2) 73 | iterator().forEach { row -> 74 | assertThat(row.lastCellNum).isEqualTo(1) 75 | } 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/workbook.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | workbook - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / workbook
9 |
10 |

workbook

11 | 12 | fun workbook(block: PWorkbook.() -> Unit): PWorkbook 13 |

Create a workbook.

14 |

Parameters

15 |

16 | block - Code to perform on the workbook.

17 |

Return
18 | A new workbook.

19 | 20 | fun workbook(path: String, block: PWorkbook.() -> Unit): PWorkbook 21 |

Open existing workbook.

22 |

Parameters

23 |

24 | path - File path to an existing workbook.

25 |

26 | block - Code to perform on the workbook.

27 |

Return
28 | The loaded from the provided file.

29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-p-sheet/row.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PSheet.row - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PSheet / row
9 |
10 |

row

11 | 12 | fun row(cells: List<Any>, style: CellStyle? = null): List<Cell> 13 |

Add objects as a new row at bottom of sheet. These objects will be intelligently rendered based on String, 14 | Number, LocalDate, LocalDateTime, Calendar or else the Object.toString.

15 |

Parameters

16 |

17 | cells - A List of Any to add to Sheet as a row.

18 |

19 | style - An optional CellStyle for the cells in the row.

20 |

Return
21 | The List of Cell added as a row.

22 | 23 | 24 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /src/main/kotlin/com/github/nwillc/poink/PWorkbook.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, nwillc@gmail.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.github.nwillc.poink 18 | 19 | import java.io.FileInputStream 20 | import java.io.FileOutputStream 21 | import org.apache.poi.ss.usermodel.CellStyle 22 | import org.apache.poi.ss.usermodel.Workbook 23 | import org.apache.poi.xssf.usermodel.XSSFCellStyle 24 | import org.apache.poi.xssf.usermodel.XSSFWorkbook 25 | 26 | /** 27 | * The _poink_ DSL facade for the Apache POI [Workbook]. 28 | * @param workbook The [Workbook] to act as a facade for. 29 | */ 30 | @PoinkDsl 31 | class PWorkbook(private val workbook: XSSFWorkbook = XSSFWorkbook()) : Workbook by workbook { 32 | private val styles: MutableMap = mutableMapOf() 33 | 34 | /** 35 | * Get a named sheet, or create if absent, in the workbook. 36 | * @param name of the new sheet, will default to "Sheet #" 37 | * @param block Code to perform on the sheet. 38 | * @return The existing sheet, or a new one if named sheet doesn't exit. 39 | */ 40 | fun sheet(name: String = "Sheet ${numberOfSheets + 1}", block: PSheet.() -> Unit) = 41 | PSheet(getSheet(name) ?: workbook.createSheet(name)).apply(block) 42 | 43 | /** 44 | * Get an existing sheet by its index. 45 | * @param index The index of the sheet 46 | * @param block Code to perform on the sheet. 47 | * @return Sheet at a given index. 48 | */ 49 | fun sheet(index: Int, block: PSheet.() -> Unit) = PSheet(workbook.getSheetAt(index)).apply(block) 50 | 51 | /** 52 | * Get a named [CellStyle], or create if absent, in the workbook for future use. 53 | * @param name to use for created style. 54 | * @param block Lambda to apply to the created style. 55 | * @return The created [CellStyle] 56 | */ 57 | fun cellStyle(name: String, block: CellStyle.() -> Unit = {}): CellStyle = 58 | styles.computeIfAbsent(name) { workbook.createCellStyle() as XSSFCellStyle } 59 | .apply(block) 60 | 61 | /** 62 | * Write the workbook out to a file. 63 | * @param path name of the output file. 64 | */ 65 | fun write(path: String) = FileOutputStream(path).use { workbook.write(it) } 66 | } 67 | 68 | /** 69 | * Create a workbook. 70 | * @param block Code to perform on the workbook. 71 | * @return A new workbook. 72 | */ 73 | fun workbook(block: PWorkbook.() -> Unit): PWorkbook = PWorkbook().apply(block) 74 | 75 | /** 76 | * Open existing workbook. 77 | * @param path File path to an existing workbook. 78 | * @param block Code to perform on the workbook. 79 | * @return The loaded from the provided file. 80 | */ 81 | fun workbook(path: String, block: PWorkbook.() -> Unit): PWorkbook = 82 | FileInputStream(path).use { PWorkbook(XSSFWorkbook(it)).apply(block) } 83 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-p-workbook/sheet.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PWorkbook.sheet - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PWorkbook / sheet
9 |
10 |

sheet

11 | 12 | fun sheet(name: String = "Sheet ${numberOfSheets + 1}", block: PSheet.() -> Unit): PSheet 13 |

Get a named sheet, or create if absent, in the workbook.

14 |

Parameters

15 |

16 | name - of the new sheet, will default to "Sheet #"

17 |

18 | block - Code to perform on the sheet.

19 |

Return
20 | The existing sheet, or a new one if named sheet doesn't exit.

21 | 22 | fun sheet(index: Int, block: PSheet.() -> Unit): PSheet 23 |

Get an existing sheet by its index.

24 |

Parameters

25 |

26 | index - The index of the sheet

27 |

28 | block - Code to perform on the sheet.

29 |

Return
30 | Sheet at a given index.

31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/kotlin/com/github/nwillc/poink/PSheet.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, nwillc@gmail.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.github.nwillc.poink 18 | 19 | import org.apache.poi.ss.usermodel.Cell 20 | import org.apache.poi.ss.usermodel.CellStyle 21 | import org.apache.poi.ss.usermodel.Sheet 22 | import java.time.LocalDate 23 | import java.time.LocalDateTime 24 | import java.util.Calendar 25 | 26 | /** 27 | * The _poink_ DSL facade for the Apache POI [Sheet]. 28 | * @param sheet The [Sheet] to act as a facade for. 29 | */ 30 | @PoinkDsl 31 | class PSheet( 32 | private val sheet: Sheet 33 | ) : Sheet by sheet { 34 | private val format = workbook.createDataFormat() 35 | private val dateFormat = format.getFormat("MM/DD/YYYY") 36 | private val timeStampFormat = format.getFormat("MM/DD/YYYY HH:MM:SS") 37 | private val calendarFormat = format.getFormat("MMM D, YYYY") 38 | 39 | /** 40 | * Add objects as a new row at bottom of sheet. These objects will be intelligently rendered based on [String], 41 | * [Number], [LocalDate], [LocalDateTime], [Calendar] or else the [Object.toString]. 42 | * @param cells A [List] of [Any] to add to [Sheet] as a row. 43 | * @param style An optional [CellStyle] for the cells in the row. 44 | * @return The [List] of [Cell] added as a row. 45 | */ 46 | fun row(cells: List, style: CellStyle? = null): List { 47 | val cellList = mutableListOf() 48 | val row = sheet.createRow(sheet.physicalNumberOfRows) 49 | var col = 0 50 | cells.forEach { cellValue -> 51 | cellList.add( 52 | row.createCell(col++).apply { 53 | cellStyle = style 54 | when (cellValue) { 55 | is String -> setCellValue(cellValue) 56 | is Number -> setCellValue(cellValue.toDouble()) 57 | is LocalDateTime -> { 58 | cellStyle = cloneAndFormat(style, timeStampFormat) 59 | setCellValue(cellValue) 60 | } 61 | is LocalDate -> { 62 | cellStyle = cloneAndFormat(style, dateFormat) 63 | setCellValue(cellValue) 64 | } 65 | is Calendar -> { 66 | cellStyle = cloneAndFormat(style, calendarFormat) 67 | setCellValue(cellValue) 68 | } 69 | else -> setCellValue(cellValue.toString()) 70 | } 71 | } 72 | ) 73 | } 74 | return cellList 75 | } 76 | 77 | private fun cloneAndFormat(style: CellStyle?, format: Short) = workbook.createCellStyle().apply { 78 | if (style != null) { 79 | cloneStyleFrom(style) 80 | } 81 | dataFormat = format 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-p-sheet/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PSheet - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PSheet
9 |
10 |

PSheet

11 | class PSheet : Sheet 12 |

The poink DSL facade for the Apache POI Sheet.

13 |

Parameters

14 |

15 | sheet - The Sheet to act as a facade for.

16 |

Constructors

17 | 18 | 19 | 20 | 23 | 26 | 27 | 28 |
21 |

<init>

22 |
24 |

The poink DSL facade for the Apache POI Sheet.

25 | PSheet(sheet: Sheet)
29 |

Functions

30 | 31 | 32 | 33 | 36 | 40 | 41 | 42 |
34 |

row

35 |
37 |

Add objects as a new row at bottom of sheet. These objects will be intelligently rendered based on String, 38 | Number, LocalDate, LocalDateTime, Calendar or else the Object.toString.

39 | fun row(cells: List<Any>, style: CellStyle? = null): List<Cell>
43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.github.nwillc.poink - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink
9 |
10 |

Package com.github.nwillc.poink

11 |

Types

12 | 13 | 14 | 15 | 18 | 21 | 22 | 23 | 26 | 29 | 30 | 31 |
16 |

PSheet

17 |
19 |

The poink DSL facade for the Apache POI Sheet.

20 | class PSheet : Sheet
24 |

PWorkbook

25 |
27 |

The poink DSL facade for the Apache POI Workbook.

28 | class PWorkbook : Workbook
32 |

Annotations

33 | 34 | 35 | 36 | 39 | 42 | 43 | 44 |
37 |

PoinkDsl

38 |
40 |

Tagging annotation for classes in the poink DSL.

41 | annotation class PoinkDsl
45 |

Functions

46 | 47 | 48 | 49 | 52 | 57 | 58 | 59 |
50 |

workbook

51 |
53 |

Create a workbook.

54 | fun workbook(block: PWorkbook.() -> Unit): PWorkbook 55 |

Open existing workbook.

56 | fun workbook(path: String, block: PWorkbook.() -> Unit): PWorkbook
60 | 61 | 62 | -------------------------------------------------------------------------------- /docs/dokka/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Open+Sans:300i,400,700); 2 | 3 | body, table { 4 | padding:50px; 5 | font:14px/1.5 'Open Sans', "Helvetica Neue", Helvetica, Arial, sans-serif; 6 | color:#555; 7 | font-weight:300; 8 | margin-left: auto; 9 | margin-right: auto; 10 | max-width: 1440px; 11 | } 12 | 13 | .keyword { 14 | color:black; 15 | font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; 16 | font-size:12px; 17 | } 18 | 19 | .symbol { 20 | font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; 21 | font-size:12px; 22 | } 23 | 24 | .identifier { 25 | color: darkblue; 26 | font-size:12px; 27 | font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; 28 | } 29 | 30 | h1, h2, h3, h4, h5, h6 { 31 | color:#222; 32 | margin:0 0 20px; 33 | } 34 | 35 | p, ul, ol, table, pre, dl { 36 | margin:0 0 20px; 37 | } 38 | 39 | h1, h2, h3 { 40 | line-height:1.1; 41 | } 42 | 43 | h1 { 44 | font-size:28px; 45 | } 46 | 47 | h2 { 48 | color:#393939; 49 | } 50 | 51 | h3, h4, h5, h6 { 52 | color:#494949; 53 | } 54 | 55 | a { 56 | color:#258aaf; 57 | font-weight:400; 58 | text-decoration:none; 59 | } 60 | 61 | a:hover { 62 | color: inherit; 63 | text-decoration:underline; 64 | } 65 | 66 | a small { 67 | font-size:11px; 68 | color:#555; 69 | margin-top:-0.6em; 70 | display:block; 71 | } 72 | 73 | .wrapper { 74 | width:860px; 75 | margin:0 auto; 76 | } 77 | 78 | blockquote { 79 | border-left:1px solid #e5e5e5; 80 | margin:0; 81 | padding:0 0 0 20px; 82 | font-style:italic; 83 | } 84 | 85 | code, pre { 86 | font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; 87 | color:#333; 88 | font-size:12px; 89 | } 90 | 91 | pre { 92 | display: block; 93 | /* 94 | padding:8px 8px; 95 | background: #f8f8f8; 96 | border-radius:5px; 97 | border:1px solid #e5e5e5; 98 | */ 99 | overflow-x: auto; 100 | } 101 | 102 | table { 103 | width:100%; 104 | border-collapse:collapse; 105 | } 106 | 107 | th, td { 108 | text-align:left; 109 | vertical-align: top; 110 | padding:5px 10px; 111 | } 112 | 113 | dt { 114 | color:#444; 115 | font-weight:700; 116 | } 117 | 118 | th { 119 | color:#444; 120 | } 121 | 122 | img { 123 | max-width:100%; 124 | } 125 | 126 | header { 127 | width:270px; 128 | float:left; 129 | position:fixed; 130 | } 131 | 132 | header ul { 133 | list-style:none; 134 | height:40px; 135 | 136 | padding:0; 137 | 138 | background: #eee; 139 | background: -moz-linear-gradient(top, #f8f8f8 0%, #dddddd 100%); 140 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd)); 141 | background: -webkit-linear-gradient(top, #f8f8f8 0%,#dddddd 100%); 142 | background: -o-linear-gradient(top, #f8f8f8 0%,#dddddd 100%); 143 | background: -ms-linear-gradient(top, #f8f8f8 0%,#dddddd 100%); 144 | background: linear-gradient(top, #f8f8f8 0%,#dddddd 100%); 145 | 146 | border-radius:5px; 147 | border:1px solid #d2d2d2; 148 | box-shadow:inset #fff 0 1px 0, inset rgba(0,0,0,0.03) 0 -1px 0; 149 | width:270px; 150 | } 151 | 152 | header li { 153 | width:89px; 154 | float:left; 155 | border-right:1px solid #d2d2d2; 156 | height:40px; 157 | } 158 | 159 | header ul a { 160 | line-height:1; 161 | font-size:11px; 162 | color:#999; 163 | display:block; 164 | text-align:center; 165 | padding-top:6px; 166 | height:40px; 167 | } 168 | 169 | strong { 170 | color:#222; 171 | font-weight:700; 172 | } 173 | 174 | header ul li + li { 175 | width:88px; 176 | border-left:1px solid #fff; 177 | } 178 | 179 | header ul li + li + li { 180 | border-right:none; 181 | width:89px; 182 | } 183 | 184 | header ul a strong { 185 | font-size:14px; 186 | display:block; 187 | color:#222; 188 | } 189 | 190 | section { 191 | width:500px; 192 | float:right; 193 | padding-bottom:50px; 194 | } 195 | 196 | small { 197 | font-size:11px; 198 | } 199 | 200 | hr { 201 | border:0; 202 | background:#e5e5e5; 203 | height:1px; 204 | margin:0 0 20px; 205 | } 206 | 207 | footer { 208 | width:270px; 209 | float:left; 210 | position:fixed; 211 | bottom:50px; 212 | } 213 | 214 | @media print, screen and (max-width: 960px) { 215 | 216 | div.wrapper { 217 | width:auto; 218 | margin:0; 219 | } 220 | 221 | header, section, footer { 222 | float:none; 223 | position:static; 224 | width:auto; 225 | } 226 | 227 | header { 228 | padding-right:320px; 229 | } 230 | 231 | section { 232 | border:1px solid #e5e5e5; 233 | border-width:1px 0; 234 | padding:20px 0; 235 | margin:0 0 20px; 236 | } 237 | 238 | header a small { 239 | display:inline; 240 | } 241 | 242 | header ul { 243 | position:absolute; 244 | right:50px; 245 | top:52px; 246 | } 247 | } 248 | 249 | @media print, screen and (max-width: 720px) { 250 | body { 251 | word-wrap:break-word; 252 | } 253 | 254 | header { 255 | padding:0; 256 | } 257 | 258 | header ul, header p.view { 259 | position:static; 260 | } 261 | 262 | pre, code { 263 | word-wrap:normal; 264 | } 265 | } 266 | 267 | @media print, screen and (max-width: 480px) { 268 | body { 269 | padding:15px; 270 | } 271 | 272 | header ul { 273 | display:none; 274 | } 275 | } 276 | 277 | @media print { 278 | body { 279 | padding:0.4in; 280 | font-size:12pt; 281 | color:#444; 282 | } 283 | } 284 | -------------------------------------------------------------------------------- /docs/dokka/poink/com.github.nwillc.poink/-p-workbook/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PWorkbook - poink 5 | 6 | 7 | 8 | poink / com.github.nwillc.poink / PWorkbook
9 |
10 |

PWorkbook

11 | class PWorkbook : Workbook 12 |

The poink DSL facade for the Apache POI Workbook.

13 |

Parameters

14 |

15 | workbook - The Workbook to act as a facade for.

16 |

Constructors

17 | 18 | 19 | 20 | 23 | 26 | 27 | 28 |
21 |

<init>

22 |
24 |

The poink DSL facade for the Apache POI Workbook.

25 | PWorkbook(workbook: XSSFWorkbook = XSSFWorkbook())
29 |

Functions

30 | 31 | 32 | 33 | 36 | 39 | 40 | 41 | 44 | 49 | 50 | 51 | 54 | 57 | 58 | 59 |
34 |

cellStyle

35 |
37 |

Get a named CellStyle, or create if absent, in the workbook for future use.

38 | fun cellStyle(name: String, block: CellStyle.() -> Unit = {}): CellStyle
42 |

sheet

43 |
45 |

Get a named sheet, or create if absent, in the workbook.

46 | fun sheet(name: String = "Sheet ${numberOfSheets + 1}", block: PSheet.() -> Unit): PSheet 47 |

Get an existing sheet by its index.

48 | fun sheet(index: Int, block: PSheet.() -> Unit): PSheet
52 |

write

53 |
55 |

Write the workbook out to a file.

56 | fun write(path: String): Unit
60 | 61 | 62 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /docs/dokka/poink/index-outline.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Module Contents 5 | 6 | 7 | 8 | poink
9 | 134 | 135 | 136 | --------------------------------------------------------------------------------