Skip to content

Commit 79aa7e6

Browse files
committed
test
1 parent 5a03026 commit 79aa7e6

File tree

10 files changed

+926
-35
lines changed

10 files changed

+926
-35
lines changed

astra-shell/README.MD

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
[![License Apache2](https://img.shields.io/hexpm/l/plug.svg)](http://www.apache.org/licenses/LICENSE-2.0)
44

5-
## Overview
5+
_This component is in heavy development that can lead to breaking changes._
66

7-
_This component is in heavy development that can lead to breaking changes_
87

98
## Installation
109

@@ -16,9 +15,13 @@ Installing ASTRA-CLI on UNIX-like platforms is as easy as ever. ASTRA-CLI instal
1615
curl -Ls curl -s "https://dtsx.io/get-astra-cli" | bash
1716
```
1817

19-
- Follow the instructions on-screen to complete installation. Next, open a new terminal or enter:
18+
- Follow the instructions on-screen to complete installation.
2019

21-
$ source "$HOME/.astra/install/astra-init.sh"
20+
- To get autocompletion open a new terminal :
21+
22+
```
23+
source "$HOME/.astra/install/astra-init.sh"
24+
```
2225

2326
- Lastly, run the following code snippet to ensure that installation succeeded:
2427

@@ -46,7 +49,7 @@ astra setup
4649
astra config list
4750
```
4851

49-
>```
52+
```
5053
+-----------------------------------------+
5154
| configuration |
5255
+-----------------------------------------+
@@ -62,7 +65,7 @@ astra config list
6265
astra db list
6366
```
6467

65-
>```
68+
```
6669
+---------------------+--------------------------------------+---------------------+----------------+
6770
| name | id | default-region | status |
6871
+---------------------+--------------------------------------+---------------------+----------------+

astra-shell/src/test/resources/astra-install.sh renamed to astra-shell/dist/astra-install.sh

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,26 @@ echo_failed_command() {
1616
}
1717
trap echo_failed_command EXIT
1818

19-
2019
# Global variables
21-
ASTRA_VERSION="5.15.0"
22-
ASTRA_PLATFORM=$(uname)
23-
24-
if [ -z "$ASTRA_DIR" ]; then
25-
ASTRA_DIR="$HOME/.astra"
26-
ASTRA_DIR_RAW='$HOME/.astra'
27-
else
28-
ASTRA_DIR_RAW="$ASTRA_DIR"
29-
fi
20+
ASTRA_CLI_VERSION="0.3.2-alpha1"
21+
ASTRA_CLI_PLATFORM=$(uname)
22+
ASTRA_CLI_DIR="$HOME/.astra/cli"
23+
ASTRA_CLI_DIR_RAW='$HOME/.astra/cli'
3024

3125
# Local variables
32-
astra_tmp_folder="${ASTRA_DIR}/tmp"
33-
astra_zip_file="${astra_tmp_folder}/astra-cli-${ASTRA_VERSION}.zip"
34-
astra_zip_base_folder="${astra_tmp_folder}/astra-cli-${ASTRA_VERSION}"
26+
astra_tmp_folder="$HOME/.astra/tmp"
27+
astra_zip_file="${astra_tmp_folder}/astra-cli-${ASTRA_CLI_VERSION}.zip"
28+
astra_zip_base_folder="${astra_tmp_folder}/astra-cli-${ASTRA_CLI_VERSION}"
3529

36-
astra_config_file="${ASTRA_DIR}/config"
30+
# Config Files
3731
astra_bash_profile="${HOME}/.bash_profile"
3832
astra_profile="${HOME}/.profile"
3933
astra_bashrc="${HOME}/.bashrc"
4034
astra_zshrc="${ZDOTDIR:-${HOME}}/.zshrc"
41-
4235
astra_init_snippet=$( cat << EOF
4336
#THIS MUST BE AT THE END OF THE FILE FOR ASTRA TO WORK!!!
44-
export ASTRADIR="$ASTRADIR_RAW"
45-
[[ -s "${ASTRA_DIR_RAW}/bin/astra-init.sh" ]] && source "${ASTRA_DIR_RAW}/bin/astra-init.sh"
37+
export ASTRADIR="$ASTRA_CLI_DIR_RAW"
38+
[[ -s "${ASTRADIR}/astra-init.sh" ]] && source "${ASTRADIR}/astra-init.sh"
4639
EOF
4740
)
4841

@@ -75,7 +68,7 @@ if [ -d "$ASTRA_DIR" ]; then
7568
echo " You already have ASTRA-CLI installed."
7669
echo " ASTRA-CLI was found at:"
7770
echo ""
78-
echo " ${ASTRA_DIR}"
71+
echo " ${ASTRA_CLI_DIR}"
7972
echo ""
8073
echo " Please delete this folder if you need to upgrade."
8174
echo "======================================================================================================"
@@ -150,20 +143,19 @@ else
150143
fi
151144
fi
152145

153-
echo "Installing ASTRA-CLI scripts..."
154-
146+
echo "Installing Astra Cli scripts..."
155147

156148
# Create directory structure
157149

158150
echo "Create distribution directories..."
159151
mkdir -p "$astra_tmp_folder"
152+
mkdir -p "$ASTRA_CLI_DIR_RAW"
160153

161154
# script cli distribution
162155
echo "Installing script cli archive..."
163156
# fetch distribution
164157
download_url="${ASTRA_SERVICE}/...."
165-
astra_zip_file="${astra_tmp_folder}/sdkman-${ASTRAVERSION}.zip"
166-
astra_zip_base_folder="${astra_tmp_folder}/sdkman-${ASTRA)VERSION}"
158+
astra_zip_file="${astra_tmp_folder}/astra-cli-${ASTRAVERSION}.zip"
167159
echo "* Downloading..."
168160
curl --fail --location --progress-bar "$download_url" > "$astra_zip_file"
169161

@@ -201,21 +193,20 @@ rm -rf "$astra_zip_file"
201193
echo ""
202194

203195

204-
echo "Set version to $ASTRA_VERSION ..."
205-
echo "$ASTRA_VERSION" > "${ASTRA_DIR}/var/version"
206-
196+
echo "Set version to $ASTRA_CLI_VERSION ..."
197+
echo "$ASTRA_CLI_VERSION" > "${ASTRA_CLI_DIR}/var/version"
207198

208199
if [[ $darwin == true ]]; then
209200
touch "$astra_bash_profile"
210201
echo "Attempt update of login bash profile on OSX..."
211-
if [[ -z $(grep 'sdkman-init.sh' "$astra_bash_profile") ]]; then
202+
if [[ -z $(grep 'astra-init.sh' "$astra_bash_profile") ]]; then
212203
echo -e "\n$astra_init_snippet" >> "$astra_bash_profile"
213204
echo "Added astra init snippet to $astra_bash_profile"
214205
fi
215206
else
216207
echo "Attempt update of interactive bash profile on regular UNIX..."
217208
touch "${astra_bashrc}"
218-
if [[ -z $(grep 'sdkman-init.sh' "$astra_bashrc") ]]; then
209+
if [[ -z $(grep 'astra-init.sh' "$astra_bashrc") ]]; then
219210
echo -e "\n$astra_init_snippet" >> "$astra_bashrc"
220211
echo "Added astra init snippet to $astra_bashrc"
221212
fi
@@ -234,7 +225,7 @@ echo -e "\n\n\nAll done!\n\n"
234225
echo ""
235226
echo "Please open a new terminal, or run the following in the existing one:"
236227
echo ""
237-
echo " source \"${ASTRA_DIR}/bin/astra-init.sh\""
228+
echo " source \"${ASTRA_CLI_DIR}/astra-init.sh\""
238229
echo ""
239230
echo "Then issue the following command:"
240231
echo ""

astra-shell/src/test/java/com/datastax/astra/bash/GenerateBashCompletion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void main(String[] args) {
1414
Cli<Runnable> cli = new Cli<Runnable>(AstraCli.class);
1515
GlobalUsageGenerator<Runnable> helpGenerator = new BashCompletionGenerator<>();
1616
try {
17-
helpGenerator.usage(cli.getMetadata(), new FileOutputStream("src/main/resources/auto-completions.bash"));
17+
helpGenerator.usage(cli.getMetadata(), new FileOutputStream("dist/astra-init.sh"));
1818
} catch (IOException e) {
1919
e.printStackTrace();
2020
}

0 commit comments

Comments
 (0)