Skip to content

Commit

Permalink
added template files
Browse files Browse the repository at this point in the history
  • Loading branch information
reactive-firewall committed Jul 29, 2017
1 parent 3d4816f commit 2f8fd28
Show file tree
Hide file tree
Showing 8 changed files with 521 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*~

# C extensions
*.so

# Distribution / packaging
env/
build/
dist/
downloads/
lib/
lib64/
.cache
*.log
5 changes: 5 additions & 0 deletions .stickler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
linters:
shellcheck:
shell: bash
files:
ignore: ['*~', '.git', 'tests/*']
43 changes: 43 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
language: generic
sudo: false

branches:
only:
- stable
- master

matrix:
include:
- os: linux
language: generic
dist: trusty
- os: linux
language: generic
dist: precice
- os: osx
osx_image: xcode6.4
language: generic
- os: osx
osx_image: xcode7.2
language: generic
- os: osx
osx_image: xcode7.3
language: generic
- os: osx
osx_image: xcode8
language: generic
- os: osx
osx_image: xcode8.3
language: generic

install:
- make clean || true
- make install 2>/dev/null || true

script:
- make clean || true
- make test

after_success:
- echo "Done."

23 changes: 23 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
License - MIT

Copyright (c) 2017 Mr. Walls

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


110 changes: 110 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env make -f

# BASH Repo Template
# ..................................
# Copyright (c) 2017, Kendrick Walls
# ..................................
# Licensed under MIT (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# ..........................................
# http://www.github.com/reactive-firewall/bash-repo/LICENSE.md
# ..........................................
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


ifeq "$(ECHO)" ""
ECHO=echo
endif

ifeq "$(LINK)" ""
LINK=ln -sf
endif

ifeq "$(MAKE)" ""
MAKE=make
endif

ifeq "$(WAIT)" ""
WAIT=wait
endif

ifeq "$(INSTALL)" ""
INSTALL=install
ifeq "$(INST_OWN)" ""
INST_OWN=-o root -g staff
endif
ifeq "$(INST_OPTS)" ""
INST_OPTS=-m 755
endif
endif

ifeq "$(LOG)" ""
LOG=no
endif

ifeq "$(LOG)" "no"
QUIET=@
endif

ifeq "$(DO_FAIL)" ""
DO_FAIL=$(ECHO) "ok"
endif

PHONY: must_be_root cleanup

build:
$(QUIET)$(ECHO) "No need to build. Try make -f Makefile install"

init:
$(QUIET)$(ECHO) "$@: Done."

install: must_be_root ./bin/speed_test.bash /usr/local/bin/
$(QUIET)$(INSTALL) ./bin/speed_test.bash /usr/local/bin/speed_test
$(QUITE)$(WAIT)
$(QUIET)$(ECHO) "$@: Done."

uninstall:
$(QUITE)$(QUIET)rm -vf /usr/local/bin/speed_test 2>/dev/null || true
$(QUITE)$(WAIT)
$(QUIET)$(ECHO) "$@: Done."

purge: clean uninstall
$(QUIET)$(ECHO) "$@: Done."

test: cleanup
$(QUIET)bash ./tests/test_*sh
$(QUIET)$(ECHO) "$@: Done."

test-tox: cleanup
$(QUIET)$(ECHO) "$@: N/A."

test-style: cleanup
$(QUIET)$(ECHO) "$@: N/A."

cleanup:
$(QUIET)rm -f tests/*~ 2>/dev/null || true
$(QUIET)rm -f bin/*~ 2>/dev/null || true
$(QUIET)rm -f bin/*/*~ 2>/dev/null || true
$(QUIET)rm -f *.DS_Store 2>/dev/null || true
$(QUIET)rm -f bin/*.DS_Store 2>/dev/null || true
$(QUIET)rm -f bin/*/*.DS_Store 2>/dev/null || true
$(QUIET)rm -f ./*/*~ 2>/dev/null || true
$(QUIET)rm -f ./*~ 2>/dev/null || true
$(QUIET)rm -f ./.*~ 2>/dev/null || true
$(QUIET)rm -Rf ./.tox/ 2>/dev/null || true

clean: cleanup
$(QUIET)$(ECHO) "$@: Done."

must_be_root:
$(QUIET)runner=`whoami` ; \
if test $$runner != "root" ; then echo "You are not root." ; exit 1 ; fi

%:
$(QUIET)$(ECHO) "No Rule Found For $@" ; $(WAIT) ;

109 changes: 107 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,107 @@
# bash-repo
A simple template for Bash shellscript repos
# About
This repo is basically my template for new bash repos/projects

# CI Template:

By default this template will assume that the Travis CI Service is used for CI/CD

# Status

### master:
[![status](https://travis-ci.org/reactive-firewall/bash-repo.svg?branch=master)](https://travis-ci.org/reactive-firewall/bash-repo)
[![code coverage](https://codecov.io/gh/reactive-firewall/bash-repo/branch/master/graph/badge.svg)](https://codecov.io/gh/reactive-firewall/bash-repo/branch/master/)

### Stable:
[![status](https://travis-ci.org/reactive-firewall/bash-repo.svg?branch=stable)](https://travis-ci.org/reactive-firewall/bash-repo)
[![code coverage](https://codecov.io/gh/reactive-firewall/bash-repo/branch/stable/graph/badge.svg)](https://codecov.io/gh/reactive-firewall/bash-repo/branch/stable/)

# How do I use this to create a new project repo?

(assuming new project is already forked on github to `MY-NEW-REPO`)

```bash
# cd /MY-AWSOME-DEV-PATH
git clone https://github.com/reactive-firewall/MY-NEW-REPO.git MY-NEW-REPO
# cd ./MY-NEW-REPO
```

# Dev Testing Template:

In a rush? Then use this:

```bash
make clean ; # cleans up from any previous tests hopefully
make test ; # runs the tests
make clean ; # cleans up for next test
```

# Example Usage Template:

Want to use the Example `speed_test.bash` script then try this:

### Running...

```bash
speed_test.bash
```

### ...Outputs

```plain
Local: 4620K
Server: 1472K
```

# Example installing Template:

The following describes how to install the example script:

### Download...

```bash
cd /tmp
git clone https://github.com/reactive-firewall/bash-repo.git bash-repo
cd ./bash-repo
make clean
```

### ...install

(might need sudo)

```bash
make install
```

### ...uninstall

uninstall is similar

```bash
make uninstall
```

# License - MIT

## Copyright (c) 2017 Mr. Walls
###
### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
### AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
### LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
### OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
### SOFTWARE.
###
### Permission is hereby granted, free of charge, to any person obtaining a copy
### of this software and associated documentation files (the "Software"), to deal
### in the Software without restriction, including without limitation the rights
### to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
### copies of the Software, and to permit persons to whom the Software is
### furnished to do so, subject to the following conditions:
###
### The above copyright notice and this permission notice shall be included in all
### copies or substantial portions of the Software.

## USE AT OWN RISK.

Loading

0 comments on commit 2f8fd28

Please sign in to comment.