From 250fe263ef2e0e67e33d3f269d8d1153c0d867d0 Mon Sep 17 00:00:00 2001 From: jeremiejig Date: Tue, 15 Sep 2015 20:23:57 +0200 Subject: [PATCH 1/9] Travis: Adding fish-2.2.0 from github. Adding apt dependencies + build script + cache directive. --- .travis.yml | 19 +++++++++++++++++-- tests/install_fish.sh | 10 ++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 tests/install_fish.sh diff --git a/.travis.yml b/.travis.yml index de0d9a5..8e437b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,28 @@ sudo: false addons: apt: packages: + - bc + - doxygen + - expect + - gettext + - libncurses5-dev - tree - - fish + +env: + global: + - PATH="$HOME/fish/bin:$PATH" + +before_install: + - tests/install_fish.sh before_script: pwd; tree -h script: "/bin/sh bin/install" after_script: -- cd ~/.config/fish; tree -h; find . -type f | xargs cat + - cd ~/.config/fish; tree -h; find . -type f | xargs cat + +cache: + directories: + - $HOME/fish notifications: email: diff --git a/tests/install_fish.sh b/tests/install_fish.sh new file mode 100755 index 0000000..d41648c --- /dev/null +++ b/tests/install_fish.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -e +# check to see if fish bin doesn't exist +if [ ! -x "$HOME/fish/bin/fish" ]; then + cd /tmp + wget -O - https://github.com/fish-shell/fish-shell/releases/download/2.2.0/fish-2.2.0.tar.gz | tar xzv + cd fish-2.2.0 && ./configure --prefix=$HOME/fish && make -j2 && make install; +else + echo 'Using cached directory.'; +fi From a7d637661650194848ba70b70d80daad9ecf006c Mon Sep 17 00:00:00 2001 From: jeremiejig Date: Tue, 15 Sep 2015 20:48:32 +0200 Subject: [PATCH 2/9] install_fish: Use strip on binary fish... Cache from 7.51MB to 1.63MB --- tests/install_fish.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/install_fish.sh b/tests/install_fish.sh index d41648c..b0c2753 100755 --- a/tests/install_fish.sh +++ b/tests/install_fish.sh @@ -1,10 +1,12 @@ #!/bin/sh set -e +BINDIR=$HOME/fish/bin # check to see if fish bin doesn't exist -if [ ! -x "$HOME/fish/bin/fish" ]; then +if [ ! -x "$BINDIR/fish" ]; then cd /tmp wget -O - https://github.com/fish-shell/fish-shell/releases/download/2.2.0/fish-2.2.0.tar.gz | tar xzv cd fish-2.2.0 && ./configure --prefix=$HOME/fish && make -j2 && make install; + strip $BINDIR/fish $BINDIR/fish_indent $BINDIR/mimedb else echo 'Using cached directory.'; fi From e68dca448a2dd83f06cdc2ece8be8ac627eaf004 Mon Sep 17 00:00:00 2001 From: jeremiejig Date: Thu, 17 Sep 2015 18:54:27 +0200 Subject: [PATCH 3/9] travis: setting env for OMF_REPO_URI and OMF_REPO_BRANCH --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8e437b4..a3b0e37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,8 @@ addons: env: global: - PATH="$HOME/fish/bin:$PATH" + - OMF_REPO_URI="https://github.com/$TRAVIS_REPO_SLUG" + - OMF_REPO_BRANCH="$TRAVIS_BRANCH" before_install: - tests/install_fish.sh From 7919f8ef6a3c2901b4cdecd164dff4e5f0dbdb8b Mon Sep 17 00:00:00 2001 From: jeremiejig Date: Thu, 17 Sep 2015 18:58:20 +0200 Subject: [PATCH 4/9] travis: new travis_install_omf script to checkout PR --- .travis.yml | 5 ++++- tests/travis_install_omf.sh | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 tests/travis_install_omf.sh diff --git a/.travis.yml b/.travis.yml index a3b0e37..e62d3cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,10 @@ before_install: - tests/install_fish.sh before_script: pwd; tree -h -script: "/bin/sh bin/install" + +script: + - /bin/sh tests/travis_install_omf.sh + after_script: - cd ~/.config/fish; tree -h; find . -type f | xargs cat diff --git a/tests/travis_install_omf.sh b/tests/travis_install_omf.sh new file mode 100755 index 0000000..0cbb6bd --- /dev/null +++ b/tests/travis_install_omf.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +git () { + case $1 in + clone) + command git "$@" + if test "$TRAVIS_PULL_REQUEST" != "false"; then + echo "! detecting a pull request !" + echo "$ git -C $OMF_PATH fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge:" + git -C $OMF_PATH fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge: + echo "$ git -C $OMF_PATH checkout -qf FETCH_HEAD" + git -C $OMF_PATH checkout -qf FETCH_HEAD + fi + ;; + *) + command git "$@" + ;; + esac +} + +. $TRAVIS_BUILD_DIR/bin/install From 2556068da67778c71a7c2eed3c901e4f355a1d65 Mon Sep 17 00:00:00 2001 From: jeremiejig Date: Thu, 17 Sep 2015 19:09:26 +0200 Subject: [PATCH 5/9] adding the entry point to do some more test. --- .travis.yml | 2 ++ tests/fish_user_function/refresh.fish | 10 ++++++++++ tests/travis_tests.fish | 9 +++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/fish_user_function/refresh.fish create mode 100755 tests/travis_tests.fish diff --git a/.travis.yml b/.travis.yml index e62d3cb..2b1847b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,11 +20,13 @@ env: before_install: - tests/install_fish.sh + - fish -c 'ln -sf $TRAVIS_BUILD_DIR/tests/fish_user_function $fish_function_path[1]' before_script: pwd; tree -h script: - /bin/sh tests/travis_install_omf.sh + - tests/travis_tests.fish after_script: - cd ~/.config/fish; tree -h; find . -type f | xargs cat diff --git a/tests/fish_user_function/refresh.fish b/tests/fish_user_function/refresh.fish new file mode 100644 index 0000000..deb170d --- /dev/null +++ b/tests/fish_user_function/refresh.fish @@ -0,0 +1,10 @@ +# SYNOPSIS +# refresh +# +# OVERVIEW +# Refresh (reload) the current fish session. + +function refresh -d "refresh the fish session (Travis Override)" + echo !!! Shell refresh requested in testing Environment !!! + exit 0; +end diff --git a/tests/travis_tests.fish b/tests/travis_tests.fish new file mode 100755 index 0000000..b581798 --- /dev/null +++ b/tests/travis_tests.fish @@ -0,0 +1,9 @@ +#!/usr/bin/env fish + +set -l return_code 0 + +omf help +omf query PATH +omf install apt + +exit $return_code From 961d051c2e28cb96c63ff0425bf52236dbd47d6a Mon Sep 17 00:00:00 2001 From: jeremiejig Date: Mon, 21 Sep 2015 12:24:10 +0200 Subject: [PATCH 6/9] Some Renaming. Creation of tools dir. Moving and renaming install_fish.sh to travis_install_fish Moving travis_* from tests to tools. rename: fish_user_function/ -> functions_override/ renaming travis_test.fish to test_runner.fish --- .travis.yml | 8 ++++---- .../refresh.fish | 0 tests/{travis_tests.fish => test_runner.fish} | 0 tests/install_fish.sh => tools/travis_install_fish.sh | 0 {tests => tools}/travis_install_omf.sh | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename tests/{fish_user_function => functions_override}/refresh.fish (100%) rename tests/{travis_tests.fish => test_runner.fish} (100%) rename tests/install_fish.sh => tools/travis_install_fish.sh (100%) rename {tests => tools}/travis_install_omf.sh (100%) diff --git a/.travis.yml b/.travis.yml index 2b1847b..d28e3e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,14 +19,14 @@ env: - OMF_REPO_BRANCH="$TRAVIS_BRANCH" before_install: - - tests/install_fish.sh - - fish -c 'ln -sf $TRAVIS_BUILD_DIR/tests/fish_user_function $fish_function_path[1]' + - tools/travis_install_fish.sh + - fish -c 'ln -sf $TRAVIS_BUILD_DIR/tests/functions_override $fish_function_path[1]' before_script: pwd; tree -h script: - - /bin/sh tests/travis_install_omf.sh - - tests/travis_tests.fish + - /bin/sh tools/travis_install_omf.sh + - tests/test_runner.fish after_script: - cd ~/.config/fish; tree -h; find . -type f | xargs cat diff --git a/tests/fish_user_function/refresh.fish b/tests/functions_override/refresh.fish similarity index 100% rename from tests/fish_user_function/refresh.fish rename to tests/functions_override/refresh.fish diff --git a/tests/travis_tests.fish b/tests/test_runner.fish similarity index 100% rename from tests/travis_tests.fish rename to tests/test_runner.fish diff --git a/tests/install_fish.sh b/tools/travis_install_fish.sh similarity index 100% rename from tests/install_fish.sh rename to tools/travis_install_fish.sh diff --git a/tests/travis_install_omf.sh b/tools/travis_install_omf.sh similarity index 100% rename from tests/travis_install_omf.sh rename to tools/travis_install_omf.sh From 925875790101c4f92240b24eb502191b4036e2f7 Mon Sep 17 00:00:00 2001 From: jeremiejig Date: Thu, 17 Sep 2015 19:46:52 +0200 Subject: [PATCH 7/9] install script using git -C $OMF_PATH --- bin/install | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bin/install b/bin/install index 3d7a7bf..14a3105 100755 --- a/bin/install +++ b/bin/install @@ -58,19 +58,16 @@ omf_install() { die "Could not clone the repository → ${OMF_PATH}:${OMF_REPO_BRANCH}" fi - pushd ${OMF_PATH} >/dev/null 2>&1 - - local git_rev=$(git rev-parse HEAD) >/dev/null 2>&1 - local git_upstream=$(git config remote.upstream.url) + local git_rev=$(git -C ${OMF_PATH} rev-parse HEAD) >/dev/null 2>&1 + local git_upstream=$(git -C ${OMF_PATH} config remote.upstream.url) if [ -z "${git_upstream}" ]; then - git remote add upstream ${git_uri} + git -C ${OMF_PATH} remote add upstream ${git_uri} else - git remote set-url upstream ${git_uri} + git -C ${OMF_PATH} remote set-url upstream ${git_uri} fi echo "Oh My Fish revision id → ${git_rev}" - popd >/dev/null 2>&1 test -z ${FISH_CONFIG+_} && FISH_CONFIG="${XDG_CONFIG_HOME}/fish" local fish_config_file="${FISH_CONFIG}/config.fish" From 7022c3db95d6ca8587c5bfd418173edc8fb2bab9 Mon Sep 17 00:00:00 2001 From: jeremiejig Date: Sun, 20 Sep 2015 13:32:31 +0200 Subject: [PATCH 8/9] tests: test commands help, query & install --- tests/test_runner.fish | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_runner.fish b/tests/test_runner.fish index b581798..e8402cf 100755 --- a/tests/test_runner.fish +++ b/tests/test_runner.fish @@ -2,8 +2,13 @@ set -l return_code 0 -omf help -omf query PATH -omf install apt +set commands "omf help" "omf query PATH" "omf query fish_function_path" "omf install apt" +for cmd in $commands + echo \$ $cmd + if not eval $cmd + set return_code 1 + end; +end; + exit $return_code From 77275ea492b3ed6e5becab562ecd16772f0c7bfd Mon Sep 17 00:00:00 2001 From: jeremiejig Date: Mon, 21 Sep 2015 22:49:52 +0200 Subject: [PATCH 9/9] adding a TODO: comment --- tests/test_runner.fish | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_runner.fish b/tests/test_runner.fish index e8402cf..184a42c 100755 --- a/tests/test_runner.fish +++ b/tests/test_runner.fish @@ -1,5 +1,7 @@ #!/usr/bin/env fish +# TODO: This is only a basic draft. + set -l return_code 0 set commands "omf help" "omf query PATH" "omf query fish_function_path" "omf install apt"