Top Level Namespace

Defined Under Namespace

Modules: DevOsxUpdater, StringExtensions, System Classes: Brew, OSX, Pretzo, RVM, Rbenv, Ruby, ZSH

Instance Method Summary collapse

Instance Method Details

#break_outputObject



38
39
40
# File 'lib/utility.rb', line 38

def break_output
  puts ''
end

#check_update_message(app) ⇒ Object



30
31
32
# File 'lib/utility.rb', line 30

def check_update_message(app)
  puts "| Checking #{app} for updates...".bold
end

#cleanup_message(app) ⇒ Object



34
35
36
# File 'lib/utility.rb', line 34

def cleanup_message(app)
  puts "| Cleaning up #{app}".bold
end

#file_or_folder_exists?(file) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
28
# File 'lib/utility.rb', line 24

def file_or_folder_exists?(file)
  home = ENV['HOME']
  path = "#{home}" "#{file}"
  File.exist?(path)
end

#run?Boolean

Returns:

  • (Boolean)


57
58
59
60
61
62
# File 'lib/utility.rb', line 57

def run?
  return true if System::Update::AUTO_RUN == '--auto'

  print '  - Do you want to perform this action? (y/n) '
  yes_or_no
end

#yes_or_noObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/utility.rb', line 42

def yes_or_no
  str = gets.chomp

  if str == 'y'
    puts '  - Performing...'.colorize(:light_cyan)
    return true
  elsif str == 'n'
    return false
  else
    puts '  - Invalid choice!'.colorize(:red).bold
    print '  - Options are "y" or "n" - Please try again! (y/n) '
    yes_or_no
  end
end