Add install.sh script, Brewfile and improve oh-my-zsh theme installation

This commit is contained in:
Anton Shubin 2021-10-06 00:57:56 +03:00
parent b8b614e799
commit df3b259b30
7 changed files with 95 additions and 48 deletions

View File

@ -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

View File

@ -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/

37
Brewfile Normal file
View File

@ -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"

21
README.md Normal file
View File

@ -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
```

34
install.sh Normal file
View File

@ -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'

View File

@ -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 <projectName>" in your project folder.`);
} else {
console.error(error);
}
}
firebaseProjectName && console.log(`${firebaseProjectName} `);
} catch (error) {}

View File

@ -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"