Merge pull request #165 from tildeio/revert-148-split_out_init

Revert "Allow calling init seperately"
This commit is contained in:
Peter Wagenet 2019-07-30 11:15:00 -07:00 committed by GitHub
commit 4a8e52cb56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 6 additions and 69 deletions

View File

@ -45,6 +45,7 @@ before_install:
- if [ ! -e "$HOME/.cargo/bin" ]; then curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_VERSION -y; fi
- export PATH="$HOME/.cargo/bin:$PATH"
- rustup default $RUST_VERSION
- gem install bundler
install:
- ./scripts/ci-install

View File

@ -82,10 +82,3 @@ hello
hello world
=> nil
```
To run all tests in the repository, run
```shell
rake install
rake
```

View File

@ -26,7 +26,6 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.add_runtime_dependency "helix_runtime"
spec.add_development_dependency "bundler", "~> 1.11"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "minitest", "~> 5.0"
end

View File

@ -27,7 +27,6 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.add_runtime_dependency "helix_runtime"
spec.add_development_dependency "bundler", "~> 1.11"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "minitest", "~> 5.0"
end

View File

@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "thor", [">= 0.19.4", "< 2.0"]
spec.add_dependency "tomlrb", "~> 1.2.4"
spec.add_development_dependency "bundler", "~> 1.10"
spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rspec", "~> 3.4"
spec.add_development_dependency "rake-compiler", "~> 0.9.7"
end

View File

@ -100,9 +100,6 @@ module HelixRuntime
if ENV['VERBOSE']
cargo_args << " --verbose"
end
if ENV['CARGO_EXTRA_ARGS']
cargo_args << ENV['CARGO_EXTRA_ARGS']
end
if link_args
rustc_args << "-C link-args=#{link_args}"
end

View File

@ -49,7 +49,3 @@ pub type ToRubyResult = Result<VALUE, Error>;
pub trait ToRuby {
fn to_ruby(self) -> ToRubyResult;
}
pub trait InitRuby {
fn init_ruby();
}

View File

@ -222,44 +222,10 @@ macro_rules! codegen_method {
};
}
#[macro_export]
macro_rules! codegen_ruby_init {
({
type: class,
rust_name: $rust_name:tt,
ruby_name: $ruby_name:tt,
meta: { pub: $pub:tt, reopen: $reopen:tt },
struct: $struct:tt,
methods: $methods:tt
}) => (
impl $crate::InitRuby for $rust_name {
fn init_ruby() {
codegen_class_binding!({
type: class,
rust_name: $rust_name,
ruby_name: $ruby_name,
meta: { pub: $pub, reopen: $reopen },
struct: $struct,
methods: $methods
}, {
type: class,
rust_name: $rust_name,
ruby_name: $ruby_name,
meta: { pub: $pub, reopen: $reopen },
struct: $struct,
methods: $methods
});
}
}
);
}
#[macro_export]
macro_rules! codegen_extra_impls {
($class:tt) => (
codegen_allocator!($class);
codegen_coercions!($class);
codegen_ruby_init!($class);
)
}
}

View File

@ -1,32 +1,18 @@
#[macro_export]
macro_rules! codegen_init {
// Extracts the list of rust class names and calls the actual codegen_init with that
{ [ $({
type: class,
rust_name: $rust_name:tt,
ruby_name: { $($ruby_name:tt) * },
meta: { pub: $pub:tt, reopen: $reopen:tt },
struct: $struct:tt,
methods: [ $($method:tt) * ]
})* ] } => (
codegen_init!{ [ $($rust_name)* ] }
);
{ [ $($rust_name:tt)* ] } => {
{ [ $($class:tt)* ] } => {
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn Init_native() {
use $crate::InitRuby;
$crate::sys::check_version();
$(
$rust_name::init_ruby();
codegen_class_binding!($class, $class);
)*
}
};
}
}
#[macro_export]
macro_rules! codegen_class_binding {
{ $class:tt, {