module RubymentGemGenerationModule

# begin_documentation

This module offers functions to generate or deploy gem packages.

As of now, there are many similar functions directly coded in RubymentModule; they will be moved here upon proper maintenance/cleanup

# end_documentation

Public Instance Methods

gem_deploy__non_ruby_binaries(args) click to toggle source

Gem files by default can distribute only Ruby files. This function implements the work needed to convert and automatize the generation of ruby executables out of non ruby binaries

# File lib/rubyment.rb, line 1413
def gem_deploy__non_ruby_binaries args
  gem_name,
    gem_non_ruby_executables,
    gem_executables, # same as gem_bin_executables
    reserved = args

  new_executables = gem_non_ruby_executables.map { |gem_non_ruby_executable|

    new_gem_executable = string__recursive_join [
      "/",
      "bin",
      File.basename(gem_non_ruby_executable),
    ]

    new_gem_executable_contents = ruby_code__from_binary(
      [
        nil,
        File.read(gem_non_ruby_executable),
      ],
      [
        gem_name,
      ],
    )

    # write file
    file_string__experimental [
      new_gem_executable,
      new_gem_executable_contents,
    ]

    bled_call {
      require 'fileutils'
      FileUtils.chmod "+x", new_gem_executable
    }

    File.basename(new_gem_executable)

  } # of gem_non_ruby_executables.map

  gem_executables = gem_executables.nne([]).concat new_executables

  [
    gem_executables,
  ]

end