mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
59c8d50653
* bin/*, lib/bundler/*, lib/bundler.rb, spec/bundler, man/*: Merge from latest stable branch of bundler/bundler repository and added workaround patches. I will backport them into upstream. * common.mk, defs/gmake.mk: Added `test-bundler` task for test suite of bundler. * tool/sync_default_gems.rb: Added sync task for bundler. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
90 lines
2.4 KiB
Ruby
90 lines
2.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "installing a gem with native extensions", :ruby_repo do
|
|
it "installs" do
|
|
build_repo2 do
|
|
build_gem "c_extension" do |s|
|
|
s.extensions = ["ext/extconf.rb"]
|
|
s.write "ext/extconf.rb", <<-E
|
|
require "mkmf"
|
|
name = "c_extension_bundle"
|
|
dir_config(name)
|
|
raise "OMG" unless with_config("c_extension") == "hello"
|
|
create_makefile(name)
|
|
E
|
|
|
|
s.write "ext/c_extension.c", <<-C
|
|
#include "ruby.h"
|
|
|
|
VALUE c_extension_true(VALUE self) {
|
|
return Qtrue;
|
|
}
|
|
|
|
void Init_c_extension_bundle() {
|
|
VALUE c_Extension = rb_define_class("CExtension", rb_cObject);
|
|
rb_define_method(c_Extension, "its_true", c_extension_true, 0);
|
|
}
|
|
C
|
|
|
|
s.write "lib/c_extension.rb", <<-C
|
|
require "c_extension_bundle"
|
|
C
|
|
end
|
|
end
|
|
|
|
gemfile <<-G
|
|
source "file://#{gem_repo2}"
|
|
gem "c_extension"
|
|
G
|
|
|
|
bundle "config build.c_extension --with-c_extension=hello"
|
|
bundle "install"
|
|
|
|
expect(out).not_to include("extconf.rb failed")
|
|
expect(out).to include("Installing c_extension 1.0 with native extensions")
|
|
|
|
run "Bundler.require; puts CExtension.new.its_true"
|
|
expect(out).to eq("true")
|
|
end
|
|
|
|
it "installs from git" do
|
|
build_git "c_extension" do |s|
|
|
s.extensions = ["ext/extconf.rb"]
|
|
s.write "ext/extconf.rb", <<-E
|
|
require "mkmf"
|
|
name = "c_extension_bundle"
|
|
dir_config(name)
|
|
raise "OMG" unless with_config("c_extension") == "hello"
|
|
create_makefile(name)
|
|
E
|
|
|
|
s.write "ext/c_extension.c", <<-C
|
|
#include "ruby.h"
|
|
|
|
VALUE c_extension_true(VALUE self) {
|
|
return Qtrue;
|
|
}
|
|
|
|
void Init_c_extension_bundle() {
|
|
VALUE c_Extension = rb_define_class("CExtension", rb_cObject);
|
|
rb_define_method(c_Extension, "its_true", c_extension_true, 0);
|
|
}
|
|
C
|
|
|
|
s.write "lib/c_extension.rb", <<-C
|
|
require "c_extension_bundle"
|
|
C
|
|
end
|
|
|
|
bundle! "config build.c_extension --with-c_extension=hello"
|
|
|
|
install_gemfile! <<-G
|
|
gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump}
|
|
G
|
|
|
|
expect(out).not_to include("extconf.rb failed")
|
|
|
|
run! "Bundler.require; puts CExtension.new.its_true"
|
|
expect(out).to eq("true")
|
|
end
|
|
end
|