Skip to content

Commit 2a645ef

Browse files
committed
Prepare v0.1.0 for release
1 parent 7f29a68 commit 2a645ef

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

Changes.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,44 @@
22

33
This documents the history of significant changes to `rivescript-go`.
44

5+
## v0.1.0 - Dec 11, 2016
6+
7+
This update changes some function prototypes in the API which breaks backward
8+
compatibility with existing code.
9+
10+
* **API Breaking Changes:**
11+
* `rivescript.New()` now takes a `*config.Config` struct to configure the
12+
instance. This is now the preferred way to configure debug mode, strict
13+
mode, UTF-8, etc. rather than functions like `SetUTF8()`.
14+
15+
For RiveScript's default settings, you can do `rivescript.New(config.Basic())`
16+
or `rivescript.New(nil)`. For UTF-8 support, `rivescript.New(config.UTF8())`
17+
is a convenient config template to use.
18+
* `GetDepth()` and `SetDepth()` now use a `uint` instead of an `int`. But
19+
these functions are deprecated anyway.
20+
* `GetUservars()` and `GetAllUservars()` return `*sessions.UserData` objects
21+
instead of `map[string]string` for the user data.
22+
* `ThawUservars()` now takes a `sessions.ThawAction` instead of a string to
23+
specify the action. Valid values are `Thaw`, `Discard`, or `Keep`
24+
(constants from the `sessions` package).
25+
* **Deprecated Functions:**
26+
* Configuration functions (getters and setters). Use the `Config` struct
27+
when calling `rivescript.New(*config.Config)` instead:
28+
* `SetDebug()`, `SetUTF8()`, `SetDepth()`, `SetStrict()`
29+
* `GetDebug()`, `GetUTF8()`, `GetDepth()`, `GetStrict()`
30+
* **Changes:**
31+
* Add support for pluggable session stores for user variables. The default
32+
one still keeps user variables in memory, but you can specify your own
33+
implementation instead.
34+
35+
The interface for a `SessionManager` is in the `sessions` package. The
36+
default in-memory manager is in `sessions/memory`. By implementing your own
37+
session manager, you can change where RiveScript keeps track of user
38+
variables, e.g. to put them in a database or cache.
39+
* Make the library thread-safe with regards to getting/setting user variables
40+
while answering a message. The default in-memory session manager implements
41+
a mutex for accessing user variables.
42+
543
## v0.0.3 - Sept 28, 2016
644

745
This update was all about restructuring the internal source code to make certain

rivescript.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ package rivescript
1313
*/
1414

1515
import (
16+
"fmt"
17+
"os"
18+
1619
"github.com/aichaos/rivescript-go/config"
1720
"github.com/aichaos/rivescript-go/macro"
1821
"github.com/aichaos/rivescript-go/sessions"
1922
"github.com/aichaos/rivescript-go/src"
2023
)
2124

22-
const VERSION string = "0.0.3"
25+
const VERSION string = "0.1.0"
2326

2427
type RiveScript struct {
2528
rs *rivescript.RiveScript
@@ -31,28 +34,36 @@ func New(config *config.Config) *RiveScript {
3134
return bot
3235
}
3336

37+
func deprecated(name string) {
38+
fmt.Fprintf(os.Stderr, "Use of 'rivescript.%s()' is deprecated\n", name)
39+
}
40+
3441
// Version returns the RiveScript library version.
3542
func (self *RiveScript) Version() string {
3643
return VERSION
3744
}
3845

3946
// SetDebug enables or disable debug mode.
4047
func (self *RiveScript) SetDebug(value bool) {
48+
deprecated("SetDebug")
4149
self.rs.Debug = value
4250
}
4351

4452
// GetDebug tells you the current status of the debug mode.
4553
func (self *RiveScript) GetDebug() bool {
54+
deprecated("GetDebug")
4655
return self.rs.Debug
4756
}
4857

4958
// SetUTF8 enables or disabled UTF-8 mode.
5059
func (self *RiveScript) SetUTF8(value bool) {
60+
deprecated("SetUTF8")
5161
self.rs.UTF8 = value
5262
}
5363

5464
// GetUTF8 returns the current status of UTF-8 mode.
5565
func (self *RiveScript) GetUTF8() bool {
66+
deprecated("GetUTF8")
5667
return self.rs.UTF8
5768
}
5869

@@ -65,21 +76,25 @@ func (self *RiveScript) SetUnicodePunctuation(value string) {
6576

6677
// SetDepth lets you override the recursion depth limit (default 50).
6778
func (self *RiveScript) SetDepth(value uint) {
79+
deprecated("SetDepth")
6880
self.rs.Depth = value
6981
}
7082

7183
// GetDepth returns the current recursion depth limit.
7284
func (self *RiveScript) GetDepth() uint {
85+
deprecated("GetDepth")
7386
return self.rs.Depth
7487
}
7588

7689
// SetStrict enables strict syntax checking when parsing RiveScript code.
7790
func (self *RiveScript) SetStrict(value bool) {
91+
deprecated("SetStrict")
7892
self.rs.Strict = value
7993
}
8094

8195
// GetStrict returns the strict syntax check setting.
8296
func (self *RiveScript) GetStrict() bool {
97+
deprecated("GetStrict")
8398
return self.rs.Strict
8499
}
85100

0 commit comments

Comments
 (0)