File tree 3 files changed +79
-5
lines changed
3 files changed +79
-5
lines changed Original file line number Diff line number Diff line change
1
+ language : bash
2
+ # https://github.com/caarlos0-graveyard/shell-ci-build
3
+
4
+ # The Ubuntu Linux Build Environments
5
+ # https://docs.travis-ci.com/user/reference/linux/
6
+ dist : precise
7
+
8
+ script :
9
+ - test-cases/integration-test.sh
10
+
11
+ after_script :
12
+ - git status --ignored
Original file line number Diff line number Diff line change 3
3
4
4
<img src =" docs/script-logo.png " width =" 20% " align =" right " />
5
5
6
- [ ![ License] ( https://img.shields.io/badge/license-Apache%202-4EB1BA.svg )] ( https://www.apache.org/licenses/LICENSE-2.0.html )
7
- [ ![ Join the chat at https://gitter.im/oldratlee/useful-scripts ] ( https://badges.gitter.im/oldratlee/useful-scripts.svg )] ( https://gitter.im/oldratlee/useful-scripts?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge )
6
+ [ ![ Build Status] ( https://img.shields.io/travis/oldratlee/useful-scripts/dev-2.x?logo=travis-ci&logoColor=white )] ( https://travis-ci.org/oldratlee/useful-scripts )
8
7
[ ![ GitHub release] ( https://img.shields.io/github/release/oldratlee/useful-scripts.svg )] ( https://github.com/oldratlee/useful-scripts/releases )
9
- [ ![ GitHub stars] ( https://img.shields.io/github/stars/oldratlee/useful-scripts.svg?style=social&label=Star& )] ( https://github.com/oldratlee/useful-scripts/stargazers )
10
- [ ![ GitHub forks] ( https://img.shields.io/github/forks/oldratlee/useful-scripts.svg?style=social&label=Fork& )] ( https://github.com/oldratlee/useful-scripts/fork )
11
-
8
+ [ ![ License] ( https://img.shields.io/github/license/oldratlee/useful-scripts?color=4D7A97 )] ( https://www.apache.org/licenses/LICENSE-2.0.html )
9
+ [ ![ Chat at gitter.im] ( https://img.shields.io/gitter/room/oldratlee/useful-scripts?color=46BC99&logo=gitter&logoColor=white )] ( https://gitter.im/oldratlee/useful-scripts?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge )
10
+ [ ![ GitHub Stars] ( https://img.shields.io/github/stars/oldratlee/useful-scripts )] ( https://github.com/oldratlee/useful-scripts/stargazers )
11
+ [ ![ GitHub Forks] ( https://img.shields.io/github/forks/oldratlee/useful-scripts )] ( https://github.com/oldratlee/useful-scripts/fork )
12
+ [ ![ GitHub issues] ( https://img.shields.io/github/issues/oldratlee/useful-scripts )] ( https://github.com/oldratlee/useful-scripts/issues )
13
+ [ ![ GitHub Contributors] ( https://img.shields.io/github/contributors/oldratlee/useful-scripts )] ( https://github.com/oldratlee/useful-scripts/graphs/contributors )
12
14
13
15
👉 把平时有用的手动操作做成脚本,这样可以便捷的使用。 ✨
14
16
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -eEuo pipefail
3
+ cd " $( dirname " $( readlink -f " ${BASH_SOURCE[0]} " ) " ) "
4
+
5
+ # ###############################################################################
6
+ # constants
7
+ # ###############################################################################
8
+
9
+ # NOTE: $'foo' is the escape sequence syntax of bash
10
+ readonly ec=$' \033 ' # escape char
11
+ readonly eend=$' \033 [0m' # escape end
12
+ readonly nl=$' \n ' # new line
13
+
14
+ # ###############################################################################
15
+ # common util functions
16
+ # ###############################################################################
17
+
18
+ colorEcho () {
19
+ local color=$1
20
+ shift
21
+
22
+ # if stdout is the console, turn on color output.
23
+ [ -t 1 ] && echo " ${ec} [1;${color} m$* ${eend} " || echo " $* "
24
+ }
25
+
26
+ redEcho () {
27
+ colorEcho 31 " $@ "
28
+ }
29
+
30
+ yellowEcho () {
31
+ colorEcho 33 " $@ "
32
+ }
33
+
34
+ blueEcho () {
35
+ colorEcho 36 " $@ "
36
+ }
37
+
38
+ logAndRun () {
39
+ local simple_mode=false
40
+ [ " $1 " = " -s" ] && {
41
+ simple_mode=true
42
+ shift
43
+ }
44
+
45
+ if $simple_mode ; then
46
+ echo " Run under work directory $PWD : $* "
47
+ " $@ "
48
+ else
49
+ blueEcho " Run under work directory $PWD :$nl $* "
50
+ time " $@ "
51
+ fi
52
+ }
53
+
54
+ # ###############################################################################
55
+ # run *_test.sh unit test cases
56
+ # ###############################################################################
57
+
58
+ for test_case in * _test.sh; do
59
+ logAndRun ./" $test_case "
60
+ done
You can’t perform that action at this time.
0 commit comments