Module: Thermite::Package
- Included in:
- Tasks
- Defined in:
- lib/thermite/package.rb
Overview
Helpers to package the Rust library, using FPM.
Instance Method Summary collapse
-
#build_package ⇒ Object
Builds a tarball of the Rust-compiled shared library.
-
#prepare_downloaded_library ⇒ Object
:nocov:.
-
#unpack_tarball(tgz) ⇒ Object
Unpack a gzipped tarball stream (specified by
tgz
) into the current working directory.
Instance Method Details
#build_package ⇒ Object
Builds a tarball of the Rust-compiled shared library.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/thermite/package.rb', line 33 def build_package filename = config.tarball_filename(config.toml[:package][:version]) relative_library_path = config.ruby_extension_path.sub("#{config.ruby_toplevel_dir}/", '') prepare_built_library Zlib::GzipWriter.open(filename) do |tgz| Dir.chdir(config.ruby_toplevel_dir) do Archive::Tar::Minitar.pack(relative_library_path, tgz) end end end |
#prepare_downloaded_library ⇒ Object
:nocov:
61 62 63 64 65 66 67 68 |
# File 'lib/thermite/package.rb', line 61 def prepare_downloaded_library return unless config.target_os.start_with?('darwin') libruby_path = Shellwords.escape(config.libruby_path) library_path = Shellwords.escape(config.ruby_extension_path) `install_name_tool -id #{library_path} #{library_path}` `install_name_tool -change @libruby_path@ #{libruby_path} #{library_path}` end |
#unpack_tarball(tgz) ⇒ Object
Unpack a gzipped tarball stream (specified by tgz
) into the current
working directory.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/thermite/package.rb', line 48 def unpack_tarball(tgz) Dir.chdir(config.ruby_toplevel_dir) do each_compressed_file(tgz) do |path, entry| debug "Unpacking file: #{path}" File.open(path, 'wb') do |f| f.write(entry.read) end end end end |