Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: start local env #67

Merged
merged 1 commit into from
Sep 17, 2024
Merged

feat: start local env #67

merged 1 commit into from
Sep 17, 2024

Conversation

saku-koodari
Copy link
Contributor

@saku-koodari saku-koodari commented Sep 16, 2024

importtasin scriptin repoon (mun .zhsrc:sta), jolla laitan itselleni devausympäristön pystyyn. Tämän lisäks, tämänkin jälkeen, i mulla on mun ~/.zshrc - tiedostossa:

alias idea='/Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea'
eval "$(mise activate zsh)"

kotorekisteri-start-tmux() {
  (
    # alias KOTO_REKISTERI=path/to/repo
    cd $KOTO_REKISTERI
    ./scripts/start_local_env.sh $KOTO_REKISTERI
  )
}

Mun scripti käyttää https://github.com/tmux/tmux - Session manageria käynnistämään yhtä aikaa useita shell instasseja. Instassit, eli ikkunat:

  • 0: database: Ajaa tietokannan dockerissa, sekä ajaa migraatiot
  • 1: idea: Käynnistää idean
  • 2: springboot: Ajaa springbootin
  • 3: workspace: Näyttää gitin ja repon juuren tiedostot

@saku-koodari saku-koodari requested a review from a team as a code owner September 16, 2024 12:33

# database: right pane (flyway migrate)
tmux split-window -h -t $SESSION:"$WINDOW"
tmux send-keys -t $SESS_NAME:"$WINDOW.1" "(cd server &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tää on vähä ruma stdoutissa, mutta hoitaa asiansa, eli ajaa migraatiot sitten kun docker on pystyssä.

Comment on lines +19 to +21
tmux attach -t $SESS_NAME
# TODO: Instead of return, kill the old session.
return
Copy link
Contributor Author

@saku-koodari saku-koodari Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Näin se poistais vanhan session, jos haluais, että scripti luo kaiken aina alusta.

Suggested change
tmux attach -t $SESS_NAME
# TODO: Instead of return, kill the old session.
return
tmux kill-session -t $SESS_NAME

tmux new-window -t $SESS_NAME -n "$WINDOW"
tmux send-keys -t $SESS_NAME:"$WINDOW" "git log --oneline --decorate=full --graph --all --oneline" C-m
tmux split-window -h -t $SESSION:"$WINDOW"
tmux send-keys -t $SESS_NAME:"$WINDOW.1" "ls -la" C-m
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tree:llä sais must paremman puurakenteen

Suggested change
tmux send-keys -t $SESS_NAME:"$WINDOW.1" "ls -la" C-m
tmux send-keys -t $SESS_NAME:"$WINDOW.1" "tree -L 2" C-m

@saku-koodari
Copy link
Contributor Author

Ps. Mä käytän tmuxia näillä konffeilla

# Plugins
set -g @plugin 'tmux-plugins/tpm'

# Use vi (vim) keyboard
set-window-option -g mode-keys vi

# Enable mouse scrolling
# On macOS:
#    - Terminal.app -> View -> Enable mouse reporting
#    - iTerm2.app -> Settings -> Profiles -> Terminal -> Enable mouse reporting 
setw -g mouse on 

# Don't use this on mac
#set -g default-terminal "screen-256color"s

# when splitting tmux window, use the same directory
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

@saku-koodari saku-koodari merged commit 78bb6d8 into main Sep 17, 2024
11 checks passed
@saku-koodari saku-koodari deleted the feat/start_local_env branch September 17, 2024 09:50
@saku-koodari
Copy link
Contributor Author

Parannuksia tehty pullarissa
#67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants