From df3b259b3077da30bb7e6dd7b11329c51e9dbbfb Mon Sep 17 00:00:00 2001 From: Anton Shubin <2spy4x@gmail.com> Date: Wed, 6 Oct 2021 00:57:56 +0300 Subject: [PATCH] Add install.sh script, Brewfile and improve oh-my-zsh theme installation --- .oh-my-zsh/.zshrc | 26 ------------- .oh-my-zsh/README.MD | 5 --- Brewfile | 37 +++++++++++++++++++ README.md | 21 +++++++++++ install.sh | 34 +++++++++++++++++ .../getFirebaseProject.js | 14 +------ .../spy4x.zsh-theme | 6 +-- 7 files changed, 95 insertions(+), 48 deletions(-) delete mode 100644 .oh-my-zsh/.zshrc delete mode 100644 .oh-my-zsh/README.MD create mode 100644 Brewfile create mode 100644 README.md create mode 100644 install.sh rename {.oh-my-zsh/custom => oh-my-zsh-theme}/getFirebaseProject.js (51%) rename {.oh-my-zsh/custom => oh-my-zsh-theme}/spy4x.zsh-theme (74%) diff --git a/.oh-my-zsh/.zshrc b/.oh-my-zsh/.zshrc deleted file mode 100644 index b6d8a89..0000000 --- a/.oh-my-zsh/.zshrc +++ /dev/null @@ -1,26 +0,0 @@ -# If you come from bash you might have to change your $PATH. -export PATH=$HOME/bin:/usr/local/bin:$HOME/.yarn/bin:$PATH - -# Path to your oh-my-zsh installation. -export ZSH=$HOME/.oh-my-zsh - -# Set name of the theme to load. -# Look in ~/.oh-my-zsh/themes/ or create a custom one in ~/.oh-my-zsh/custom/ -ZSH_THEME="spy4x" - - -DEFAULT_USER=`whoami` - -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=(git) - -source $ZSH/oh-my-zsh.sh - -cd ~/projects - -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion \ No newline at end of file diff --git a/.oh-my-zsh/README.MD b/.oh-my-zsh/README.MD deleted file mode 100644 index d2412cc..0000000 --- a/.oh-my-zsh/README.MD +++ /dev/null @@ -1,5 +0,0 @@ -# Installation - -1. Install [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) -2. cp .zshrc ~/.zshrc -3. cp -R custom/* ~/.oh-my-zsh/custom/ diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..5b7c72c --- /dev/null +++ b/Brewfile @@ -0,0 +1,37 @@ +# Search for apps names here: https://brew.sh/ +tap "homebrew/bundle" +tap "homebrew/cask" +tap "homebrew/core" +tap "homebrew/services" +tap "hashicorp/tap" + +# Dev Tools +brew "nvm" +brew "hashicorp/tap/terraform" +cask "google-cloud-sdk" +cask "datagrip" +cask "webstorm" +cask "visual-studio-code" +cask "docker" +cask "postman" + +# Utilities +cask "toggl-track" +cask "divvy" +cask "google-chrome" +cask "google-drive" +cask "zoom" +cask "1password" +cask "upwork" +cask "slack" +cask "iterm2" +cask "sublime-text" +cask "transmission" +cask "vlc" +cask "the-unarchiver" +cask "windscribe" + +# Fun +cask "nvidia-geforce-now" +cask "discord" +cask "steam" diff --git a/README.md b/README.md new file mode 100644 index 0000000..cac2d71 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Dotfiles +This repository is my setup for a new MacOS computer. +It helps me to install quickly all software I need for work and fun. + +Feel free to check & alter the list of software to be installed - [Brewfile](Brewfile) + +Also don't hesitate to share your feedback about [install.sh](install.sh) - I'm not a big fun of Shell, so my script may suck :D + +Use at your own risk! + +## Installation +Run next commands in your terminal one by one and follow instructions if any. +Note: Brew installation will ask you for the root password. +And it takes 15-30 min, so make sure to grab your favourite tea or coffee meanwhile. +```shell +# Install oh-my-zsh (it restarts shell, so it has to be separate) +sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + +# Main installation script +zsh ./install.sh +``` \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..63e81e1 --- /dev/null +++ b/install.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -e + +echo '▶️ Installing Brew...' +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile +eval "$(/opt/homebrew/bin/brew shellenv)" +echo '✅ Brew installation complete \n' + +echo '▶️ Installing Apps with Brew...' +brew bundle +echo '✅ Apps installation complete \n' + +echo '▶️ Installing Node.js via NVM...' +# Put NVM dir into .zshrc +echo 'export NVM_DIR="$HOME/.nvm" +[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm +[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && . "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion' >> ~/.zshrc +source ~/.zshrc +# Install Node.js +nvm install node +npm i -g yarn +echo '✅ Node.js installation complete \n' + +echo '▶️ Configuring custom Spy4x theme for Oh-my-zsh...' +cp -R oh-my-zsh-theme/* ~/.oh-my-zsh/custom/ +echo 'ZSH_THEME="spy4x"' >> ~/.zshrc +echo 'source $ZSH/oh-my-zsh.sh' >> ~/.zshrc +mkdir ~/projects && cd ~/projects +echo 'cd ~/projects' >> ~/.zshrc # Set ~/projects as default dir to open in terminal +source ~/.zshrc +echo '✅ Configuration complete \n' + +echo '🎉 If you see this message, then its all done 🎉 \n\n\n' \ No newline at end of file diff --git a/.oh-my-zsh/custom/getFirebaseProject.js b/oh-my-zsh-theme/getFirebaseProject.js similarity index 51% rename from .oh-my-zsh/custom/getFirebaseProject.js rename to oh-my-zsh-theme/getFirebaseProject.js index a25eed0..de435a2 100644 --- a/.oh-my-zsh/custom/getFirebaseProject.js +++ b/oh-my-zsh-theme/getFirebaseProject.js @@ -1,19 +1,9 @@ const { readFileSync } = require(`fs`); - const folderPath = process.argv[2]; try { const pathToFirebaseToolsJson = `${process.env.HOME}/.config/configstore/firebase-tools.json`; const fileContent = readFileSync(pathToFirebaseToolsJson); const firebaseToolsJson = JSON.parse(fileContent); const firebaseProjectName = firebaseToolsJson.activeProjects[folderPath]; - - if (firebaseProjectName) { - console.log(firebaseProjectName); - } -} catch (error) { - if (error.code && error.code === "ENOENT") { - console.error(`Couldn't find file "${pathToFirebaseToolsJson}". Please create it with "$ firebase use " in your project folder.`); - } else { - console.error(error); - } -} \ No newline at end of file + firebaseProjectName && console.log(`${firebaseProjectName} `); +} catch (error) {} diff --git a/.oh-my-zsh/custom/spy4x.zsh-theme b/oh-my-zsh-theme/spy4x.zsh-theme similarity index 74% rename from .oh-my-zsh/custom/spy4x.zsh-theme rename to oh-my-zsh-theme/spy4x.zsh-theme index 2dc7337..a71cc3d 100644 --- a/.oh-my-zsh/custom/spy4x.zsh-theme +++ b/oh-my-zsh-theme/spy4x.zsh-theme @@ -3,16 +3,12 @@ local current_dir='%{$terminfo[bold]$fg[green]%}%~%{$reset_color%}' local git_branch='$(git_prompt_info)%{$reset_color%}' local firebase_project=%{$fg[cyan]%}'$(node ~/.oh-my-zsh/custom/getFirebaseProject.js $(pwd))'%{$reset_color%} -PROMPT="${current_dir} ${firebase_project} ${git_branch} +PROMPT="${current_dir} ${firebase_project}${git_branch} $ " RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -alias fd="firebase deploy" -alias ya="yarn add" -alias yr="yarn remove" alias yu="yarn upgrade-interactive --latest" -alias webstorm="open -a "WebStorm.app"" alias gst="git status -sb"