class Chid::Commands::Installs::Vim

Public Instance Methods

do_gvim?() click to toggle source
# File lib/chid/commands/installs/vim.rb, line 60
def do_gvim?
  answers = ['Yes','No']
  should_install_gvim = prompt.select('Install gvim too?', answers)
  should_install_gvim == 'Yes'
end
do_vim?() click to toggle source
# File lib/chid/commands/installs/vim.rb, line 54
def do_vim?
  answers = ['Yes','No']
  should_install_vim = prompt.select('Install vim ?', answers)
  should_install_vim == 'Yes'
end
prompt() click to toggle source
# File lib/chid/commands/installs/vim.rb, line 50
def prompt
  @prompt ||= TTY::Prompt.new
end
run() click to toggle source
# File lib/chid/commands/installs/vim.rb, line 21
def run
  puts "\nInstalling vim..."

  is_vim = do_vim?
  is_gvim = do_gvim?

  ::ChidConfig.on_linux do
    system('sudo apt update')

    if is_vim
      system('sudo add-apt-repository ppa:jonathonf/vim')
      system('sudo apt update')
      system('sudo apt install vim')
    end

    system('sudo apt-get install vim-gnome') if is_gvim
  end

  ::ChidConfig.on_osx do
    system('brew update')
    system('brew install vim')
  end

  puts "\nVim installed successfully" if is_vim
  puts "\nGvim installed successfully" if is_gvim

  puts "\nNothing installed =(" unless is_vim || is_gvim
end