[zsh] Replace zplug installer with my homegrown bin util installer

Oh. Boy.
This commit is contained in:
Sebastian Schulze 2018-10-29 16:20:15 +01:00
parent 370a5069eb
commit 97aa7a4860
Signed by: bascht
GPG Key ID: 5BCB1D3B4D38A35A
2 changed files with 45 additions and 3 deletions

View File

@ -17,9 +17,6 @@ zplug "plugins/tig", from:oh-my-zsh
zplug "plugins/vagrant", from:oh-my-zsh
zplug "plugins/kubectl", from:oh-my-zsh
zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme
zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf, use:"*linux*amd64*"
zplug "GoogleContainerTools/skaffold", from:gh-r, as:command, rename-to:skaffold, use:"*linux*amd64*", at: "v0.16.0", hook-build: "chmod +x ~/.homesick/repos/public/home/.zplug/bin/skaffold"
zplug "kubernetes-sigs/kustomize", from:gh-r, as:command, rename-to:skaffold, use:"*linux*amd64*", at: "v1.0.8", hook-build: "chmod +x ~/.homesick/repos/public/home/.zplug/bin/kustomize"
zplug "junegunn/fzf", use:shell/key-bindings.zsh
zplug "urbainvaes/fzf-marks"
zplug "Tarrasch/zsh-autoenv"

45
home/bin/install-binreleases Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env ruby
require 'json'
require 'erb'
require 'pry'
binaries = {
skaffold: {
url: "https://storage.googleapis.com/skaffold/releases/<%= version %>/skaffold-linux-amd64",
version: "v0.17.0",
version_argument: "version",
version_match: "<%= version %>"
},
kubectl: {
url: "https://storage.googleapis.com/kubernetes-release/release/<%= version %>/bin/linux/amd64/kubectl",
version: "v1.12.2",
version_argument: "version --client",
version_match: '^Client Version.*GitVersion:\"(?<version><%= version %>)\"'
},
kustomize: {
url: "https://github.com/kubernetes-sigs/kustomize/releases/download/v<%= version %>/kustomize_<%= version %>_linux_amd64",
version: "1.0.10",
version_argument: "version",
version_match: '^Version: {KustomizeVersion:(?<version><%= version %>) '
}
}
binaries.each do |binary, download|
target = File.expand_path("~/bin/#{binary}")
version = download[:version]
download_url = ERB.new(download[:url]).result(binding)
version_match = Regexp.new(ERB.new(download[:version_match]).result(binding))
version_string = "#{target} #{download[:version_argument]}"
puts target
if File.executable? target and `#{version_string}`.match(version_match)
puts "→ Already at #{version}"
else
puts "→ Installing #{binary} #{download[:version]}"
File.unlink target if File.exists? target
system "curl -s -L -o #{target} #{download_url}"
File.chmod(0755, target)
end
end