Sha256: 07944ad3106bbfbf0ed9931dc72eebfbfa4271547a3664621f4667f069810868
Contents?: true
Size: 1.01 KB
Versions: 9
Compression:
Stored size: 1.01 KB
Contents
#!/usr/bin/env ruby # THIS CODE INSPIRED BY (COPIED FROM) HOMEBREW'S INSTALL SCRIPT. THANKS! :) def download_app Dir.chdir install_dir do # -m to stop tar erroring out if it can't modify the mtime for root owned directories # pipefail to cause the exit status from curl to propogate if it fails # we use -k for curl because Leopard has a bunch of bad SSL certificates curl_flags = 'fsSL' curl_flags << 'k' if macos_version <= '10.5' `/bin/bash -o pipefail -c '/usr/bin/curl -#{curl_flags} https://github.com/brewster1134/Yuyi/tarball/master | /usr/bin/tar xz -m --strip 1'` end end def install system "ruby #{install_dir}/bin/yuyi" end def cleanup `rm -rf #{install_dir}` end # Create the directory to download to and install from def install_dir dir = "#{ENV['TMPDIR']}Yuyi" unless File.directory? dir `/bin/mkdir #{dir}` end dir end # Get OSX minor version def macos_version @macos_version ||= `/usr/bin/sw_vers -productVersion`.chomp[/10\.\d+/] end download_app install cleanup
Version data entries
9 entries across 9 versions & 1 rubygems