Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
f6195693
Commit
f6195693
authored
Jan 23, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #772 from arciem/updateMarkdown
Fixed markdown of code in mrbgems/README.md
parents
8961a788
28ac47ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
86 deletions
+67
-86
doc/mrbgems/README.md
doc/mrbgems/README.md
+67
-86
No files found.
doc/mrbgems/README.md
View file @
f6195693
...
@@ -11,44 +11,34 @@ extension integrated.
...
@@ -11,44 +11,34 @@ extension integrated.
To add a GEM into the build_config.rb add the following line for example:
To add a GEM into the build_config.rb add the following line for example:
```
conf.gem '/path/to/your/gem/dir'
conf.gem '/path/to/your/gem/dir'
```
You can also use a relative path which would be relative from the mruby root:
You can also use a relative path which would be relative from the mruby root:
```
conf.gem 'doc/mrbgems/ruby_extension_example'
conf.gem 'doc/mrbgems/ruby_extension_example'
```
A remote GIT repository location for a GEM is also supported:
A remote GIT repository location for a GEM is also supported:
```
conf.gem :git => 'https://github.com/masuidrive/mrbgems-example.git', :branch => 'master'
conf.gem :git => 'https://github.com/masuidrive/mrbgems-example.git', :branch => 'master'
```
```
conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
```
## GEM Structure
## GEM Structure
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
|
|
+- src/ <- Source for C extension
+- src/ <- Source for C extension
|
|
+- test/ <- Test code (Ruby)
+- test/ <- Test code (Ruby)
|
|
+- mrbgem.rake <- GEM Specification
+- mrbgem.rake <- GEM Specification
|
|
+- 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 C and pure Ruby files
contains C files to extend mruby. The folder
*test*
contains C and pure Ruby files
...
@@ -61,12 +51,10 @@ of your GEM.
...
@@ -61,12 +51,10 @@ of your GEM.
mrbgems expects a specifcation file called
*mrbgem.rake*
inside of your
mrbgems expects a specifcation file called
*mrbgem.rake*
inside of your
GEM direcotry. A typical GEM specification could look like this for example:
GEM direcotry. A typical GEM specification could look like this for example:
```
MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec|
MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec|
spec.license = 'MIT'
spec.license = 'MIT'
spec.authors = 'mruby developers'
spec.authors = 'mruby developers'
end
end
```
The mrbgems build process will use this specification to compile Object and Ruby
The mrbgems build process will use this specification to compile Object and Ruby
files. The compilation results will be add to
*lib/libmruby.a*
. This file is used
files. The compilation results will be add to
*lib/libmruby.a*
. This file is used
...
@@ -98,13 +86,11 @@ mrbgems expects that you have implemented a C method called
...
@@ -98,13 +86,11 @@ mrbgems expects that you have implemented a C method called
by the name of your GEM. If you call your GEM *c_extension_example*, your
by the name of your GEM. If you call your GEM *c_extension_example*, your
initialisation method could look like this:
initialisation method could look like this:
```
void
void
mrb_c_extension_example_gem_init(mrb_state* mrb) {
mrb_c_extension_example_gem_init(mrb_state
*
mrb) {
struct RClass *class_cextension = mrb_define_module(mrb, "CExtension");
struct RClass
*
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());
}
}
```
### Finalize
### Finalize
...
@@ -123,21 +109,19 @@ mrb_c_extension_example_gem_final(mrb_state* mrb) {
...
@@ -123,21 +109,19 @@ mrb_c_extension_example_gem_final(mrb_state* mrb) {
### Example
### Example
```
+- c_extension_example/
+- c_extension_example/
|
|
+- src/
+- src/
| |
| |
| +- example.c <- C extension source
| +- example.c <- C extension source
|
|
+- test/
+- test/
| |
| |
| +- example.rb <- Test code for C extension
| +- example.rb <- Test code for C extension
|
|
+- mrbgem.rake <- GEM specification
+- mrbgem.rake <- GEM specification
|
|
+- README.md
+- README.md
```
## Ruby Extension
## Ruby Extension
...
@@ -151,21 +135,19 @@ none
...
@@ -151,21 +135,19 @@ none
### Example
### Example
```
+- ruby_extension_example/
+- ruby_extension_example/
|
|
+- mrblib/
+- mrblib/
| |
| |
| +- example.rb <- Ruby extension source
| +- example.rb <- Ruby extension source
|
|
+- test/
+- test/
| |
| |
| +- example.rb <- Test code for Ruby extension
| +- example.rb <- Test code for Ruby extension
|
|
+- mrbgem.rake <- GEM specification
+- mrbgem.rake <- GEM specification
|
|
+- README.md
+- README.md
```
## C and Ruby Extension
## C and Ruby Extension
...
@@ -179,21 +161,20 @@ See C and Ruby example.
...
@@ -179,21 +161,20 @@ See C and Ruby example.
### Example
### Example
```
+- c_and_ruby_extension_example/
+- c_and_ruby_extension_example/
|
|
+- mrblib/
+- mrblib/
| |
| |
| +- example.rb <- Ruby extension source
| +- example.rb <- Ruby extension source
|
|
+- src/
+- src/
| |
| |
| +- example.c <- C extension source
| +- example.c <- C extension source
|
|
+- test/
+- test/
| |
| |
| +- example.rb <- Test code for C and Ruby extension
| +- example.rb <- Test code for C and Ruby extension
|
|
+- mrbgem.rake <- GEM specification
+- mrbgem.rake <- GEM specification
|
|
+- README.md
+- README.md
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment