diff --git a/docs/contributing.md b/docs/contributing.md new file mode 100644 index 0000000..d6caed4 --- /dev/null +++ b/docs/contributing.md @@ -0,0 +1,46 @@ +# Contributing + +Thank you for your interest in contributing to FloorPlan! + +## Setup + +* Check out the [project](https://github.com/julioz/FloorPlan/) +* Download [IntelliJ IDEA](https://www.jetbrains.com/idea/download/) or [Android Studio](https://developer.android.com/studio) and import it. + +## Build + +* Build the CLI and its subprojects with `./gradlew :floorplan-cli:build`. +* Build the Gradle Plugin: + * Publish a snapshot to your local maven repository: `./gradlew :floorplan-gradle-plugin:publishToMavenLocal` + * Enable the sample app building: `echo floorplan.includeSampleApp=true >> ~/.gradle/gradle.properties` + * (Optionally) Trigger the task on the sample app with `./gradlew :sample-android-project:generateFloorPlan` + +!!! note "Note: Gradle Plugin - workflow" + The gradle plugin development workflow requires republishing of the latest builds to `mavenLocal` after each code change. You will need to the deployment steps above if you want to manually test the changes in an end-to-end fashion with the help of the sample Android application. + +## Tests + +The project is unit tested and has integration tests for its Gradle plugin. These can be run via Gradle with: +``` +gradlew test +``` + +You can also run only the Gradle Plugin tests by specifying that task explicitly: + +``` +gradlew :floorplan-gradle-plugin:test +``` + +## Deploying the docs locally + +Install `mkdocs` and the required extensions: + +``` +pip install -r requirements.txt +``` + +Deploy it locally: + +``` +mkdocs serve +``` diff --git a/docs/gradle-plugin.md b/docs/gradle-plugin.md new file mode 100644 index 0000000..a907eb9 --- /dev/null +++ b/docs/gradle-plugin.md @@ -0,0 +1,82 @@ +# FloorPlan as a Gradle Plugin + +### Apply the plugin + +Apply the gradle plugin in your root `build.gradle` file: + +``` +buildscript { + dependencies { + classpath "com.zynger.floorplan:floorplan-gradle-plugin:" + } +} +``` + +and in the modules you want `FloorPlan`'s Gradle task to exist. + +For example, in an Android application module: + +``` +plugins { + id 'com.android.application' // could be library or any other module + id 'com.zynger.floorplan' +} +``` + +### Gradle extension + +Configure FloorPlan's Gradle extension by definining a `floorPlan` block: + +``` +floorPlan { + schemaLocation = "$projectDir/schemas".toString() + outputLocation = "$projectDir/floorplan-output".toString() + outputFormat { + svg { + enabled = true + } + } +} +``` + +#### Output formats + +FloorPlan is able to output different file formats. + +Take a look at what a full configuration would look like, defining `DBML` as an output format (and providing [extra configurations for `DBML`](../run/#output-format)): + +``` +floorPlan { + schemaLocation = "$projectDir/schemas".toString() + outputLocation = "$projectDir/floorplan-output".toString() + outputFormat { + dbml { + enabled = true + creationSqlAsTableNote = false + renderNullableFields = false + } + svg { + enabled = false + } + png { + enabled = false + } + dot { + enabled = false + } + } +} +``` + +!!! warning + So far, you can only specify one output format per run, by defining which one is `enabled`. + +### Generate Floor Plan + +Once everything is setup, you can finally run FloorPlan to translate database schemas into ER diagrams. + +For example, to generate the diagrams associated to the `sample-android-project` module schemas, we can run: + +``` +./gradlew :sample-android-project:generateFloorPlan +``` \ No newline at end of file diff --git a/docs/run.md b/docs/run.md index b3e6ea9..43a4176 100644 --- a/docs/run.md +++ b/docs/run.md @@ -1,4 +1,4 @@ -# Run FloorPlan +# Run FloorPlan from the command line After checking out this repository, [make sure you have Gradle installed](https://gradle.org/install/) and run: ``` diff --git a/docs/tests.md b/docs/tests.md deleted file mode 100644 index 92ddb2d..0000000 --- a/docs/tests.md +++ /dev/null @@ -1,7 +0,0 @@ -# Tests - -The project is unit tested. These can be run via Gradle with: -``` -gradlew test -``` - diff --git a/mkdocs.yml b/mkdocs.yml index 9a8fc11..1443483 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,13 +12,15 @@ markdown_extensions: - codehilite: guess_lang: false - pymdownx.superfences + - mdx_truly_sane_lists theme: name: 'material' nav: - 'Overview': 'index.md' - - 'Run': - - 'Introduction': 'run.md' - - 'Testing': 'tests.md' + - 'Usage': + - 'Command-line': 'run.md' + - 'Gradle Plugin': 'gradle-plugin.md' + - 'Contributing': 'contributing.md' - 'Architecture': 'architecture.md' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9bdaead --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +mkdocs +mkdocs-material>=5.1.0 +mkdocs-markdownextradata-plugin +pymdown-extensions>=7.0 +mdx_truly_sane_lists