From 07b54eba7ab93ba64662a019b8133b2b201b7490 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Thu, 4 May 2017 13:02:50 +0300 Subject: [PATCH] - Added install script, updated documentation. - Added test to install script, test also on OSX for a BSD userland. --- .pre-commit-config.yaml | 4 ++-- .travis.yml | 25 +++++++++++++++++-------- README.rst | 13 +------------ install | 22 ++++++++++++++++++++++ 4 files changed, 42 insertions(+), 22 deletions(-) create mode 100755 install diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b91abfb..ceccdb8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,6 +9,6 @@ sha: v0.4.0 hooks: - id: shell-lint - files: \.bashrc|\.githooks/post-merge|\.profile|Documents/Shore/cleanup/docker-.*|Documents/train-wifi\.sh + files: \.bashrc|\.githooks/post-merge|\.profile|Documents/Shore/cleanup/docker-.*|Documents/train-wifi\.sh|install - id: shellcheck - files: \.bashrc|\.githooks/post-merge|\.profile|Documents/Shore/cleanup/docker-.*|Documents/train-wifi\.sh + files: \.bashrc|\.githooks/post-merge|\.profile|Documents/Shore/cleanup/docker-.*|Documents/train-wifi\.sh|install diff --git a/.travis.yml b/.travis.yml index ac35e40..a8093d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,19 @@ --- -language: python -python: "3.6" -dist: trusty -sudo: false -group: beta +matrix: + include: + - os: linux + dist: trusty + sudo: false + group: beta + language: python + python: 3.6 + install: + - pip install pre_commit | cat + - os: osx + language: generic + install: + - brew install shellcheck + - pip install pre_commit | cat cache: - pip - directories: @@ -16,11 +26,10 @@ addons: packages: - shellcheck -install: - - pip install pre_commit | cat - script: - pre-commit run --all-files + - cd; $TRAVIS_BUILD_DIR/install + - git bull notifications: email: false diff --git a/README.rst b/README.rst index 77486a3..38c1084 100644 --- a/README.rst +++ b/README.rst @@ -18,18 +18,7 @@ WARNING: This will overwrite your existing files. .. code:: shell git clone https://www.shore.co.il/git/rcfiles - cd rcfiles - mv -f $(ls -A) $HOME/ - cd .. - rm -r rcfiles - git submodule update --init --recursive - cd .githooks/ - find -type f -exec ln -sf ../../.githooks/{} ../.git/hooks/ \; - cd ../ - -In older versions of Git the paths in the submodules are obsolete and thus need -to be corrected (before fetching them). The correction needs to be done in the -:code:`.git` and :code:`config` files inside each submodule. + rcfiles/install License ------- diff --git a/install b/install new file mode 100755 index 0000000..af49d6b --- /dev/null +++ b/install @@ -0,0 +1,22 @@ +#!/bin/sh +set -eu +case "$0" in + \.*) + git_root="$PWD/$(dirname "$0")";; + *) + git_root="$(dirname "$0")";; +esac +for file in $(git -C "$git_root" ls-files) +do + mkdir -p "$(dirname "$HOME/$file")" + mv -f "$git_root/$file" "$HOME/$file" +done +mv "$git_root/.git" "$HOME/" +cd +rm -r "$git_root" +find -name .git -type f -exec sed -i "s@$git_root@$HOME@g" {} \; +find -name config -type f -exec sed -i "s@$git_root@$HOME@g" {} \; +git submodule update --remote +cd .githooks +find -type f -exec ln -sf ../../.githooks/{} ../.git/hooks/ \; +cd ../ -- GitLab