Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contribution Guide
## Add wrapper function for C
### 1. Generate skeleton
Run `ruby _scripts/dump_ruby_c_functions.rb`

Executing [`ruby _scripts/dump_ruby_c_functions.rb`](./_scripts/dump_ruby_c_functions.rb) will generate Go source code under `_scripts/dist/` based on `ruby.h`

In many cases there is an error on the last `go fmt`, but it's not a problem :sweat_smile:

### 2. Move function to top directory
Modify some of the auto-generated functions and add them to the ruby package in the top directory

### 3. Add a test that calls the added function
There is a dummy gem for this wrapper in [testdata/dummy/](testdata/dummy/).

Refer to following and add test code to call the added wrapper function.

* [testdata/dummy/ext/dummy/dummy.go](testdata/dummy/ext/dummy/dummy.go)
* [testdata/dummy/sig/dummy.rbs](testdata/dummy/sig/dummy.rbs)
* [testdata/dummy/spec/dummy_spec.rb](testdata/dummy/spec/dummy_spec.rb)

### 4. Run test
Run `rake ruby:build_dummy`.

### 5. Check coverage
[Coverage](README.md#coverage) lists Ruby's C functions, so check the functions you have added. (if there is no entry, add it)

### 6. Send patch
27 changes: 1 addition & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,7 @@ Run `rake ruby:build_dummy`. (`bundle exec` is not required)
See `rake -T` for more tasks.

### Add wrapper function for C
#### 1. Generate skeleton
Run `ruby _scripts/dump_ruby_c_functions.rb`

Executing [`ruby ./_scripts/dump_ruby_c_functions.rb`](./_scripts/dump_ruby_c_functions.rb) will generate Go source code under `_scripts/dist/` based on `ruby.h`

In many cases there is an error on the last `go fmt`, but it's not a problem :sweat_smile:

#### 2. Move function to top directory
Modify some of the auto-generated functions and add them to the ruby package in the top directory

#### 3. Add a test that calls the added function
There is a dummy gem for this wrapper in [testdata/dummy/](testdata/dummy/).

Refer to following and add test code to call the added wrapper function.

* [testdata/dummy/ext/dummy/dummy.go](testdata/dummy/ext/dummy/dummy.go)
* [testdata/dummy/sig/dummy.rbs](testdata/dummy/sig/dummy.rbs)
* [testdata/dummy/spec/dummy_spec.rb](testdata/dummy/spec/dummy_spec.rb)

#### 4. Run test
Run `rake ruby:build_dummy`.

#### 5. Check coverage
[Coverage](#coverage) lists Ruby's C functions, so check the functions you have added. (if there is no entry, add it)

#### 6. Send patch
See [CONTRIBUTING.md](CONTRIBUTING.md)

### See `godoc` in local
```bash
Expand Down