Top Level Namespace

Defined Under Namespace

Modules: PagePrint

Instance Method Summary collapse

Instance Method Details

#page_print_native_platformObject



3
4
5
6
7
8
9
10
11
12
13
# File 'ext/page_print/extconf.rb', line 3

def page_print_native_platform
  platform = Gem::Platform.local

  if platform.os == 'linux' && platform.cpu == 'x86_64'
    'x86_64-linux'
  elsif platform.os == 'darwin' && platform.cpu == 'arm64'
    'arm64-darwin'
  else
    platform.to_s
  end
end

#restore_vendor_so_aliases(vendor_lib_dir) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'ext/page_print/extconf.rb', line 15

def restore_vendor_so_aliases(vendor_lib_dir)
  manifest_path = File.join(vendor_lib_dir, 'so_aliases')
  return unless File.file?(manifest_path)

  File.foreach(manifest_path) do |line|
    alias_name, target_name = line.strip.split("\t", 2)
    next if alias_name.nil? || alias_name.empty? || target_name.nil? || target_name.empty?
    next if alias_name.include?('/') || target_name.include?('/') || alias_name.start_with?('.') || target_name.start_with?('.')

    alias_path = File.join(vendor_lib_dir, alias_name)
    target_path = File.join(vendor_lib_dir, target_name)
    next unless File.file?(target_path)
    next if File.exist?(alias_path) || File.symlink?(alias_path)

    File.symlink(target_name, alias_path)
  end
end