Skip to content

Commit

Permalink
Improve Gem Readme Source
Browse files Browse the repository at this point in the history
  • Loading branch information
bovi committed Sep 23, 2012
1 parent a7cb973 commit 96afe4b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions doc/mrbgems/README.md
Expand Up @@ -7,6 +7,7 @@ standardized way into mruby.

The maximal Gem structure looks like this:

```
+- GEM_NAME <- Name of Gem
|
+- mrblib/ <- Source for Ruby extension
Expand All @@ -18,6 +19,7 @@ The maximal Gem structure looks like this:
+- Makefile <- Makefile for Gem
|
+- README.md <- Readme for Gem
```

The folder *mrblib* contains pure Ruby files to extend mruby. The folder *src*
contains C files to extend mruby. The folder *test* contains pure Ruby files
Expand All @@ -44,17 +46,20 @@ by the name of you Gem. The directory name of your Gem is considered also
as the name! If you call your Gem directory *c_extension_example*, your
initialisation method could look like this:

void
mrb_c_extension_example_gem_init(mrb_state* mrb) {
_class_cextension = mrb_define_module(mrb, "CExtension");
mrb_define_class_method(mrb, _class_cextension, "c_method", mrb_c_method, ARGS_NONE());
}
```
void
mrb_c_extension_example_gem_init(mrb_state* mrb) {
_class_cextension = mrb_define_module(mrb, "CExtension");
mrb_define_class_method(mrb, _class_cextension, "c_method", mrb_c_method, ARGS_NONE());
}
```

mrbgems will also use the *gem-clean* make target to clean up your Gem. Implement
this target with the necessary rules!

### Example

```
+- c_extension_example/
|
+- src/
Expand All @@ -68,6 +73,7 @@ this target with the necessary rules!
+- Makefile <- Build rules for C extension
|
+- README.md
```

## Ruby Extension

Expand All @@ -83,6 +89,7 @@ process of your Ruby extension you can use the *Makefile* too.

### Example

```
+- ruby_extension_example/
|
+- mrblib/
Expand All @@ -96,3 +103,4 @@ process of your Ruby extension you can use the *Makefile* too.
+- Makefile
|
+- README.md
```

0 comments on commit 96afe4b

Please sign in to comment.