diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b91abfb3edebeb0ed68f5a19548d21d38c545ae9..ceccdb87a96c8abc7f6b7d5229b5df81dfd30f29 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 ac35e407f4d40ff1347f5d1b894aa51b364399b4..a8093d1bd1b145bf11b662c7140ab36f5cefb14f 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 77486a3d870f4a27da777325e0f5756e2117ee90..38c1084b0a7b499488f945de67cfe7b022183e89 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 0000000000000000000000000000000000000000..af49d6bf3b805a3793205a211a146cae6d13102a --- /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 ../