Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 4a8e52c

Browse files
authored
Merge pull request #165 from tildeio/revert-148-split_out_init
Revert "Allow calling init seperately"
2 parents 73e0534 + ed7a3bb commit 4a8e52c

File tree

9 files changed

+6
-69
lines changed

9 files changed

+6
-69
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ before_install:
4545
- if [ ! -e "$HOME/.cargo/bin" ]; then curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_VERSION -y; fi
4646
- export PATH="$HOME/.cargo/bin:$PATH"
4747
- rustup default $RUST_VERSION
48+
- gem install bundler
4849

4950
install:
5051
- ./scripts/ci-install

README.md

-7
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,3 @@ hello
8282
hello world
8383
=> nil
8484
```
85-
86-
To run all tests in the repository, run
87-
88-
```shell
89-
rake install
90-
rake
91-
```

examples/duration/duration.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Gem::Specification.new do |spec|
2626
spec.require_paths = ["lib"]
2727

2828
spec.add_runtime_dependency "helix_runtime"
29-
spec.add_development_dependency "bundler", "~> 1.11"
3029
spec.add_development_dependency "rake", "~> 10.0"
3130
spec.add_development_dependency "minitest", "~> 5.0"
3231
end

examples/turbo_blank/turbo_blank.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Gem::Specification.new do |spec|
2727
spec.require_paths = ["lib"]
2828

2929
spec.add_runtime_dependency "helix_runtime"
30-
spec.add_development_dependency "bundler", "~> 1.11"
3130
spec.add_development_dependency "rake", "~> 10.0"
3231
spec.add_development_dependency "minitest", "~> 5.0"
3332
end

ruby/helix_runtime.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
2828
spec.add_dependency "thor", [">= 0.19.4", "< 2.0"]
2929
spec.add_dependency "tomlrb", "~> 1.2.4"
3030

31-
spec.add_development_dependency "bundler", "~> 1.10"
31+
spec.add_development_dependency "bundler", "~> 2.0"
3232
spec.add_development_dependency "rspec", "~> 3.4"
3333
spec.add_development_dependency "rake-compiler", "~> 0.9.7"
3434
end

ruby/lib/helix_runtime/project.rb

-3
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ def cargo_build
100100
if ENV['VERBOSE']
101101
cargo_args << " --verbose"
102102
end
103-
if ENV['CARGO_EXTRA_ARGS']
104-
cargo_args << ENV['CARGO_EXTRA_ARGS']
105-
end
106103
if link_args
107104
rustc_args << "-C link-args=#{link_args}"
108105
end

src/coercions/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,3 @@ pub type ToRubyResult = Result<VALUE, Error>;
4949
pub trait ToRuby {
5050
fn to_ruby(self) -> ToRubyResult;
5151
}
52-
53-
pub trait InitRuby {
54-
fn init_ruby();
55-
}

src/macros/codegen.rs

+1-35
Original file line numberDiff line numberDiff line change
@@ -222,44 +222,10 @@ macro_rules! codegen_method {
222222
};
223223
}
224224

225-
#[macro_export]
226-
macro_rules! codegen_ruby_init {
227-
({
228-
type: class,
229-
rust_name: $rust_name:tt,
230-
ruby_name: $ruby_name:tt,
231-
meta: { pub: $pub:tt, reopen: $reopen:tt },
232-
struct: $struct:tt,
233-
methods: $methods:tt
234-
}) => (
235-
impl $crate::InitRuby for $rust_name {
236-
fn init_ruby() {
237-
codegen_class_binding!({
238-
type: class,
239-
rust_name: $rust_name,
240-
ruby_name: $ruby_name,
241-
meta: { pub: $pub, reopen: $reopen },
242-
struct: $struct,
243-
methods: $methods
244-
}, {
245-
type: class,
246-
rust_name: $rust_name,
247-
ruby_name: $ruby_name,
248-
meta: { pub: $pub, reopen: $reopen },
249-
struct: $struct,
250-
methods: $methods
251-
});
252-
}
253-
}
254-
);
255-
}
256-
257-
258225
#[macro_export]
259226
macro_rules! codegen_extra_impls {
260227
($class:tt) => (
261228
codegen_allocator!($class);
262229
codegen_coercions!($class);
263-
codegen_ruby_init!($class);
264230
)
265-
}
231+
}

src/macros/init.rs

+3-17
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
#[macro_export]
22
macro_rules! codegen_init {
3-
// Extracts the list of rust class names and calls the actual codegen_init with that
4-
{ [ $({
5-
type: class,
6-
rust_name: $rust_name:tt,
7-
ruby_name: { $($ruby_name:tt) * },
8-
meta: { pub: $pub:tt, reopen: $reopen:tt },
9-
struct: $struct:tt,
10-
methods: [ $($method:tt) * ]
11-
})* ] } => (
12-
codegen_init!{ [ $($rust_name)* ] }
13-
);
14-
15-
{ [ $($rust_name:tt)* ] } => {
3+
{ [ $($class:tt)* ] } => {
164
#[allow(non_snake_case)]
175
#[no_mangle]
186
pub extern "C" fn Init_native() {
19-
use $crate::InitRuby;
207
$crate::sys::check_version();
218

229
$(
23-
$rust_name::init_ruby();
10+
codegen_class_binding!($class, $class);
2411
)*
2512
}
26-
};
13+
}
2714
}
2815

29-
3016
#[macro_export]
3117
macro_rules! codegen_class_binding {
3218
{ $class:tt, {

0 commit comments

Comments
 (0)