From fd9c69f9617d41fefe60b5a9442606ac8158b438 Mon Sep 17 00:00:00 2001 From: sanscontext Date: Mon, 27 Jan 2020 16:19:47 -0800 Subject: [PATCH 1/5] check in stub --- Makefile | 7 ++++++- scripts/env.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 scripts/env.sh diff --git a/Makefile b/Makefile index 41e07596e8..a70811ca2d 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,11 @@ typewriter: npx typewriter .PHONY: deps deps: node_modules vendor/bundle +.PHONY: env2 +env2: + @sh scripts/env.sh + + .PHONY: clean clean: @rm -Rf _site @@ -91,7 +96,7 @@ node_modules: package.json yarn.lock yarn --frozen-lockfile .PHONY: vendor/bundle -vendor/bundle: +vendor/bundle: @export BUNDLE_PATH="vendor/bundle" @mkdir -p vendor && mkdir -p vendor/bundle @chmod -R 777 vendor/ diff --git a/scripts/env.sh b/scripts/env.sh new file mode 100644 index 0000000000..3cd7442d2d --- /dev/null +++ b/scripts/env.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# script to set up environment on mac + +which -s brew +if [[ $? != 0 ]] ; then + # Install Homebrew + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +else + echo "Brew already installed" + brew update +fi + +# install the stuff you need to edit the docs + +brew install git +brew install bash-completion +brew cask install atom + +# install atom packages which make markdown easy +apm install language-markdown markdown-preview-plus minimap sort-selected-elements wordcount markdown-table-editor markdown-toc + +# install stuff you need to run the docs locally + +xcode-select --install + +brew install ruby +brew install node +brew install yarn + +gem update --system + +version=$(gem --version) +echo $version +if [[ $version < 2.5.0 ]] ; then + echo "version outdated, please install using sudo" +else + echo "gem version $version already installed" +fi + +gem install bundler:2.1.2 --user-install From b646743c6586b9f205d8012dbe44b9d085d359a6 Mon Sep 17 00:00:00 2001 From: sanscontext Date: Mon, 27 Jan 2020 16:57:50 -0800 Subject: [PATCH 2/5] Checkin. Gem isn't working yet --- scripts/env.sh | 86 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 16 deletions(-) diff --git a/scripts/env.sh b/scripts/env.sh index 3cd7442d2d..e5c055fcfb 100644 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -1,40 +1,94 @@ #!/bin/bash -# script to set up environment on mac +# script to set up environment on mac heavily relying on brew which -s brew if [[ $? != 0 ]] ; then # Install Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" else - echo "Brew already installed" - brew update + echo " ✔ Brew already installed" + brew update -s fi # install the stuff you need to edit the docs +which -s git +if [[ $? != 0 ]] ; then + # Install Homebrew + brew install git + echo " ✔ Git installed" +else + echo " ✔ Git already installed" +fi -brew install git brew install bash-completion -brew cask install atom +echo " ✔ Bash completion installed. Paste the following anywhere in your .bash_profile to activate" +echo "[[ -r \"/usr/local/etc/profile.d/bash_completion.sh\" ]] && . \"/usr/local/etc/profile.d/bash_completion.sh\"" + +which -s atom +if [[ $? != 0 ]] ; then + brew cask install atom +else + echo " ✔ Atom already installed" +fi # install atom packages which make markdown easy +echo "Installing useful Atom packages" apm install language-markdown markdown-preview-plus minimap sort-selected-elements wordcount markdown-table-editor markdown-toc # install stuff you need to run the docs locally -xcode-select --install +which -s xcode-select +if [[ $? != 0 ]] ; then + xcode-select --install +else + echo " ✔ Xcode command line tools already installed" +fi + +which -s ruby +if [[ $? != 0 ]] ; then + brew install ruby +else + echo " ✔ Ruby already installed" +fi -brew install ruby -brew install node -brew install yarn +which -s node +if [[ $? != 0 ]] ; then + brew install node +else + echo " ✔ NodeJS already installed" +fi -gem update --system +which -s yarn +if [[ $? != 0 ]] ; then + brew install yarn +else + echo " ✔ Yarn already installed" +fi -version=$(gem --version) -echo $version -if [[ $version < 2.5.0 ]] ; then - echo "version outdated, please install using sudo" +which -s gem +if [[ $? != 0 ]] ; then # check if gem is installed + version=$(gem --version) # version check + echo "Found a version of Gem installed. Checking version." + if [[ $version < 2.5.0 ]] ; then + echo "Gem version outdated, please install using \`sudo gem update --system\`" + else + " ✔ Gem version $version already installed" + fi else - echo "gem version $version already installed" + gem update --system # try updating, without sudo + echo "Attempting to install Gem." + version=$(gem --version) # version check + if [[ $version < 2.5.0 ]] ; then + echo "Gem version outdated, please install using \`sudo gem update --system\`" + else + " ✔ Gem version $version already installed" + fi fi -gem install bundler:2.1.2 --user-install +which -s bundler +if [[ $? != 0 ]] ; then + gem install bundler:2.1.2 --user-install + echo " ✔ Bundler installed" +else + echo " ✔ Bundler already installed" +fi From ede0e7b4c5d8a9059cc64c4ee2e1db95ae7cde7f Mon Sep 17 00:00:00 2001 From: sanscontext Date: Thu, 30 Jan 2020 11:34:19 -0800 Subject: [PATCH 3/5] updates --- scripts/env.sh | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/scripts/env.sh b/scripts/env.sh index e5c055fcfb..c2678f4cf3 100644 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -7,7 +7,8 @@ if [[ $? != 0 ]] ; then ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" else echo " ✔ Brew already installed" - brew update -s + echo " Updating Brew" + brew update fi # install the stuff you need to edit the docs @@ -65,25 +66,30 @@ else echo " ✔ Yarn already installed" fi -which -s gem -if [[ $? != 0 ]] ; then # check if gem is installed - version=$(gem --version) # version check - echo "Found a version of Gem installed. Checking version." - if [[ $version < 2.5.0 ]] ; then - echo "Gem version outdated, please install using \`sudo gem update --system\`" - else - " ✔ Gem version $version already installed" - fi -else - gem update --system # try updating, without sudo - echo "Attempting to install Gem." - version=$(gem --version) # version check - if [[ $version < 2.5.0 ]] ; then - echo "Gem version outdated, please install using \`sudo gem update --system\`" - else - " ✔ Gem version $version already installed" - fi -fi +echo " Updating your Gem installation. Please enter your password to sudo." +# sudo gem update --system +echo "Gem version " $(gem --version) "installed" + +# can't get this working because comparing version strings is complicated. +# which -s gem +# if [[ $? != 0 ]] ; then # check if gem is installed +# version=$(gem --version) # version check +# echo "Found a version of Gem installed. Checking version." +# if [[ $version < 2.5.0 ]] ; then +# echo "Gem version outdated, please install using \`sudo gem update --system\`" +# else +# " ✔ Gem version $version already installed" +# fi +# else +# gem update --system # try updating, without sudo +# echo "Attempting to install Gem." +# version=$(gem --version) # version check +# if [[ $version < 2.5.0 ]] ; then +# echo "Gem version outdated, please install using \`sudo gem update --system\`" +# else +# " ✔ Gem version $version already installed" +# fi +# fi which -s bundler if [[ $? != 0 ]] ; then From 8ccdb3668156b4035e355d183c526cfe867d6bb7 Mon Sep 17 00:00:00 2001 From: sanscontext Date: Thu, 30 Jan 2020 11:35:20 -0800 Subject: [PATCH 4/5] Update makefile since old env command isn't working now anyway --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a70811ca2d..d0d28bf56d 100644 --- a/Makefile +++ b/Makefile @@ -68,11 +68,10 @@ typewriter: npx typewriter .PHONY: deps deps: node_modules vendor/bundle -.PHONY: env2 -env2: +.PHONY: env +env: @sh scripts/env.sh - .PHONY: clean clean: @rm -Rf _site @@ -157,6 +156,7 @@ docker-build: #catalog: # bundle exec rake catalog:update # +# old env command #.PHONY: env #env: # gem install bundler From 80d3c7eaeb345633c5b355b44375cf89c2f55a1a Mon Sep 17 00:00:00 2001 From: sanscontext Date: Thu, 30 Jan 2020 11:39:39 -0800 Subject: [PATCH 5/5] annotate --- scripts/env.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/env.sh b/scripts/env.sh index c2678f4cf3..990e9f33ba 100644 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -12,9 +12,11 @@ else fi # install the stuff you need to edit the docs +# yes, I realize you have to have git to get this usually, +# but there's a possible world in which we send someone this script +# to configure their env before they get the repo set up which -s git if [[ $? != 0 ]] ; then - # Install Homebrew brew install git echo " ✔ Git installed" else