#!/bin/bash -e proc gem_install { if ! gem list | grep -e "^$1 " { sudo gem install $i --no-ri --no-rdoc } } set -x gem_install foodcritic gem_install tailor global TOP := $[git rev-parse --show-toplevel] if test ! -L "$TOP/.git/hooks/pre-commit" { ln -s ../../tests/pre-commit "$TOP/.git/hooks/pre-commit" } (CommandList children: [ (FuncDef name: gem_install body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (C {(gem)} {(list)}) (C {(grep)} {(-e)} {(DQ ("^") ($ VSub_Number "$1") (" "))}) ] negated: True ) terminator: ) ] action: [ (C {(sudo)} {(gem)} {(install)} {($ VSub_Name "$i")} {(--no-ri)} {(--no-rdoc)}) ] spids: [-1 32] ) ] spids: [-1 48] ) ] spids: [8] ) spids: [4 7] ) (C {(set)} {(-x)}) (C {(gem_install)} {(foodcritic)}) (C {(gem_install)} {(tailor)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TOP) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(--show-toplevel)})]) left_token: spids: [67 73] ) } spids: [66] ) ] spids: [66] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-L)} {(DQ ($ VSub_Name "$TOP") (/.git/hooks/pre-commit))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(ln)} {(-s)} {(../../tests/pre-commit)} {(DQ ($ VSub_Name "$TOP") (/.git/hooks/pre-commit))} ) ] spids: [-1 91] ) ] spids: [-1 105] ) ] )