Class: Kompo::InstallDeps::ForMacOS::InstallZlib::Install

Inherits:
Taski::Task
  • Object
show all
Defined in:
lib/kompo/tasks/install_deps.rb

Instance Method Summary collapse

Instance Method Details

#cleanObject



235
236
237
238
239
240
241
242
# File 'lib/kompo/tasks/install_deps.rb', line 235

def clean
  return unless File.exist?(MARKER_FILE)

  brew = HomebrewPath.path
  puts "Uninstalling #{BREW_NAME} (installed by kompo)..."
  system("#{brew} uninstall #{BREW_NAME}")
  File.delete(MARKER_FILE) if File.exist?(MARKER_FILE)
end

#runObject



225
226
227
228
229
230
231
232
233
# File 'lib/kompo/tasks/install_deps.rb', line 225

def run
  brew = HomebrewPath.path
  puts "Installing #{BREW_NAME}..."
  system("#{brew} install #{BREW_NAME}") or raise "Failed to install #{BREW_NAME}"
  File.write(MARKER_FILE, "installed")

  prefix = `#{brew} --prefix #{BREW_NAME} 2>/dev/null`.chomp
  @lib_path = "-L#{prefix}/lib" if $CHILD_STATUS.success? && !prefix.empty?
end