Sha256: bf81c8ad0fea054e9f8a0e983f0b362449ae4c5c73b9a54d8fb654f2f72aa5c8

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

module BinInstall
  module Zsh
    module OhMyZsh
      def self.require!
        abort('Oh My Zsh is required. Visit http://ohmyz.sh/ to install.'.red) unless installed?
      end

      def self.install
        puts 'Installing Oh My Zsh...'.white
        print_reload_warning
        if continue?
          system(%(sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"))
        else
          abort('Oh My Zsh installation aborted by user.'.red)
        end
      end

      def self.install!
        puts 'Installing Oh My Zsh...'.white
        print_reload_warning
        if continue?
          BinInstall.system!(%(sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"))
        else
          abort('Oh My Zsh installation aborted by user.'.red)
        end
      end

      def self.print_reload_warning
        return if installed?
        puts 'Warning Oh My Zsh requires reloading the shell.'.yellow
        puts 'After Oh My Zsh finishes installing you must restart your shell!'.red
        puts 'Rerun the installer with:'
        puts '$ gem install bin_install'.cyan
        puts '$ bin/install'.cyan
      end

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

      def self.installed?
        File.exist?(File.expand_path('~/.oh-my-zsh'))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bin_install-0.0.12 lib/bin_install/zsh/oh_my_zsh.rb