Skip to content

Commit

Permalink
added update.sh script
Browse files Browse the repository at this point in the history
- can be used to update custom vim plugins on a cron
  • Loading branch information
Phillip Miller committed Oct 22, 2021
1 parent 4c0ffeb commit 97b8232
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 7 deletions.
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [v1.6.4](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.6.4) (2021-10-22)

[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.6.3...v1.6.4)

## [v1.6.3](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.6.3) (2021-10-20)

[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.6.2...v1.6.3)
Expand Down Expand Up @@ -54,15 +58,15 @@

## [v1.5.2](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.5.2) (2021-10-17)

[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.4.5...v1.5.2)
[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.5.1...v1.5.2)

## [v1.4.5](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.4.5) (2021-10-16)
## [v1.5.1](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.5.1) (2021-10-16)

[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.5.1...v1.4.5)
[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.4.5...v1.5.1)

## [v1.5.1](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.5.1) (2021-10-16)
## [v1.4.5](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.4.5) (2021-10-16)

[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.5.0...v1.5.1)
[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.5.0...v1.4.5)

## [v1.5.0](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.5.0) (2021-10-16)

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ After Installation, if you want to Customize Powerlevel10k zsh theme differently
p10k configure
```

Make sure your vim binaries installed. They should be from ./pimp-my-shell but just in case run the command below.
If you want your custom vim plugins to automatically update, simply create this cronjob

```shell
vim +GoInstallBinaries
crontab -e
0 12 * * * cd ~/.vim_runtime/my_plugins && ./update.sh > gitPullUpdates.txt 2>&1
```

## About
Expand Down
14 changes: 14 additions & 0 deletions extra/extra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ func TestInstallExtraPackages(t *testing.T) {
AptInstalledPackages: &localio.AptInstalled{Name: []string{"lsd"}},
BrewInstalledPackages: nil,
}}, false},
{"Test InstallExtraPackages Linux 4 Should Fail", args{
osType: "linux",
dirs: dirs,
packages: &localio.InstalledPackages{
AptInstalledPackages: nil,
BrewInstalledPackages: nil,
}}, true},
{"Test InstallExtraPackages Darwin 5 Should Fail", args{
osType: "darwin",
dirs: dirs,
packages: &localio.InstalledPackages{
AptInstalledPackages: nil,
BrewInstalledPackages: nil,
}}, true},
}
timeout := time.After(20 * time.Minute)
done := make(chan bool)
Expand Down
6 changes: 6 additions & 0 deletions macosx/macosx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ func TestInstallHomebrew(t *testing.T) {
if err != nil {
t.Errorf("failed to create Directories type: %v", err)
}
fakeDirs, err := localio.NewDirectories()
if err != nil {
t.Errorf("failed to create Directories type: %v", err)
}
fakeDirs.HomeDir = "/asdfasdf/sadfasdf/asdfsadf"
type args struct {
dirs *localio.Directories
}
Expand All @@ -19,6 +24,7 @@ func TestInstallHomebrew(t *testing.T) {
wantErr bool
}{
{"Test InstallHomebrew 1", args{dirs: dirs}, false},
{"Test InstallHomebrew 2 Should Fail", args{dirs: fakeDirs}, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
14 changes: 14 additions & 0 deletions tmux/tmux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ func TestInstallOhMyTmux(t *testing.T) {
AptInstalledPackages: &localio.AptInstalled{Name: []string{"xclip", "tmux"}},
BrewInstalledPackages: nil,
}}, false},
{"Test InstallOhMyTmux darwin 3 Should Fail", args{
osType: "darwin",
dirs: dirs,
packages: &localio.InstalledPackages{
AptInstalledPackages: nil,
BrewInstalledPackages: nil,
}}, true},
{"Test InstallOhMyTmux Linux 4 Should fail", args{
osType: "linux",
dirs: dirs,
packages: &localio.InstalledPackages{
AptInstalledPackages: nil,
BrewInstalledPackages: nil,
}}, true},
}
timeout := time.After(20 * time.Minute)
done := make(chan bool)
Expand Down
18 changes: 18 additions & 0 deletions vim/templates/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# store the current dir
CUR_DIR=$(pwd)
date
# Let the person running the script know what's going on.
echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"

# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
echo "";
echo -e "\033[33m"+$i+"\033[0m";
cd "$i"; # We have to go to the .git parent directory to call the pull command
cd ..;
git pull; # finally pull
cd $CUR_DIR # lets get back to the CUR_DIR
done
echo -e "\n\033[32mComplete!\033[0m\n"
11 changes: 11 additions & 0 deletions vim/vim.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,23 @@ func InstallVimPlugins(osType string, dirs *localio.Directories) error {
return err
}

updateVimCustomPlugins, err := myConfigs.Open("templates/update.sh")
if err != nil {
return err
}

if err = localio.EmbedFileCopy("~/.vim_runtime/my_configs.vim", myConfigFS); err != nil {
return err
}
if err = localio.EmbedFileCopy("~/.vimrc", vimrcFS); err != nil {
return err
}
// Useful bash script to update plugins
// set it on a cron
// 0 12 * * * cd ~/.vim_runtime/my_plugins && ./update.sh > gitPullUpdates.txt 2>&1
if err = localio.EmbedFileCopy("~/.vim_runtime/my_plugins/update.sh", updateVimCustomPlugins); err != nil {
return err
}

fmt.Println("[+] Installing vim binaries via +GoInstallBinaries")
if err = localio.RunCommandPipeOutput("vim +GoInstallBinaries +qa || true"); err != nil {
Expand Down
14 changes: 14 additions & 0 deletions vim/vim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ func TestInstallVimAwesome(t *testing.T) {
AptInstalledPackages: &localio.AptInstalled{Name: []string{"bat", "lsd", "gotop", "delta"}},
BrewInstalledPackages: nil,
}}, false},
{"Test InstallOhMyTmux Linux 3", args{
osType: "linux",
dirs: dirs,
packages: &localio.InstalledPackages{
AptInstalledPackages: nil,
BrewInstalledPackages: nil,
}}, true},
{"Test InstallOhMyTmux Darwin 4", args{
osType: "darwin",
dirs: dirs,
packages: &localio.InstalledPackages{
AptInstalledPackages: nil,
BrewInstalledPackages: nil,
}}, true},
}
timeout := time.After(20 * time.Minute)
done := make(chan bool)
Expand Down

0 comments on commit 97b8232

Please sign in to comment.