Skip to content

Commit 9151363

Browse files
committed
General fix
1 parent ac24e8f commit 9151363

File tree

6 files changed

+53
-51
lines changed

6 files changed

+53
-51
lines changed

.github/workflows/CI.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ jobs:
348348
run: |
349349
chmod +x swiftbox.sh
350350
./swiftbox.sh version
351-
351+
352352
- name: Test swiftbox lookup nightly
353353
run: ./swiftbox.sh lookup nightly
354354

@@ -388,7 +388,7 @@ jobs:
388388
run: |
389389
chmod +x swiftbox.sh
390390
./swiftbox.sh version
391-
391+
392392
- name: Test swiftbox lookup nightly
393393
run: ./swiftbox.sh lookup nightly
394394

.github/workflows/Tag.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@v2
13-
13+
1414
- id: main
1515
name: Test swiftbox
1616
run: |

CONTRIBUTING.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,50 @@
22

33
## Design Guideline and Pull Requests
44

5-
This project follows the following design guidelines, which will continue until the next breaking change of the Swift toolchain or itself.
5+
This project follows the following design guidelines, which will continue until the next breaking change of the Swift toolchain or itself.
66

7-
If you'd like to contribute to the project by implementing a new feature or fixing bugs, make sure your code and API matches them.
7+
If you'd like to contribute to the project by implementing a new feature or fixing bugs, make sure your code and API matches them.
88

99
- **Single-file and lightweight.** Keep it a single-file executable which can be easily installed or use as a script without any config.
10-
- **Specific for platforms excluding macOS.** Apple has already provided a bunch of great Swift tools like `xcrun` on macOS and sometimes Darwin behaves differently from Linux, making Darwin support hard but quite useless.
11-
- **Unaffected by unmanaged environment variables,** which is likely to differ between shells on the same system. The users are assumed to be totally ignorant about environment variables.
10+
- **Specific for platforms excluding macOS.** Apple has already provided a bunch of great Swift tools like `xcrun` on macOS and sometimes Darwin behaves differently from Linux, making Darwin support hard but quite useless.
11+
- **Unaffected by unmanaged environment variables,** which is likely to differ between shells on the same system. The users are assumed to be totally ignorant about environment variables.
1212
- **Keeping different defaults of system-wide, user-wide and project-wide**(coming at the next version). This allows `sudoer`s to install and configure Swift for its users.
13-
- **Independent of any self-hosted APIs.** Use only official websites and repositories to retrieve package information and the toolchain.
14-
- **Avoiding hard-coded information** like versions. This generally gives the program longer usability, while it can be discussed in specific cases.
13+
- **Independent of any self-hosted APIs.** Use only official websites and repositories to retrieve package information and the toolchain.
14+
- **Avoiding hard-coded information** like versions. This generally gives the program longer usability, while it can be discussed in specific cases.
1515

16-
If you're going to add a new feature or make breaking changes, **you're suggested to make a proposal by creating an issue before starting your implementation**, so that we can discuss about it in advance, making sure your idea is fit for the project.
16+
If you're going to add a new feature or make breaking changes, **you're suggested to make a proposal by creating an issue before starting your implementation**, so that we can discuss about it in advance, making sure your idea is fit for the project.
1717

1818
## Commits and Pull Requests Naming Guide
1919

2020
`swiftbox` follows an easy naming guide, which simply contains two rules:
2121

22-
- Use **a verb phrase or a noun phrase** that describes what this commit or PR has done, and **start with upper case**.
23-
- If there's more than one, remember to concat them like: one, two and three.
22+
- Use **a verb phrase or a noun phrase** that describes what this commit or PR has done, and **start with upper case**.
23+
- If there's more than one, remember to concat them like: one, two and three.
2424

2525
Here are some suggested verbs to use:
2626

27-
- Fix: Always use `Fix` when you fixes a bug; Alternatively, you can use the noun form.
28-
- Add: Always use `Add` when you add a new file or a project-related feature; Sometimes, you can omit `Add` to make the message a nown.
29-
- Support: Always use `Support` when you add a new subcommand or feature to the main program.
30-
- Improve: You are suggested to use `Improve` when you refine the working process of any subcommand or module.
27+
- Fix: Always use `Fix` when you fixes a bug; Alternatively, you can use the noun form.
28+
- Add: Always use `Add` when you add a new file or a project-related feature; Sometimes, you can omit `Add` to make the message a nown.
29+
- Support: Always use `Support` when you add a new subcommand or feature to the main program.
30+
- Improve: You are suggested to use `Improve` when you refine the working process of any subcommand or module.
3131

3232
## API Naming Guide
3333

3434
`swiftbox` currently provides an unstable cli. When you design a new API, you simply need to:
3535

36-
- **Use a verb** instead of a noun (The `version` command is a counter-example which I'm going to refine).
37-
- Use a simple verb, and **imagine you're doing this with a magic box**.
36+
- **Use a verb** instead of a noun (The `version` command is a counter-example which I'm going to refine).
37+
- Use a simple verb, and **imagine you're doing this with a magic box**.
3838

3939
## Coding Style
4040

41-
Commits of pull requests will be asked to follow the coding (including naming, indentation and line-break) style of the original project. Here're some instructions:
41+
Commits of pull requests will be asked to follow the coding (including naming, indentation and line-break) style of the original project. Here're some instructions:
4242

43-
- Use `verb-noun` styled function names, or `is-predicative` ones if the return value is used as a bool result.
44-
- Use `OBJECT` or `ATTRIBUTE_OBJECT` styled variable names.
45-
- Keep variables `local` if possible.
43+
- Use `verb-noun` styled function names, or `is-predicative` ones if the return value is used as a bool result.
44+
- Use `OBJECT` or `ATTRIBUTE_OBJECT` styled variable names.
45+
- Keep variables `local` if possible.
4646

4747
## About Operating System Supports
4848

49-
This project is **temporarily** dedicated to officially supported operating systems excluding macOS. If you want to configure it for another platform, welcome to fork as a new one.
49+
This project is **temporarily** dedicated to officially supported operating systems excluding macOS. If you want to configure it for another platform, welcome to fork as a new one.
5050

5151
Once Swift.org releases installation packages for other distributions, you can support them by creating pull requests.

README.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
![Release](https://img.shields.io/github/v/release/stevapple/swiftbox?logo=github) ![CI Status](https://github.com/stevapple/swiftbox/workflows/CI/badge.svg)
44

5-
Inspired by [pyenv](https://github.com/pyenv/pyenv) and [rbenv](https://github.com/rbenv/rbenv), and having different APIs.
5+
Inspired by [pyenv](https://github.com/pyenv/pyenv) and [rbenv](https://github.com/rbenv/rbenv), and having different APIs.
66

77
## Installation
88

9-
By default, `swiftbox` will be installed at `/usr/bin`. The working directory will be set to `/opt/swiftbox` for `root` and `~/.swiftbox` for other users.
9+
By default, `swiftbox` will be installed at `/usr/bin`. The working directory will be set to `/opt/swiftbox` for `root` and `~/.swiftbox` for other users.
1010

11-
There will be two sets of Swift environments if you use both. The local one is in favor by default unless you access `swiftbox` with `sudo`. Toolchains installed by `root` can be used by all users.
11+
There will be two sets of Swift environments if you use both. The local one is in favor by default unless you access `swiftbox` with `sudo`. Toolchains installed by `root` can be used by all users.
1212

1313
```bash
1414
# With curl (Recommended)
@@ -21,7 +21,7 @@ chmod +x install.sh
2121
./install.sh
2222
```
2323

24-
Or if you'd like to use it as a script (do not support `update` yet):
24+
Or if you'd like to use it as a script (doesn't support `update` yet):
2525

2626
```bash
2727
# With wget
@@ -40,7 +40,7 @@ chmod +x swiftbox.sh
4040
./swiftbox.sh version
4141
```
4242

43-
You can designate a release version by using jsDelivr or git, which also has wider availability:
43+
You can specify release version by using jsDelivr or git, which also has wider availability:
4444

4545
```bash
4646
# With wget
@@ -62,7 +62,7 @@ chmod +x swiftbox.sh
6262

6363
You can later install it to `/usr/bin`:
6464

65-
```shell
65+
```console
6666
$ sudo ./swiftbox.sh install
6767
Successfully installed swiftbox at /usr/bin
6868
$ which swiftbox
@@ -73,51 +73,53 @@ $ which swiftbox
7373

7474
### Lookup `swiftbox` version
7575

76-
```shell
76+
```console
7777
$ swiftbox version
7878
0.9
7979
```
8080

8181
### Check the availability of Swift versions
8282

83-
```shell
83+
```console
8484
$ swiftbox lookup 5.1
8585
Swift 5.1 is available for Ubuntu 18.04
8686
$ swiftbox lookup nightly
87-
Swift nightly build 2020-05-11-a is available for Ubuntu 18.04
87+
Swift nightly build 2020-05-11-a is available for Amazon Linux 2
8888
$ swiftbox lookup 2.1
89-
Swift 2.1 does not exist or does not support your Ubuntu version.
89+
Swift 2.1 does not exist or does not support your CentOS Linux version.
9090
```
9191

9292
### Manage Swift versions
9393

94-
Both release builds and the latest nightly build are available.
94+
Both release builds and the latest nightly build are available.
9595

96-
```shell
96+
```console
9797
$ swiftbox get 5.2.2
9898
$ swiftbox get nightly
9999
$ swiftbox remove 5.0
100100
```
101101

102102
### Switch to a Swift version
103103

104-
```shell
104+
```console
105105
$ swiftbox use 5.2.2
106-
Now using Swift 5.2.2
106+
[user] Now using Swift 5.2.2
107107
```
108108

109+
You may notice a `[user]` or `[global]` prefix, which indicates the scope of swiftbox operations.
110+
109111
### Disable Swift
110112

111-
```shell
112-
$ swiftbox close
113-
Swift 5.2.2 is now disabled.
113+
```console
114+
$ sudo swiftbox close
115+
[global] Swift 5.2.2 is now disabled.
114116
```
115117

116118
### Lookup installed Swift versions
117119

118-
The active one is marked with `*`.
120+
The active one is marked with `*`.
119121

120-
```shell
122+
```console
121123
$ swiftbox list
122124
- 2020-05-10-a
123125
- 4.2.1
@@ -126,16 +128,16 @@ $ swiftbox list
126128

127129
### Clear download cache
128130

129-
```shell
131+
```console
130132
$ swiftbox clean
131-
Successfully cleaned the cache.
133+
[user] Successfully cleaned the cache.
132134
```
133135

134136
### Update `swiftbox`
135137

136-
Update to the latest version if `swiftbox` is installed in `/usr/bin`.
138+
Update to the latest version if `swiftbox` is installed in `/usr/bin`.
137139

138-
```shell
140+
```console
139141
$ swiftbox update
140-
Successfully upgraded swiftbox from 0.6.2 to 0.9
142+
Successfully upgraded swiftbox from 0.9 to 0.10.6
141143
```

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ else
3434
fi
3535

3636
if [ "$UNSUPPORTED_SYSTEM" ]
37-
then
37+
then
3838
echo "This program only supports Ubuntu, CentOS(RHEL) and Amazon Linux."
3939
echo "$UNSUPPORTED_SYSTEM is unsupported."
4040
exit 255

swiftbox.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
SWIFTBOX_VERSION="0.10.6"
3+
SWIFTBOX_VERSION="0.10.7"
44

55
if [ `id -u` = 0 ]
66
then
@@ -56,7 +56,7 @@ else
5656
fi
5757

5858
if [ "$UNSUPPORTED_SYSTEM" ]
59-
then
59+
then
6060
echo "This program only supports Ubuntu, CentOS(RHEL) and Amazon Linux."
6161
echo "$UNSUPPORTED_SYSTEM is unsupported."
6262
exit 255
@@ -210,7 +210,7 @@ disable-swift() {
210210

211211
default-version() {
212212
if [ ! -f $WORKING_DIR/.swift-version ]
213-
then
213+
then
214214
echo ""
215215
else
216216
cat $WORKING_DIR/.swift-version

0 commit comments

Comments
 (0)