#!/usr/bin/env ruby require 'unirest' require 'os' require 'rubygems/package' require 'open-uri' require 'zlib' require 'micro_install' # This script installs micro. # # This script will install micro to your user bin directory ~/.local/bin # (I don't use ''~/bin' because it muddies up 'ls') # # Found a bug? Report it here: https://github.com/IotaSpencer/micro-install # # Acknowledgments: # - https://getmic.ro: https://github.com/benweissmann/ # - Micro, of course: https://micro-editor.github.io/ # - Loosely based on the Chef curl|bash: https://docs.chef.io/install_omnibus.html # - ASCII art courtesy of figlet: http://www.figlet.org/ hl = HighLine.new($stdin, $stderr) installer = MicroInstall::Installer.new installer.latesttag installer.get_arch installer.download_url installer.download_micro_tar installer.extract_micro installer.install_micro paths = [] path_env = ENV['PATH'].split(':').each do |path| paths << path if path.include? 'bin' end if paths.include? Pathname(Dir.home).join('.local/bin').to_path hl.say "Environment Variable 'PATH' already includes #{Dir.home}/.local/bin" hl.say Paint["You're all set!", 'green'] installer.is_installed else hl.say "#{Paint['Warning', 'orange']}: #{Dir.home}/.local/bin is not in $PATH," installer.is_installed_but_no_bin end