Commit 96afe4ba authored by Daniel Bovensiepen's avatar Daniel Bovensiepen

Improve Gem Readme Source

parent a7cb9737
...@@ -7,6 +7,7 @@ standardized way into mruby. ...@@ -7,6 +7,7 @@ standardized way into mruby.
The maximal Gem structure looks like this: The maximal Gem structure looks like this:
```
+- GEM_NAME <- Name of Gem +- GEM_NAME <- Name of Gem
| |
+- mrblib/ <- Source for Ruby extension +- mrblib/ <- Source for Ruby extension
...@@ -18,6 +19,7 @@ The maximal Gem structure looks like this: ...@@ -18,6 +19,7 @@ The maximal Gem structure looks like this:
+- Makefile <- Makefile for Gem +- Makefile <- Makefile for Gem
| |
+- README.md <- Readme for Gem +- README.md <- Readme for Gem
```
The folder *mrblib* contains pure Ruby files to extend mruby. The folder *src* 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 contains C files to extend mruby. The folder *test* contains pure Ruby files
...@@ -44,17 +46,20 @@ by the name of you Gem. The directory name of your Gem is considered also ...@@ -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 as the name! If you call your Gem directory *c_extension_example*, your
initialisation method could look like this: initialisation method could look like this:
void ```
mrb_c_extension_example_gem_init(mrb_state* mrb) { void
mrb_c_extension_example_gem_init(mrb_state* mrb) {
_class_cextension = mrb_define_module(mrb, "CExtension"); _class_cextension = mrb_define_module(mrb, "CExtension");
mrb_define_class_method(mrb, _class_cextension, "c_method", mrb_c_method, ARGS_NONE()); 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 mrbgems will also use the *gem-clean* make target to clean up your Gem. Implement
this target with the necessary rules! this target with the necessary rules!
### Example ### Example
```
+- c_extension_example/ +- c_extension_example/
| |
+- src/ +- src/
...@@ -68,6 +73,7 @@ this target with the necessary rules! ...@@ -68,6 +73,7 @@ this target with the necessary rules!
+- Makefile <- Build rules for C extension +- Makefile <- Build rules for C extension
| |
+- README.md +- README.md
```
## Ruby Extension ## Ruby Extension
...@@ -83,6 +89,7 @@ process of your Ruby extension you can use the *Makefile* too. ...@@ -83,6 +89,7 @@ process of your Ruby extension you can use the *Makefile* too.
### Example ### Example
```
+- ruby_extension_example/ +- ruby_extension_example/
| |
+- mrblib/ +- mrblib/
...@@ -96,3 +103,4 @@ process of your Ruby extension you can use the *Makefile* too. ...@@ -96,3 +103,4 @@ process of your Ruby extension you can use the *Makefile* too.
+- Makefile +- Makefile
| |
+- README.md +- README.md
```
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment