Module: EasyAuto::SystemHelper

Included in:
Authorize, EasySetup, Git, PullRequest
Defined in:
lib/easy_auto/system_helper.rb

Instance Method Summary collapse

Instance Method Details

#check_install(software_name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/easy_auto/system_helper.rb', line 14

def check_install software_name
  software_path = cli_send "which #{software_name}"
  if software_path.empty?
    puts "no #{software_name} detected!"
    if os == "Darwin"
      puts "installing with brew.."
      cli_send "brew install #{software_name}"
      puts "installed #{software_name}!"
    else
      puts "install #{software_name} and try again!"
      exit 1
    end
  end
end

#cli_send(command) ⇒ Object



5
6
7
8
# File 'lib/easy_auto/system_helper.rb', line 5

def cli_send command
  output, error, status = Open3.capture3 command
  output.strip
end

#osObject



10
11
12
# File 'lib/easy_auto/system_helper.rb', line 10

def os
  cli_send "uname"
end