Skip to content

Commit 81d86fd

Browse files
committed
1.0.0 release
1 parent 6048150 commit 81d86fd

File tree

6 files changed

+36
-32
lines changed

6 files changed

+36
-32
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
## 1.0.0 - *2/12/2017* **(BREAKING CHANGE)**
5+
6+
- Depreciated `JSONLITE_PATH` environment variable. `JSONLITE_DATA_DIR` should be used instead.
7+
- Minor documentation cleanup.
8+
49
## 0.8.0 - *5/15/2016*
510

611
- The `set` command now supports piping into it. Closes [issue #14](https://github.com/nodesocket/jsonlite/issues/14).

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2016 Justin Keller
189+
Copyright 2017 Justin Keller
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
##### A simple, self-contained, serverless, zero-configuration, [json](http://www.json.org/) document store.
44

5-
JSONlite sandboxes the current working directory just like [SQLite](https://www.sqlite.org/). The data directory is named `jsonlite.data`, and each json document is saved pretty printed as a uuid.
5+
JSONlite sandboxes the current working similar to [SQLite](https://www.sqlite.org/). The JSONlite data directory is named `jsonlite.data`, and each json document is saved pretty printed as a uuid.
66

77
## Installation
88

99
````
1010
git clone https://github.com/nodesocket/jsonlite.git
11-
cd jsonlite
12-
ln -s $PWD/jsonlite.bash /usr/local/bin/jsonlite
11+
ln -s "$PWD"/jsonlite/jsonlite.bash /usr/local/bin/jsonlite
1312
````
1413

1514
## Requirements
@@ -21,14 +20,14 @@ ln -s $PWD/jsonlite.bash /usr/local/bin/jsonlite
2120

2221
## Configuration
2322

24-
You may optionally set the path to the data directory. It defaults to `$PWD/jsonlite.data` but can manually be set with the `JSONLITE_PATH` environment variable.
23+
You may optionally set the path to the data directory. It defaults to `$PWD/jsonlite.data` but can manually be set with the `JSONLITE_DATA_DIR` environment variable.
2524

2625
````
2726
# default
28-
export JSONLITE_PATH=$PWD/jsonlite.data
27+
export JSONLITE_DATA_DIR="$PWD"/jsonlite.data
2928
30-
# manually set to /tmp/jsonlite.data
31-
export JSONLITE_PATH=/tmp/jsonlite.data
29+
# manually set the data directory
30+
export JSONLITE_DATA_DIR=/tmp/jsonlite.data
3231
````
3332

3433
## API/Commands
@@ -154,7 +153,7 @@ For more information on semantic versioning, visit http://semver.org/.
154153

155154
## License & Legal
156155

157-
Copyright 2016 Justin Keller
156+
Copyright 2017 Justin Keller
158157

159158
Licensed under the Apache License, Version 2.0 (the "License");
160159
you may not use this file except in compliance with the License.

jsonlite.bash

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
###############################################################################
4-
# Copyright 2016 Justin Keller
4+
# Copyright 2017 Justin Keller
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -18,16 +18,16 @@
1818

1919
set -eo pipefail; [[ $TRACE ]] && set -x
2020

21-
readonly VERSION="0.8.0"
22-
export JSONLITE_PATH=${JSONLITE_PATH:="$PWD/jsonlite.data"}
21+
readonly VERSION="1.0.0"
22+
export JSONLITE_DATA_DIR=${JSONLITE_DATA_DIR:="$PWD/jsonlite.data"}
2323

2424
jsonlite_version() {
2525
echo "JSONlite $VERSION"
2626
}
2727

2828
jsonlite_info() {
2929
jsonlite_version
30-
echo "JSONLITE_PATH=$JSONLITE_PATH"
30+
echo "JSONLITE_DATA_DIR=$JSONLITE_DATA_DIR"
3131
echo
3232
}
3333

@@ -70,21 +70,21 @@ jsonlite_set() {
7070
exit 4
7171
fi
7272

73-
if [[ ! -d "$JSONLITE_PATH" ]]; then
74-
mkdir -p "$JSONLITE_PATH"
73+
if [[ ! -d "$JSONLITE_DATA_DIR" ]]; then
74+
mkdir -p "$JSONLITE_DATA_DIR"
7575
fi
7676

7777
local uuid
7878
uuid=$(uuidgen | awk '{print toupper($0)}')
7979

8080
if command -v json_reformat > /dev/null 2>&1; then
81-
echo "$value" | json_reformat > "$JSONLITE_PATH/$uuid"
81+
echo "$value" | json_reformat > "$JSONLITE_DATA_DIR/$uuid"
8282
elif command -v jq > /dev/null 2>&1; then
8383
# use the not-as-fast jq library if available
84-
echo "$value" | jq '.' > "$JSONLITE_PATH/$uuid"
84+
echo "$value" | jq '.' > "$JSONLITE_DATA_DIR/$uuid"
8585
else
8686
# fallback to the slowest json.tool
87-
echo "$value" | python -m json.tool > "$JSONLITE_PATH/$uuid"
87+
echo "$value" | python -m json.tool > "$JSONLITE_DATA_DIR/$uuid"
8888
fi
8989

9090
echo "$uuid"
@@ -102,19 +102,19 @@ jsonlite_get() {
102102
exit 6
103103
fi
104104

105-
if [[ -f "$JSONLITE_PATH/$document_id" ]]; then
106-
cat "$JSONLITE_PATH/$document_id"
105+
if [[ -f "$JSONLITE_DATA_DIR/$document_id" ]]; then
106+
cat "$JSONLITE_DATA_DIR/$document_id"
107107
fi
108108
}
109109

110110
jsonlite_count() {
111-
if [[ ! -d "$JSONLITE_PATH" ]]; then
111+
if [[ ! -d "$JSONLITE_DATA_DIR" ]]; then
112112
echo 0
113113
exit 0
114114
fi
115115

116116
local count
117-
count=$(find "$JSONLITE_PATH" -type f | wc -l)
117+
count=$(find "$JSONLITE_DATA_DIR" -type f | wc -l)
118118

119119
# piping to xargs is a trick to trim (remove leading & trailing whitespace)
120120
echo "$count" | xargs
@@ -132,24 +132,24 @@ jsonlite_delete() {
132132
exit 6
133133
fi
134134

135-
if [[ -f "$JSONLITE_PATH/$document_id" ]]; then
136-
rm -f "$JSONLITE_PATH/$document_id"
135+
if [[ -f "$JSONLITE_DATA_DIR/$document_id" ]]; then
136+
rm -f "$JSONLITE_DATA_DIR/$document_id"
137137
fi
138138
}
139139

140140
jsonlite_drop() {
141-
if [[ ! -d "$JSONLITE_PATH" ]]; then
141+
if [[ ! -d "$JSONLITE_DATA_DIR" ]]; then
142142
return $?
143143
fi
144144

145145
if [[ "$1" == "--force" ]]; then
146-
rm -rf "$JSONLITE_PATH"
146+
rm -rf "$JSONLITE_DATA_DIR"
147147
return $?
148148
fi
149149

150-
read -rp "Drop database '$JSONLITE_PATH'? [Y/n] " confirm
150+
read -rp "Drop database '$JSONLITE_DATA_DIR'? [Y/n] " confirm
151151
case "$confirm" in
152-
y|Y|yes|YES ) rm -rf "$JSONLITE_PATH";;
152+
y|Y|yes|YES ) rm -rf "$JSONLITE_DATA_DIR";;
153153
* ) exit 7;;
154154
esac
155155
}

tests/set_500.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22
set -eo pipefail; [[ $TRACE ]] && set -x
33

4-
export JSONLITE_PATH
5-
JSONLITE_PATH="$(dirname "$0")/jsonlite.data"
4+
export JSONLITE_DATA_DIR
5+
JSONLITE_DATA_DIR="$(dirname "$0")/jsonlite.data"
66
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../jsonlite.bash"
77

88
ITERATIONS=500

tests/set_get_delete_500.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22
set -eo pipefail; [[ $TRACE ]] && set -x
33

4-
export JSONLITE_PATH
5-
JSONLITE_PATH="$(dirname "$0")/jsonlite.data"
4+
export JSONLITE_DATA_DIR
5+
JSONLITE_DATA_DIR="$(dirname "$0")/jsonlite.data"
66
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../jsonlite.bash"
77

88
ITERATIONS=500

0 commit comments

Comments
 (0)