Skip to content

Commit

Permalink
Install silversearcher from apt when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
djcp committed May 9, 2014
1 parent b3b1ac2 commit 0db0892
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Manifest.linux
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linux-components/distro-check
linux-components/debian-package-update
linux-components/debian-derivative-packages
common-components/zsh
linux-components/silver-searcher-from-source
linux-components/silver-searcher
linux-components/rbenv
common-components/ruby-environment
linux-components/bundler
Expand Down
29 changes: 19 additions & 10 deletions linux
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,27 @@ fancy_echo "Changing your shell to zsh ..."
chsh -s $(which zsh)
### end common-components/zsh

if ! command -v ag &>/dev/null; then
silver_searcher_from_source() {
git clone git://github.com/ggreer/the_silver_searcher.git /tmp/the_silver_searcher
sudo aptitude install -y automake pkg-config libpcre3-dev zlib1g-dev liblzma-dev
sh /tmp/the_silver_searcher/build.sh
cd /tmp/the_silver_searcher
sh build.sh
sudo make install
cd
rm -rf /tmp/the_silver_searcher
}

if ! command -v ag >/dev/null; then
fancy_echo "Installing The Silver Searcher (better than ack or grep) to search the contents of files ..."
git clone git://github.com/ggreer/the_silver_searcher.git /tmp/the_silver_searcher
sudo aptitude install -y automake pkg-config libpcre3-dev zlib1g-dev liblzma-dev
sh /tmp/the_silver_searcher/build.sh
cd /tmp/the_silver_searcher
sh build.sh
sudo make install
cd
rm -rf /tmp/the_silver_searcher

if aptitude show silversearcher-ag &>/dev/null; then
sudo aptitude install silversearcher-ag
else
silver_searcher_from_source
fi
fi
### end linux-components/silver-searcher-from-source
### end linux-components/silver-searcher

if [[ ! -d "$HOME/.rbenv" ]]; then
fancy_echo "Installing rbenv, to change Ruby versions ..."
Expand Down
20 changes: 20 additions & 0 deletions linux-components/silver-searcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
silver_searcher_from_source() {
git clone git://github.com/ggreer/the_silver_searcher.git /tmp/the_silver_searcher
sudo aptitude install -y automake pkg-config libpcre3-dev zlib1g-dev liblzma-dev
sh /tmp/the_silver_searcher/build.sh
cd /tmp/the_silver_searcher
sh build.sh
sudo make install
cd
rm -rf /tmp/the_silver_searcher
}

if ! command -v ag >/dev/null; then
fancy_echo "Installing The Silver Searcher (better than ack or grep) to search the contents of files ..."

if aptitude show silversearcher-ag &>/dev/null; then
sudo aptitude install silversearcher-ag
else
silver_searcher_from_source
fi
fi
11 changes: 0 additions & 11 deletions linux-components/silver-searcher-from-source

This file was deleted.

5 changes: 4 additions & 1 deletion test/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ for vagrantfile in test/Vagrantfile.*; do
vagrant ssh -c 'zsh -i -l -c "cd ~/test_app && rake db:create db:migrate db:test:prepare"' \
|| failure "$vagrantfile :: Could not successfully initialize databases and migrate"

vagrant ssh -c 'zsh -i -l -c "command -v ag"' \
|| failure "$vagrantfile :: ag was not installed"

vagrant ssh -c 'zsh -i -l -c "rm -Rf ~/test_app"'
vagrant ssh -c 'zsh -i -l -c "sudo aptitude clean"'

if [ "$FAILED" = true ]; then
failure_message "$vagrantfile :: The automated tests failed. Please look for error messages above"
else
message "$vagrantfile tests succeeded"
if [ -n "$PACKAGE_BOXES" ];
if [ -n "$PACKAGE_BOXES" ]; then
package_box
fi
fi
Expand Down

0 comments on commit 0db0892

Please sign in to comment.