Skip to content

Commit 93f21d0

Browse files
committed
replacing _DIR with _HOME
1 parent 9c688aa commit 93f21d0

3 files changed

Lines changed: 25 additions & 25 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ may be called.
1111
## How To Install
1212

1313
Just clone the git repo and place the *soda* file in your path (a symlinks works well to).
14-
After that, ensure you have a **$SODA_DIR** pointing to the place you clone the repo and you're
14+
After that, ensure you have a **$SODA_HOME** pointing to the place you clone the repo and you're
1515
done.
1616

1717
## How To Use
@@ -20,10 +20,10 @@ Create a *~/.soda* directory with the following structure:
2020

2121
* _scripts_ - directory to put the scripts organized by namespaces
2222
* _config_ - directory to put the configuration files organized by namespaces
23-
* _resources_ - directory to put resources organized by namespaces
23+
* Any other directory you like, still organized by namespaces
2424

25-
You can also use the same directory you install soda without configure the user directory. To access
26-
resource and configuration files, use the **exists** function.
25+
You can also use the same directory you install soda without configure the user directory. You can
26+
access any file in that directories by using the **exists** function.
2727

2828
Inside *scripts*, any function in any script present in *scripts/common* and exposed through
2929
**task** can be invoked:
@@ -158,13 +158,13 @@ completion mode.
158158

159159
## Configuration
160160

161-
Every namespace has it own configuration dir in $SODA_USER_DIR/config/NAMESPACE. Any configuration
161+
Every namespace has it own configuration dir in $SODA_USER_HOME/config/NAMESPACE. Any configuration
162162
file will be loaded in that directory at namespace import **before** loading script files.
163163

164-
You can configure **soda** namespace through a **$SODA_USER_DIR/conf/soda/soda.conf** file (or any
164+
You can configure **soda** namespace through a **$SODA_USER_HOME/conf/soda/soda.conf** file (or any
165165
other name but inside that directory). The supported properties are:
166166

167-
* **LOG_FILE** - The log file (defaults to *$SODA_DIR/log/soda.log*)
167+
* **LOG_FILE** - The log file (defaults to *$SODA_HOME/log/soda.log*)
168168
* **SODA_NAMESPACE_DELIMITER** - The namespace delimiter (defaults to **.**). Changing this also
169169
affects the bash completion
170170
* **SODA_TASK_BASH_COMPLETION_SUFFIX** - The suffix to build the function for custom bash completion
@@ -229,7 +229,7 @@ underscores.
229229

230230
### exists (type path)
231231

232-
Checks if the file $SODA_USER_DIR/$type/$NAMESPACE/$path exists using the namespace of the invoked
232+
Checks if the file $SODA_USER_HOME/$type/$NAMESPACE/$path exists using the namespace of the invoked
233233
task or imported namespace. The file path will be stored in the $FILE variable.
234234

235235
exists config "my-config.conf" && {

scripts/core.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ clear_imports() {
139139

140140
#
141141
# Loads all scripts in the *scripts/namespace* directory. The scripts may be in
142-
# $SODA_USER_DIR or $SODA_DIR.
142+
# $SODA_USER_HOME or $SODA_HOME.
143143
#
144144
# If a namespace was already imported, then it will not be imported again.
145145
#
146-
# Example: to import the namespace denoted by $SODA_USER_DIR/scripts/install
146+
# Example: to import the namespace denoted by $SODA_USER_HOME/scripts/install
147147
# use `import install`.
148148
#
149149
import() {
@@ -158,14 +158,14 @@ import() {
158158
NAMESPACES="$NAMESPACES $1"
159159
local OLD_NAMESPACE="$NAMESPACE"
160160
NAMESPACE="$1"
161-
load_config "$SODA_DIR/config/$1"
162-
if ! [[ "$SODA_DIR" == "$SODA_USER_DIR" ]]; then
163-
load_config "$SODA_USER_DIR/config/$1"
161+
load_config "$SODA_HOME/config/$1"
162+
if ! [[ "$SODA_HOME" == "$SODA_USER_HOME" ]]; then
163+
load_config "$SODA_USER_HOME/config/$1"
164164
fi
165165

166-
load_scripts "$SODA_DIR/scripts/$1"
167-
if ! [[ "$SODA_DIR" == "$SODA_USER_DIR" ]]; then
168-
load_scripts "$SODA_USER_DIR/scripts/$1"
166+
load_scripts "$SODA_HOME/scripts/$1"
167+
if ! [[ "$SODA_HOME" == "$SODA_USER_HOME" ]]; then
168+
load_scripts "$SODA_USER_HOME/scripts/$1"
169169
fi
170170
NAMESPACE="$OLD_NAMESPACE"
171171
fi
@@ -182,9 +182,9 @@ _import_all() {
182182
}
183183

184184
import_all_namespaces() {
185-
_import_all $SODA_DIR
186-
if ! [[ "$SODA_DIR" == "$SODA_USER_DIR" ]]; then
187-
_import_all $SODA_USER_DIR
185+
_import_all $SODA_HOME
186+
if ! [[ "$SODA_HOME" == "$SODA_USER_HOME" ]]; then
187+
_import_all $SODA_USER_HOME
188188
fi
189189
}
190190

@@ -292,7 +292,7 @@ namespaces() {
292292
}
293293

294294
exists() {
295-
FILE="$SODA_USER_DIR/$1/$NAMESPACE/$2"
295+
FILE="$SODA_USER_HOME/$1/$NAMESPACE/$2"
296296
if [[ -f "$FILE" ]]; then
297297
return 0
298298
else

soda

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2323
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424

25-
[[ -z "$SODA_DIR" ]] && SODA_DIR=$(dirname $0)
26-
[[ -z "$SODA_USER_DIR" ]] && SODA_USER_DIR=$HOME/.soda
25+
[[ -z "$SODA_HOME" ]] && SODA_HOME=$(dirname $0)
26+
[[ -z "$SODA_USER_HOME" ]] && SODA_USER_HOME=$HOME/.soda
2727

28-
if ! [[ -d "$SODA_USER_DIR" ]]; then
29-
SODA_USER_DIR="$SODA_DIR"
28+
if ! [[ -d "$SODA_USER_HOME" ]]; then
29+
SODA_USER_HOME="$SODA_HOME"
3030
fi
3131

32-
. "$SODA_DIR/scripts/core.sh"
32+
. "$SODA_HOME/scripts/core.sh"
3333

3434
function usage {
3535
local task="TASK"

0 commit comments

Comments
 (0)