Module: BinInstall::Zsh::OhMyZsh

Defined in:
lib/bin_install/zsh/oh_my_zsh.rb

Constant Summary collapse

INSTALL =
%(sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)").freeze

Class Method Summary collapse

Class Method Details

.continue?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
# File 'lib/bin_install/zsh/oh_my_zsh.rb', line 38

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

.installObject



9
10
11
12
13
14
15
16
17
# File 'lib/bin_install/zsh/oh_my_zsh.rb', line 9

def self.install
  puts 'Installing Oh My Zsh...'.white
  print_reload_warning
  if continue?
    system(INSTALL)
  else
    abort('Oh My Zsh installation aborted by user.'.red)
  end
end

.install!Object



19
20
21
22
23
24
25
26
27
# File 'lib/bin_install/zsh/oh_my_zsh.rb', line 19

def self.install!
  puts 'Installing Oh My Zsh...'.white
  print_reload_warning
  if continue?
    BinInstall.system!(INSTALL)
  else
    abort('Oh My Zsh installation aborted by user.'.red)
  end
end

.installed?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/bin_install/zsh/oh_my_zsh.rb', line 44

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


29
30
31
32
33
34
35
36
# File 'lib/bin_install/zsh/oh_my_zsh.rb', line 29

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.'.red
  puts "\n"
  puts 'Rerun the installer with:'
  puts '$ bin/install'.cyan
end

.require!Object



5
6
7
# File 'lib/bin_install/zsh/oh_my_zsh.rb', line 5

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