Sha256: 9f15c3088b3b3d23f0f4c942cff6f647ee9ee75ac3f0fa85c068d46ea3af607a

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'bin_install/zsh/oh_my_zsh'

module BinInstall
  module Zsh
    def self.require!
      abort('Zsh is required. Visit http://www.zsh.org/ to install.'.red) unless installed?
    end

    def self.install
      puts 'Installing Zsh...'.white
      print_reload_warning
      if continue?
        Brew::Package.install_or_upgrade('zsh')
        Brew::Package.install_or_upgrade('zsh-completions')
      else
        abort('Warning Zsh install stopped by user.'.red)
      end
    end

    def self.install!
      puts 'Installing Oh My Zsh...'.white
      print_reload_warning
      if continue?
        Brew::Package.install_or_upgrade('zsh')
        Brew::Package.install_or_upgrade('zsh-completions')
      else
        abort('Warning Zsh install stopped by user.'.red)
      end
    end

    def self.print_reload_warning
      puts 'Warning Zsh requires reloading the shell.'.yellow
      puts 'After Zsh finishes installing you may to rerun the installer with:'
      puts '$ gem install bin_install'.cyan
      puts '$ bin/install'.cyan
    end

    def self.continue?
      print 'Would you like to continue? [Y/n]: '
      Shell.default_yes?(gets.chomp)
    end

    def self.installed?
      Shell.executable_exists?('zsh')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bin_install-0.0.10 lib/bin_install/zsh.rb