Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gem.last_initializer #6212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/mruby/gem.rb
Expand Up @@ -43,6 +43,7 @@ class Specification
def initialize(name, &block)
@name = name
@initializer = block
@last_initializer = nil
@version = "0.0.0"
@dependencies = []
@conflicts = []
Expand Down Expand Up @@ -84,6 +85,7 @@ def setup
build.libmruby_objs << @objs

instance_eval(&@build_config_initializer) if @build_config_initializer
instance_eval(&@last_initializer) if @last_initializer

repo_url = build.gem_dir_to_repo_url[dir]
build.locks[repo_url]['version'] = version if repo_url
Expand Down Expand Up @@ -192,6 +194,14 @@ def srcs_to_objs(src_dir_from_gem_dir)
end
end

# This method is for GEM authors.
#
# If the user wants to adjust GEM, provide block arguments to
# the `MRuby::Build#gem` method in the build configuration file.
def last_initializer(&block)
@last_initializer = block
end

def define_gem_init_builder
file "#{build_dir}/gem_init.c" => [build.mrbcfile, __FILE__] + [rbfiles].flatten do |t|
mkdir_p build_dir
Expand Down