Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio Zynger committed Jun 4, 2020
1 parent d042b16 commit ec565c9
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 11 deletions.
46 changes: 46 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -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
```
82 changes: 82 additions & 0 deletions docs/gradle-plugin.md
Original file line number Diff line number Diff line change
@@ -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:<version>"
}
}
```

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
```
2 changes: 1 addition & 1 deletion docs/run.md
Original file line number Diff line number Diff line change
@@ -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:
```
Expand Down
7 changes: 0 additions & 7 deletions docs/tests.md

This file was deleted.

8 changes: 5 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mkdocs
mkdocs-material>=5.1.0
mkdocs-markdownextradata-plugin
pymdown-extensions>=7.0
mdx_truly_sane_lists

0 comments on commit ec565c9

Please sign in to comment.