Skip to content

Commit

Permalink
0.9.4 with #33 fix and some add'l tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carueda committed Aug 3, 2018
1 parent 777f988 commit 9f9e790
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 16 deletions.
35 changes: 20 additions & 15 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2018-08-03 - 0.9.4

- resolve #33 "Generate default config objects if non-existent".
Thanks @JustinPihony !

2018-02-16 - 0.9.3

- resolve #31 "Option to generate getters".
Expand All @@ -8,12 +13,12 @@
- resolve #30 "scala: option to use back ticks"
- Adjustments regarding keys with $ and quoted strings:
- key containing $ is left alone (even if it's quoted).
This mainly due to Config restrictions on keys involving $
- otherwise, the key is unquoted (if quoted of course)
This mainly due to Config restrictions on keys involving $
- otherwise, the key is unquoted (if quoted of course)

2018-02-11 - 0.8.4

- internal: use scala 2.12 (but cross compile to 2.11 too)
- internal: use scala 2.12 (but cross compile to 2.11 too)
and upgrade some dependencies

2017-09-05 - 0.8.3
Expand All @@ -38,22 +43,22 @@
Note:
- this uses the default artifact publication (jar, javadocs, etc), **not** the
executable "fat" jar, which is basically the only artifact properly built.
- kept the current version
- kept the current version

2017-02-03 - 0.8.0
- resolve #23 "support size-in-bytes type"
- renaming to better reflect "duration" elements, and in preparation for "size in bytes" support.

2016-12-17 - 0.7.2
- fix #22 "literal duration captured as string"
- generate code as part of test phase
- generate code as part of test phase

2016-12-14 - 0.7.1

- add tests for class name or keys starting with `$_`
- fix #19 "quoted keys"
- use simpler, equivalent boolean access expression according to given default
- fixed: spec with literal values were not generating "primitive" types
- fixed: spec with literal values were not generating "primitive" types
in java. There was a missing `&& a.default.isEmpty` in:
`val typ = if (a.optional && a.default.isEmpty) toObjectType(memberType) else memberType`

Expand All @@ -65,7 +70,7 @@

2016-12-01 - 0.5.1
- put "generated by" when running from main program

2016-11-30 - 0.5.0
- resolve #16 "rewrite code"
- resolve #15 "support list"
Expand All @@ -74,8 +79,8 @@
- TODO revisit template generation (info moved to a wiki page)

2016-11-22 - 0.5.0
- advancing a rewrite...
- advancing a rewrite...

2016-11-19 - 0.3.4
- re #15 "support list"
- allow use of nodes.createAllNodes in object defining element of list
Expand Down Expand Up @@ -122,7 +127,7 @@
- initial work on #6: "generate conf templates."
- `--tpl` option with 3 possible types: base, local, all.
Can be given multiple times.
Running the example-4tpl.spec.conf:
Running the example-4tpl.spec.conf:
```
> runMain tscfg.Main --spec example/example-4tpl.spec.conf --tpl base src/main/java/tscfg/example/example-4tpl.base.conf --tpl local src/main/java/tscfg/example/example-4tpl.local.conf --tpl all src/main/java/tscfg/example/example-4tpl.all.conf
Expand All @@ -131,7 +136,7 @@
- more complete TypeSpec (TODO simplify \*Accesor/Spec classes wrt types)
- entry with no explicit type is now considered optional (with given value as default)
- some preliminary annotation processing
- @optional for sections - only generates comment in templates; no verification logic at all yet
- @optional for sections - only generates comment in templates; no verification logic at all yet
- @local to force inclusion of field in "local" template output
2016-02-07 - 0.2.1
Expand All @@ -150,8 +155,8 @@
2016-01-11 - 0.1.3
- generate code for java 8 by default.
Found out that Typesafe Config's `hasPath` method returns `false` for actually existing paths that just
happen to be defined with `null`! So, `hasPathOrNull` is now used in the generated code, and this method
happen to be defined with `null`! So, `hasPathOrNull` is now used in the generated code, and this method
is only available in Typesafe Config 1.3.0+, which requires Java 8.
The new flag `--j7` makes the tool generate `hasPath` checks instead of `hasPathOrNull`,
The new flag `--j7` makes the tool generate `hasPath` checks instead of `hasPathOrNull`,
so the generated code can be used with Typesafe Config 1.2.1 and Java <= 7.
2 changes: 1 addition & 1 deletion src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tscfg.version = 0.9.3
tscfg.version = 0.9.4
7 changes: 7 additions & 0 deletions src/main/tscfg/example/issue33b.spec.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
endpoint {
url: "String | http://example.net"
foo: "int?"
baz {
key: "bar"
}
}
6 changes: 6 additions & 0 deletions src/main/tscfg/example/issue33c.spec.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
endpoint {
req: String
optObj {
key: "bar"
}
}
20 changes: 20 additions & 0 deletions src/test/scala/tscfg/generators/java/JavaMainSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -442,5 +442,25 @@ class JavaMainSpec extends Specification {
val c = new JavaIssue33aCfg(ConfigFactory.parseString(""))
c.endpoint.more.url === "http://example.net"
}

"generate config for object first level" in {
val c = new JavaIssue33bCfg(ConfigFactory.parseString(""))
c.endpoint.url === "http://example.net"
c.endpoint.foo === null
c.endpoint.baz.key === "bar"
}

"generate config for object nested level" in {
val c = new JavaIssue33bCfg(ConfigFactory.parseString("endpoint.foo = 1"))
c.endpoint.url === "http://example.net"
c.endpoint.foo === 1
c.endpoint.baz.key === "bar"
}

"generate config for sub-object under required object" in {
val c = new JavaIssue33cCfg(ConfigFactory.parseString("endpoint.req = foo"))
c.endpoint.req === "foo"
c.endpoint.optObj.key === "bar"
}
}
}
20 changes: 20 additions & 0 deletions src/test/scala/tscfg/generators/scala/ScalaMainSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -430,5 +430,25 @@ class ScalaMainSpec extends Specification {
val c = ScalaIssue33aCfg(ConfigFactory.parseString(""))
c.endpoint.more.url === "http://example.net"
}

"generate config for object first level" in {
val c = ScalaIssue33bCfg(ConfigFactory.parseString(""))
c.endpoint.url === "http://example.net"
c.endpoint.foo === None
c.endpoint.baz.key === "bar"
}

"generate config for object nested level" in {
val c = ScalaIssue33bCfg(ConfigFactory.parseString("endpoint.foo = 1"))
c.endpoint.url === "http://example.net"
c.endpoint.foo === Some(1)
c.endpoint.baz.key === "bar"
}

"generate config for sub-object under required object" in {
val c = ScalaIssue33cCfg(ConfigFactory.parseString("endpoint.req = foo"))
c.endpoint.req === "foo"
c.endpoint.optObj.key === "bar"
}
}
}

0 comments on commit 9f9e790

Please sign in to comment.