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
1f45b85a
Commit
1f45b85a
authored
May 02, 2013
by
Daniel Bovensiepen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetic improvements of mrbgems documentation
Cosmetic improvements of mrbgems documentation
parent
96637a77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
doc/mrbgems/README.md
doc/mrbgems/README.md
+17
-17
No files found.
doc/mrbgems/README.md
View file @
1f45b85a
...
...
@@ -6,7 +6,7 @@ standardised way into mruby.
## Usage
By default mrbgems is currently deactivated. As soon as you add a GEM to your
build configuration (
*build_config.rb*
), mrbgems will be activated and the
build configuration (
i.e.
*build_config.rb*
), mrbgems will be activated and the
extension integrated.
To add a GEM into the
*build_config.rb*
add the following line for example:
...
...
@@ -25,41 +25,41 @@ A remote GIT repository location for a GEM is also supported:
conf.gem :bitbucket => 'mruby/mrbgems-example', :branch => 'master'
NOTE:
':bitbucket'
option supports only git. Hg is unsupported in this version.
NOTE:
`:bitbucket`
option supports only git. Hg is unsupported in this version.
## GemBox
There are instances when you wish to add a collection of gems into mruby at
once, or be able to substitute gems based on configuration, without having to
add each gem to the
*build_config.rb*
file. A packaged collection of mrbgems
is called a Gem
box. A Gemb
ox is a file that contains a list of gems to load
is called a Gem
Box. A GemB
ox is a file that contains a list of gems to load
into mruby, in the same format as if you were adding them to
*build_config.rb*
via
`config.gem`
, but wrapped in an
`
``Mruby::GemBox```
object. Gemb
oxes are
loaded into mruby via
`config.gembox
boxname
`
.
via
`config.gem`
, but wrapped in an
`
MRuby::GemBox`
object. GemB
oxes are
loaded into mruby via
`config.gembox
'boxname'
`
.
Below we have created a Gem
box containing mruby-time and mrbgems-example
:
Below we have created a Gem
Box containing
*mruby-time*
and
*mrbgems-example*
:
MRuby::GemBox.new do |conf|
conf.gem "#{root}/mrbgems/mruby-time"
conf.gem :github => 'masuidrive/mrbgems-example'
end
As mentioned, the Gem
box uses the same conventions as
`MRuby::Build`
. The Gemb
ox
As mentioned, the Gem
Box uses the same conventions as
`MRuby::Build`
. The GemB
ox
must be saved with a
*.gembox*
extension inside the
*mrbgems*
directory to to be
picked up by mruby.
To use this example Gem
box, we save it as 'custom.box'
inside the
*mrbgems*
To use this example Gem
Box, we save it as
`custom.gembox`
inside the
*mrbgems*
directory in mruby, and add the following to our
*build_config.rb*
file inside
the build block:
conf.gembox 'custom'
This will cause the
'custom' gemb
ox to be read in during the build process,
adding
mruby-time and mrbgems-example
to the build.
This will cause the
*custom*
GemB
ox to be read in during the build process,
adding
*mruby-time*
and
*mrbgems-example*
to the build.
There are two Gem
boxes that ship with mruby:
[
default
](
mrbgems/default.gembox
)
and
[
full-core
](
mrbgems/full-core
)
. The
[
default
](
mrbgems/default.gembox
)
Gemb
ox
contains several core components of mruby, and
[
full-core
](
mrbgems/full-core
)
There are two Gem
Boxes that ship with mruby:
[
default
](
../../
mrbgems/default.gembox
)
and
[
full-core
](
../../mrbgems/full-core.gembox
)
. The
[
default
](
../../mrbgems/default.gembox
)
GemB
ox
contains several core components of mruby, and
[
full-core
](
../../mrbgems/full-core.gembox
)
contains every gem found in the
*mrbgems*
directory.
## GEM Structure
...
...
@@ -80,7 +80,7 @@ The maximal GEM structure looks like this:
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
for testing purposes which will be used by
`
``mrbtest``
`
.
*mrbgem.rake*
contains
for testing purposes which will be used by
`
mrbtest
`
.
*mrbgem.rake*
contains
the specification to compile C and Ruby files.
*README.md*
is a short description
of your GEM.
...
...
@@ -96,7 +96,7 @@ GEM direcotry. A typical GEM specification could look like this for example:
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
by tools like
`
``mruby```
and
```mirb``
`
to empower the GEM functionality.
by tools like
`
mruby`
and
`mirb
`
to empower the GEM functionality.
In case your GEM has more complex build requirements you can use
the following options additionally inside of your GEM specification:
...
...
@@ -120,7 +120,7 @@ integrate C libraries into mruby.
### Pre-Conditions
mrbgems expects that you have implemented a C method called
`
``
mrb_YOURGEMNAME_gem_init(mrb_state)```. ```YOURGEMNAME``
` will be replaced
`
mrb_YOURGEMNAME_gem_init(mrb_state)`
.
`YOURGEMNAME
`
will be replaced
by the name of your GEM. If you call your GEM
*c_extension_example*
, your
initialisation method could look like this:
...
...
@@ -133,7 +133,7 @@ initialisation method could look like this:
### Finalize
mrbgems expects that you have implemented a C method called
`
``
mrb_YOURGEMNAME_gem_final(mrb_state)
```. ```
YOURGEMNAME
``
`
will be replaced
`
mrb_YOURGEMNAME_gem_final(mrb_state)`
.
`YOURGEMNAME
`
will be replaced
by the name of your GEM. If you call your GEM
*c_extension_example*
, your
finalizer method could look like this:
...
...
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