Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kdabir/directree
A Simple DSL to create Directory Tree with Text Files
https://github.com/kdabir/directree
directory dsl file groovy jvm tree
Last synced: 2 months ago
JSON representation
A Simple DSL to create Directory Tree with Text Files
- Host: GitHub
- URL: https://github.com/kdabir/directree
- Owner: kdabir
- License: mit
- Created: 2014-01-14T22:18:57.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2021-07-13T23:14:55.000Z (over 3 years ago)
- Last Synced: 2024-09-29T23:21:10.610Z (3 months ago)
- Topics: directory, dsl, file, groovy, jvm, tree
- Language: Groovy
- Size: 231 KB
- Stars: 14
- Watchers: 4
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DirecTree
---------A Simple DSL for :
- Creating directory trees with text files (with contents).
- Keeping multiple source directories in sync with a target directory.![Build](https://github.com/kdabir/directree/workflows/Build/badge.svg)
> directree is available in `jcenter` maven repository.
```groovy
@Grab('io.github.kdabir.directree:directree:0.3.2')
import static directree.DirTree.createcreate("my-dir") {
dir ("todo") {
file "first.txt", "check out this new library"
}file ("README.md") { """
Directree
${'='*80}There are multiple ways in which content can be written to a file.
after all, its all a valid groovy code.
""".stripIndent()
}
}
```#### Verifying it:
`$ tree my-dir`
my-dir
|-- README.md
`-- todo
`-- first.txt1 directory, 2 files
`$ cat my-dir/README.md`
Directree
================================================================================There are multiple ways in which content can be written to a file.
after all, its all a valid groovy code.`$ cat my-dir/todo/first.txt`
check out this new library
#### More realistic example
You can create a project structure:
```groovy
create("my-project") {
dir "src" , {
file "hello.groovy", "println 'hello world'"
}
dir "test", {
file ".gitkeep"
}
file "build.gradle" , ""
file ".gitignore", "*.class"
}
````create(".")` will create the files and directories in current directory.