Class: Kompo::InstallDeps::ForMacOS::InstallLibyaml::Install

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

Instance Method Summary collapse

Instance Method Details

#cleanObject



192
193
194
195
196
197
198
199
# File 'lib/kompo/tasks/install_deps.rb', line 192

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



182
183
184
185
186
187
188
189
190
# File 'lib/kompo/tasks/install_deps.rb', line 182

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