feat(CI): add the GitHub Super Linter

The GitHub Super Linter is a more robust and better supported
tool than the current GitHub Actions we are using.

Running these checks:

ERROR_ON_MISSING_EXEC_BIT: true
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_EDITORCONFIG: true
VALIDATE_MARKDOWN: true
VALIDATE_SHELL_SHFMT: true
VALIDATE_YAML: true

https://github.com/marketplace/actions/super-linter
https://github.com/github/super-linter

Added the GitHub Super Linter badge to the README.

Also updated the pre-commit framework and added
more documentation on pre-commit.

Added one more pre-commit check: check-executables-have-shebangs

Added one extra check for merge conflicts to our
GitHub Actions.

EditorConfig and Markdown linting.

Minor grammar and spelling fixes.

Update linter.yml
This commit is contained in:
John Bampton
2021-04-11 12:51:28 +10:00
committed by Yukihiro "Matz" Matsumoto
parent ac9038121b
commit 9d32d440eb
49 changed files with 300 additions and 260 deletions
+12
View File
@@ -0,0 +1,12 @@
{
"verbose": false,
"ignore_defaults": false,
"exclude": ["oss-fuzz/", "src/"],
"disable": {
"end_of_line": false,
"trim_trailing_whitespace": false,
"insert_final_newline": false,
"indent_size": true,
"indent_style": true
}
}
@@ -1,16 +1,12 @@
MD001: false
MD003: false
MD004: false
MD005: false
MD007: false
MD010: false
MD011: false
MD013: false
MD014: false
MD024: false
MD025: false
MD026: false
MD034: false
MD040: false
MD041: false
MD046: false
+15 -35
View File
@@ -1,52 +1,32 @@
name: ❄️ Lint
name: Lint
on: [pull_request]
jobs:
markdownlint:
name: 🍸 Markdown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🚀 Use Node.js
uses: actions/setup-node@v2.1.5
with:
node-version: '14'
- run: npm install -g markdownlint-cli@0.27.1
- run: markdownlint '**/*.md'
misspell:
name: 🥛 Check Spelling
name: Check Spelling
runs-on: ubuntu-latest
steps:
- name: 🍒 Check Out
- name: Check Out
uses: actions/checkout@v2
- name: 🍅 Install
- name: Install
run: |
wget -O - -q https://git.io/misspell | sh -s -- -b .
- name: 🌶️ Misspell
- name: Misspell
run: |
git ls-files --empty-directory | xargs ./misspell -error
merge-conflict:
name: Merge Conflict
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check merge conflict
run: |
grep "^<<<<<<< HEAD" $(git ls-files | xargs) && exit 1 || true
trailing-whitespace:
name: 🧋 Trailing whitespace
name: Trailing whitespace
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🧹 Check for trailing whitespace
- name: Check for trailing whitespace
run: "! git grep -EIn $'[ \t]+$'"
yamllint:
name: 🍶 YAML
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install yamllint
- name: 🧹 YAML Lint
run: |
# return non-zero exit code on warnings
yamllint --strict .
+25
View File
@@ -0,0 +1,25 @@
name: Lint Code Base
on:
push:
branches-ignore: [master]
# Remove the line above to run when pushing to master
pull_request:
branches: [master]
jobs:
build:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: github/super-linter@v3
env:
ERROR_ON_MISSING_EXEC_BIT: true
VALIDATE_BASH: true
# VALIDATE_BASH_EXEC: true
# VALIDATE_EDITORCONFIG: true
VALIDATE_MARKDOWN: true
# VALIDATE_SHELL_SHFMT: true
VALIDATE_YAML: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+6 -3
View File
@@ -14,6 +14,8 @@ repos:
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
exclude: ^test/t/lang\.rb$
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
@@ -26,14 +28,15 @@ repos:
# - id: forbid-tabs
# - id: remove-tabs
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.26.0
rev: v0.27.1
hooks:
- id: markdownlint
name: Run markdownlint
entry: markdownlint -c .github/linters/.markdown-lint.yml .
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.0
rev: v1.26.1
hooks:
- id: yamllint
name: Check YAML files with yamllint
entry: yamllint --strict .
entry: yamllint --strict -c .github/linters/.yaml-lint.yml .
types: [yaml]
+12 -2
View File
@@ -22,11 +22,21 @@ things in mind before submitting your pull request:
A framework for managing and maintaining multi-language pre-commit hooks.
Pre-commit can be [installed](https://pre-commit.com/#installation) with `pip`, `curl`, `brew` or `conda`.
You need to first install pre-commit and then install the pre-commit hooks with `pre-commit install`.
Now pre-commit will run automatically on git commit!
It's usually a good idea to run the hooks against all the files when adding new hooks (usually pre-commit will only run on the changed files during git hooks).
Use `pre-commit run --all-files` to check all files.
To run a single hook use `pre-commit run --all-files <hook_id>`
To update use `pre-commit autoupdate`
* [Quick start](https://pre-commit.com/#quick-start)
* [Usage](https://pre-commit.com/#usage)
* [pre-commit-autoupdate](https://pre-commit.com/#pre-commit-autoupdate)
## Coding conventions
How to style your C and Ruby code which you want to submit.
@@ -41,7 +51,7 @@ C code:
mruby should be highly portable to other systems and compilers. For this it is
recommended to keep your code as close as possible to the C99 standard
(http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf).
(<http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf>).
Visual C++ is also an important target for mruby (supported version is 2013 or
later). For this reason features that are not supported by Visual C++ may not
@@ -73,5 +83,5 @@ language itself. Please note the following hints for your Ruby code:
#### Comply with the Ruby standard (ISO/IEC 30170:2012)
mruby is currently targeting to execute Ruby code which complies to ISO/IEC
30170:2012 (https://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579),
30170:2012 (<https://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579>),
unless there's a clear reason, e.g. the latest Ruby has changed behavior from ISO.
+14 -5
View File
@@ -1,4 +1,7 @@
# mruby
[![Build Status][build-status-img]][travis-ci]
[![GitHub Super-Linter](https://github.com/mruby/mruby/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter)
## What is mruby
@@ -24,13 +27,15 @@ The latest development version of mruby can be downloaded via the following URL:
The trunk of the mruby source tree can be checked out with the
following command:
$ git clone https://github.com/mruby/mruby.git
```
$ git clone https://github.com/mruby/mruby.git
```
You can also install and compile mruby using [ruby-install](https://github.com/postmodern/ruby-install), [ruby-build](https://github.com/rbenv/ruby-build) or [rvm](https://github.com/rvm/rvm).
## mruby home-page
The URL of the mruby home-page is: https://mruby.org.
The URL of the mruby home-page is: <https://mruby.org>.
## Mailing list
@@ -46,12 +51,16 @@ There are two sets of documentation in mruby: the mruby API (generated by yard)
To build both of them, simply go
rake doc
```
rake doc
```
You can also view them in your browser
rake view_api
rake view_capi
```
rake view_api
rake view_capi
```
## How to customize mruby (mrbgems)
+2 -2
View File
@@ -3,11 +3,11 @@ Thing to Do in the future
# After mruby 3.0
* replace `fp_fmt.c` by `float_format` (https://github.com/dhylands/format-float.git)
* replace `fp_fmt.c` by `float_format` (<https://github.com/dhylands/format-float.git>)
* multi-precision integer
* WORD_BOXING: Pack some floats in `mrb_value`
* NAN_BOXING: Allow `MRB_INT64` along with NaN boxing
* keyword arguments a la Ruby3.0 (using `OP_SENDVK`)
* keyword arguments à la Ruby3.0 (using `OP_SENDVK`)
* parser and code generator independent from `mrb_state` (mmruby?)
# Things to do (Things that are not done yet)
+1 -1
View File
@@ -1,4 +1,4 @@
#from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby
# from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby
NUM = 300
SIZE = 10000
+1 -1
View File
@@ -11,7 +11,7 @@ MRuby::CrossBuild.new("ArduinoDue") do |conf|
# ARDUINO_PATH = '/Applications/Arduino.app/Contents/Java'
# GNU Linux
ARDUINO_PATH = '/opt/arduino'
# Arduino IDE <= 1.5.6
# Arduino IDE <= 1.5.6
BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/g++_arm_none_eabi/bin"
# Arduino IDE >= 1.5.7
# BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin"
+1 -1
View File
@@ -21,7 +21,7 @@ MRuby::CrossBuild.new('core2-32-poky-linux') do |conf|
#
POKY_EDISON_PATH = '/opt/poky-edison/1.7.2'
POKY_EDISON_SYSROOT = "#{POKY_EDISON_PATH}/sysroots/core2-32-poky-linux"
POKY_EDISON_SYSROOT = "#{POKY_EDISON_PATH}/sysroots/core2-32-poky-linux"
POKY_EDISON_X86_PATH = "#{POKY_EDISON_PATH}/sysroots/i386-pokysdk-darwin"
POKY_EDISON_BIN_PATH = "#{POKY_EDISON_X86_PATH}/usr/bin/i586-poky-linux"
+1 -1
View File
@@ -23,7 +23,7 @@ MRuby::Build.new do |conf|
# file extensions
conf.exts do |exts|
exts.library = '.so'
exts.library = '.so'
end
# file separator
+54 -54
View File
@@ -1,73 +1,73 @@
# Cross Compiling configuration for the Nintendo Switch, it requires Nintendo SDK
# Tested on windows
MRuby::CrossBuild.new('nintendo_switch_32bit') do |conf|
conf.toolchain :clang
NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT']
conf.toolchain :clang
NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT']
include_paths = [
"#{NINTENDO_SDK_PATH}/Include",
"#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a32/Include"
]
include_paths = [
"#{NINTENDO_SDK_PATH}/Include",
"#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a32/Include"
]
conf.cc do |cc|
cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++"
cc.include_paths += include_paths
cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float']
cc.defines += 'NN_SDK_BUILD_RELEASE'
end
conf.cc do |cc|
cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++"
cc.include_paths += include_paths
cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float']
cc.defines += 'NN_SDK_BUILD_RELEASE'
end
conf.cxx do |cxx|
cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++"
cxx.include_paths += include_paths
cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float']
cxx.defines += 'NN_SDK_BUILD_RELEASE'
end
conf.cxx do |cxx|
cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++"
cxx.include_paths += include_paths
cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float']
cxx.defines += 'NN_SDK_BUILD_RELEASE'
end
conf.archiver do |archiver|
archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/llvm-ar"
end
conf.archiver do |archiver|
archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/llvm-ar"
end
conf.linker do |linker|
linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/clang++"
linker.libraries = []
end
conf.linker do |linker|
linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/clang++"
linker.libraries = []
end
# Add your mrbgems
# Add your mrbgems
end
MRuby::CrossBuild.new('nintendo_switch_64bit') do |conf|
conf.toolchain :clang
NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT']
conf.toolchain :clang
NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT']
include_paths = [
"#{NINTENDO_SDK_PATH}/Include",
"#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a64/Include"
]
include_paths = [
"#{NINTENDO_SDK_PATH}/Include",
"#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a64/Include"
]
conf.cc do |cc|
cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++"
cc.include_paths += include_paths
cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float']
cc.flags << '--target=aarch64-nintendo-nx-elf'
cc.defines += 'NN_SDK_BUILD_RELEASE'
end
conf.cc do |cc|
cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++"
cc.include_paths += include_paths
cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float']
cc.flags << '--target=aarch64-nintendo-nx-elf'
cc.defines += 'NN_SDK_BUILD_RELEASE'
end
conf.cxx do |cxx|
cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++"
cxx.include_paths += include_paths
cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float']
cxx.flags << '--target=aarch64-nintendo-nx-elf'
cxx.defines += 'NN_SDK_BUILD_RELEASE'
end
conf.cxx do |cxx|
cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++"
cxx.include_paths += include_paths
cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float']
cxx.flags << '--target=aarch64-nintendo-nx-elf'
cxx.defines += 'NN_SDK_BUILD_RELEASE'
end
conf.archiver do |archiver|
archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/llvm-ar"
end
conf.archiver do |archiver|
archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/llvm-ar"
end
conf.linker do |linker|
linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/clang++"
linker.libraries = []
end
conf.linker do |linker|
linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/clang++"
linker.libraries = []
end
# Add your mrbgems
# Add your mrbgems
end
+2 -2
View File
@@ -271,7 +271,7 @@ See doc/mrbgems/README.md for more option about mrbgems.
Configuration Mrbtest build process.
If you want mrbtest.a only, You should set `conf.build_mrbtest_lib_only`
If you want `mrbtest.a` only, You should set `conf.build_mrbtest_lib_only`
```ruby
conf.build_mrbtest_lib_only
@@ -309,7 +309,7 @@ If you need to enable C++ exception explicitly add the following:
conf.enable_cxx_exception
```
#### C++ exception disabling.
#### C++ exception disabling
If your compiler does not support C++, and you want to ensure
you don't use mrbgem written in C++, you can explicitly disable
+2 -2
View File
@@ -115,7 +115,7 @@ The breakpoint will be ordered in serial from 1.
The number, which was given to the deleted breakpoint, will never be given to another breakpoint again.
You can give multiple breakpoints to the specified the line number and method.
Be ware that breakpoint command will not check the validity of the class name and method name.
Be aware that the breakpoint command will not check the validity of the class name and method name.
You can get the current breakpoint information by the following options.
@@ -367,5 +367,5 @@ r
#### Step Command
This will run the program step by step.
When the method and the block are invoked, the program will be stop at the first row.
When the method and the block are invoked, the program will stop at the first row.
The program, which is developed in C, will be ignored.
+3 -3
View File
@@ -3,7 +3,7 @@
_This is an English translation of [Matz's blog post][matz blog post]
written in Japanese._
_Some parts are updated to reflect recent changes._
[matz blog post]: https://www.rubyist.net/~matz/20130731.html
[matz blog post]: <https://www.rubyist.net/~matz/20130731.html>
When you are extending mruby using C language, you may encounter
mysterious "arena overflow error" or memory leak or very slow
@@ -46,7 +46,7 @@ no longer referenced in the Ruby world, and cannot be treated as garbage.
In mruby, we recognize all objects created in C function are alive.
Then we have no problem such as confusing a live object as dead.
This means that because we cannot collect truly dead object, we may
This means that because we cannot collect a truly dead object, we may
lose efficiency, but as a trade-off the GC itself is highly portable.
We can say goodbye to the problem that GC deletes live objects due to
optimization which sometimes occurs in CRuby.
@@ -140,7 +140,7 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list)
}
```
This is a real example, so a little bit complicated, but bear with me.
This is a real example, so slightly complicated, but bear with me.
The essence of `Array#inspect` is that after stringifying each element
of array using `inspect` method, we join them together so that we can
get `inspect` representation of the entire array.
+1 -1
View File
@@ -7,7 +7,7 @@ You have two ways to link `libmruby` to your application.
## Executable Gems
If your application is relatively small, `mrbgem` is easier way to
If your application is relatively small, `mrbgem` is an easier way to
create the executable. By tradition, the gem name start with
`mruby-bin-`, e.g. `mruby-bin-debugger`.
+20 -20
View File
@@ -1,28 +1,28 @@
# mruby configuration macros.
# mruby configuration macros
## How to use these macros.
## How to use these macros
You can use mrbconfs with following ways:
* Write them in `mrbconf.h`.
* Using compiler flags is preferred when building a cross binaries or multiple mruby binaries
since it's easier to use different mrbconf per each `MRuby::Build`.
* Most flags can be enabled by just commenting in.
* Using compiler flags is preferred when building a cross binaries or multiple mruby binaries
since it's easier to use different mrbconf per each `MRuby::Build`.
* Most flags can be enabled by just commenting in.
* Pass them as compiler flags.
* Make sure you pass the same flags to all compilers since some mrbconf(e.g., `MRB_GC_FIXED_ARENA`)
changes `struct` layout and cause memory access error when C and other language(e.g., C++) is mixed.
* Make sure you pass the same flags to all compilers since some mrbconf(e.g., `MRB_GC_FIXED_ARENA`)
changes `struct` layout and cause memory access error when C and other language(e.g., C++) is mixed.
## stdio setting.
## stdio setting
`MRB_NO_STDIO`
* When defined `<stdio.h>` functions won't be used.
* Some features will be disabled when this is enabled:
* `mrb_irep` load/dump from/to file.
* Compiling mruby script from file.
* Compiling mruby script from a file.
* Printing features in **src/print.c**.
## Debug macros.
## Debug macros
`MRB_USE_DEBUG_HOOK`
@@ -54,16 +54,16 @@ You can use mrbconfs with following ways:
* Default value is `0x40000 - MRB_STACK_GROWTH`.
* Raises `RuntimeError` when stack size exceeds this value.
## Primitive type configuration.
## Primitive type configuration
`MRB_USE_FLOAT32`
* When defined single precision floating point type(C type `float`) is used as `mrb_float`.
* Otherwise double precision floating point type(C type `double`) is used as `mrb_float`.
* When defined single precision floating-point type(C type `float`) is used as `mrb_float`.
* Otherwise, double precision floating-point type(C type `double`) is used as `mrb_float`.
`MRB_NO_FLOAT`
* When defined removes floating point numbers from mruby.
* When defined removes floating-point numbers from mruby.
* It makes mruby easier to handle in "Microcontroller without FPU" and "Kernel Space".
`MRB_INT32`
@@ -76,7 +76,7 @@ You can use mrbconfs with following ways:
* When defined, or `MRB_INT32` are not defined on 64-bit CPU mode, `mrb_int` will be defined as `int64_t`.
* Conflicts with `MRB_INT32`.
## Garbage collector configuration.
## Garbage collector configuration
`MRB_GC_STRESS`
@@ -104,7 +104,7 @@ You can use mrbconfs with following ways:
* Defines value is `1024`.
* Specifies number of `RBasic` per each heap page.
## Memory pool configuration.
## Memory pool configuration
`POOL_ALIGNMENT`
@@ -118,7 +118,7 @@ largest value of required alignment.
* Specifies page size of pool page.
* Smaller the value is increases memory overhead.
## State atexit configuration.
## State atexit configuration
`MRB_FIXED_STATE_ATEXIT_STACK`
@@ -131,7 +131,7 @@ largest value of required alignment.
* Default value is `5`.
* If `MRB_FIXED_STATE_ATEXIT_STACK` isn't defined this macro is ignored.
## `mrb_value` configuration.
## `mrb_value` configuration
`MRB_ENDIAN_BIG`
@@ -149,7 +149,7 @@ largest value of required alignment.
* If defined represent `mrb_value` as a word.
* If defined `Float` will be a mruby object with `RBasic`.
## Reduce heap memory configuration.
## Reduce heap memory configuration
`MRB_USE_LINK_TIME_RO_DATA_P`
@@ -167,7 +167,7 @@ largest value of required alignment.
* The prototype declaration is `mrb_bool mrb_ro_data_p(const char *ptr)`.
* Return `TRUE` if `ptr` is in the read-only section, otherwise return `FALSE`.
## Other configuration.
## Other configuration
`MRB_UTF8_STRING`
+40 -36
View File
@@ -33,7 +33,7 @@ conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
conf.gem :bitbucket => 'mruby/mrbgems-example', :branch => 'master'
```
You can specify the sub directory of the repository with `:path` option:
You can specify the subdirectory of the repository with `:path` option:
```ruby
conf.gem github: 'mruby/mruby', path: 'mrbgems/mruby-socket'
@@ -46,7 +46,7 @@ conf.gem :mgem => 'mruby-yaml'
conf.gem :mgem => 'yaml' # 'mruby-' prefix could be omitted
```
For specifying commit hash to checkout use `:checksum_hash` option:
For specifying the commit hash to checkout use `:checksum_hash` option:
```ruby
conf.gem mgem: 'mruby-redis', checksum_hash: '3446d19fc4a3f9697b5ddbf2a904f301c42f2f4e'
@@ -110,21 +110,23 @@ contains every gem found in the `mrbgems` directory.
The maximal GEM structure looks like this:
+- GEM_NAME <- Name of GEM
|
+- README.md <- Readme for GEM
|
+- mrbgem.rake <- GEM Specification
|
+- include/ <- Header for Ruby extension (will exported)
|
+- mrblib/ <- Source for Ruby extension
|
+- src/ <- Source for C extension
|
+- tools/ <- Source for Executable (in C)
|
+- test/ <- Test code (Ruby)
```
+- GEM_NAME <- Name of GEM
|
+- README.md <- Readme for GEM
|
+- mrbgem.rake <- GEM Specification
|
+- include/ <- Header for Ruby extension (will exported)
|
+- mrblib/ <- Source for Ruby extension
|
+- src/ <- Source for C extension
|
+- tools/ <- Source for Executable (in C)
|
+- test/ <- Test code (Ruby)
```
The folder `mrblib` contains pure Ruby files to extend mruby. The folder `src`
contains C/C++ files to extend mruby. The folder `include` contains C/C++ header
@@ -386,22 +388,24 @@ binary gems, to separate normal gems and binary gems.
### Example
+- mruby-bin-example/
|
+- README.md (Optional)
|
+- bintest/
| |
| +- example.rb <- Test code for binary gem
|
+- mrbgem.rake <- Gem specification
|
+- mrblib/ <- Source for Ruby extension (Optional)
|
+- src/ <- Source for C extension (Optional)
|
+- tools/
|
+- example/ <- Executable name directory
|
+- example.c <- Source for Executable (includes main)
```
+- mruby-bin-example/
|
+- README.md (Optional)
|
+- bintest/
| |
| +- example.rb <- Test code for binary gem
|
+- mrbgem.rake <- Gem specification
|
+- mrblib/ <- Source for Ruby extension (Optional)
|
+- src/ <- Source for C extension (Optional)
|
+- tools/
|
+- example/ <- Executable name directory
|
+- example.c <- Source for Executable (includes main)
```
+4 -4
View File
@@ -43,7 +43,7 @@ We have ported some new syntax from CRuby.
## Renamed for consistency
Some configuration macro names are changed for consistency (use `MRB_USE_XXX`
or `MRB_NO_XXX`).
or `MRB_NO_XXX`).
| mruby2 | mruby3 |
|--------------------------------|---------------------------|
@@ -61,7 +61,7 @@ Some configuration macro names are changed for consistency (use `MRB_USE_XXX`
| `DISABLE_MIRB_UNDERSCORE` | `MRB_NO_MIRB_UNDERSCORE` |
* `MRB_USE_FLOAT32` is changed from `MRB_USE_FLOAT` to make sure `float` here
means using single precision float, and not the opposite of `MRB_NO_FLOAT`.
means using single precision float, and not the opposite of `MRB_NO_FLOAT`.
* `MRB_USE_METHOD_T_STRUCT` uses `struct` version of `mrb_method_t`. More
portable but consumes more memory. Turned on by default on 32bit platforms.
* `MRB_` prefix is added to those without.
@@ -82,7 +82,7 @@ does not fit in `Fixnum` integers.
## `MRB_NAN_BOXING`
Pack `mrb_value` in a floating pointer number. Nothing
Pack `mrb_value` in a floating-point number. Nothing
changed from previous versions.
## `MRB_USE_MALLOC_TRIM`
@@ -152,7 +152,7 @@ No more operand extension
Jump addresses used to be specified by absolute offset from the start of `iseq`. Now they are relative offset from the address of the next instruction.
## `Random` now use `xoshiro128++`.
## `Random` now use `xoshiro128++`
For better and faster random number generation.
+3 -3
View File
@@ -101,9 +101,9 @@ sign) of operands.
| OP_ARYCAT | B | ary_cat(R(a),R(a+1)) |
| OP_ARYPUSH | B | ary_push(R(a),R(a+1)) |
| OP_ARYDUP | B | R(a) = ary_dup(R(a)) |
| OP_AREF | BBB | R(a) = R(b)[c] |
| OP_ASET | BBB | R(a)[c] = R(b) |
| OP_APOST | BBB | *R(a),R(a+1)..R(a+c) = R(a)[b..] |
| OP_AREF | BBB | R(a) = R(b)[c] | <!-- markdownlint-disable -->
| OP_ASET | BBB | R(a)[c] = R(b) | <!-- markdownlint-disable -->
| OP_APOST | BBB | *R(a),R(a+1)..R(a+c) = R(a)[b..] | <!-- markdownlint-disable -->
| OP_INTERN | B | R(a) = intern(R(a)) |
| OP_STRING | BB | R(a) = str_dup(Lit(b)) |
| OP_STRING16 | BS | R(a) = str_dup(Lit(b)) |
+2 -2
View File
@@ -25,10 +25,10 @@
#endif
/* configuration options: */
/* add -DMRB_USE_FLOAT32 to use float instead of double for floating point numbers */
/* add -DMRB_USE_FLOAT32 to use float instead of double for floating-point numbers */
//#define MRB_USE_FLOAT32
/* exclude floating point numbers */
/* exclude floating-point numbers */
//#define MRB_NO_FLOAT
/* obsolete configuration */
+1 -1
View File
@@ -5865,7 +5865,7 @@ parser_yylex(parser_state *p)
tokfix(p);
if (is_float) {
#ifdef MRB_NO_FLOAT
yywarning_s(p, "floating point numbers are not supported", tok(p));
yywarning_s(p, "floating-point numbers are not supported", tok(p));
pylval.nd = new_int(p, "0", 10, 0);
return tINTEGER;
#else
+1 -1
View File
@@ -11895,7 +11895,7 @@ parser_yylex(parser_state *p)
tokfix(p);
if (is_float) {
#ifdef MRB_NO_FLOAT
yywarning_s(p, "floating point numbers are not supported", tok(p));
yywarning_s(p, "floating-point numbers are not supported", tok(p));
pylval.nd = new_int(p, "0", 10, 0);
return tINTEGER;
#else
+1 -1
View File
@@ -300,7 +300,7 @@ complex_div(mrb_state *mrb, mrb_value self)
b = complex_ptr(mrb, rhs);
/* Split floating point components into significand and exponent */
/* Split floating-point components into significand and exponent */
ar.s = F(frexp)(a->real, &ar.x);
ai.s = F(frexp)(a->imaginary, &ai.x);
br.s = F(frexp)(b->real, &br.x);
+1 -1
View File
@@ -428,7 +428,7 @@ module Enumerable
max = min = val.__svalue
max_cmp = min_cmp = block.call(*val)
first = false
else
else
if (cmp = block.call(*val)) > max_cmp
max = val.__svalue
max_cmp = cmp
+2 -2
View File
@@ -15,7 +15,7 @@ Add the line below to your build configuration.
### IO
- https://doc.ruby-lang.org/ja/1.9.3/class/IO.html
* <https://doc.ruby-lang.org/ja/1.9.3/class/IO.html>
| method | mruby-io | memo |
| ------------------------- | -------- | ---- |
@@ -100,7 +100,7 @@ Add the line below to your build configuration.
### File
- https://doc.ruby-lang.org/ja/1.9.3/class/File.html
* <https://doc.ruby-lang.org/ja/1.9.3/class/File.html>
| method | mruby-io | memo |
| --------------------------- | -------- | ---- |
+1 -1
View File
@@ -86,7 +86,7 @@ mrb_f_method(mrb_state *mrb, mrb_value self)
* Integer(arg,base=0) -> integer
*
* Converts <i>arg</i> to a <code>Integer</code>.
* Numeric types are converted directly (with floating point numbers
* Numeric types are converted directly (with floating-point numbers
* being truncated). <i>base</i> (0, or between 2 and 36) is a base for
* integer string representation. If <i>arg</i> is a <code>String</code>,
* when <i>base</i> is omitted or equals to zero, radix indicators
+1 -1
View File
@@ -21,7 +21,7 @@ assert('Kernel.caller, Kernel#caller') do
end
end
skip "backtrace isn't available" if(c.new.baz(0)[0].include?("unknown"))
skip "backtrace isn't available" if (c.new.baz(0)[0].include?("unknown"))
assert_equal "kernel.rb:#{caller_lineno}:in foo", c.new.baz(0)[0][-19..-1]
assert_equal "bar", c.new.baz[0][-3..-1]
+23 -23
View File
@@ -23,38 +23,38 @@ end
## Kernel
- `Kernel#method`
- `Kernel#singleton_method`
* `Kernel#method`
* `Kernel#singleton_method`
## Module
- `Module#instance_method`
* `Module#instance_method`
## Method class
- `Method#name`
- `Method#call`
- `Method#super_method`
- `Method#arity`
- `Method#unbind`
- `Method#[]`
- `Method#owner`
- `Method#receiver`
- `Method#parameters`
- `Method#source_location`
- `Method#to_proc`
* `Method#name`
* `Method#call`
* `Method#super_method`
* `Method#arity`
* `Method#unbind`
* `Method#[]`
* `Method#owner`
* `Method#receiver`
* `Method#parameters`
* `Method#source_location`
* `Method#to_proc`
## UnboundMethod class
- `UnboundMethod#name`
- `UnboundMethod#bind`
- `UnboundMethod#super_method`
- `UnboundMethod#arity`
- `UnboundMethod#owner`
- `UnboundMethod#parameters`
- `UnboundMethod#source_location`
* `UnboundMethod#name`
* `UnboundMethod#bind`
* `UnboundMethod#super_method`
* `UnboundMethod#arity`
* `UnboundMethod#owner`
* `UnboundMethod#parameters`
* `UnboundMethod#source_location`
# See also
- https://ruby-doc.org/core-2.3.3/Method.html
- https://ruby-doc.org/core-2.3.3/UnboundMethod.html
* <https://ruby-doc.org/core-2.3.3/Method.html>
* <https://ruby-doc.org/core-2.3.3/UnboundMethod.html>
+3 -3
View File
@@ -92,9 +92,9 @@ assert 'Method#call' do
assert_equal 42, klass2.new.method(:foo).call
i = Class.new {
def bar
yield 3
end
def bar
yield 3
end
}.new
assert_raise(LocalJumpError) { i.method(:bar).call }
assert_equal 3, i.method(:bar).call { |i| i }
+2 -2
View File
@@ -7,8 +7,8 @@ def enable_debug_info?
raise
rescue => e
@enable_debug_info = !e.backtrace.empty?
if @enable_debug_info && e.backtrace[0].include?("(unknown)")
@enable_debug_info = false
if(@enable_debug_info && e.backtrace[0].include?("(unknown)"))
@enable_debug_info = false
end
return @enable_debug_info
end
+4 -4
View File
@@ -2,9 +2,9 @@
mruby sleep module
## install by mrbgems
## Install by mrbgems
- add `conf.gem` line to your build configuration.
* add `conf.gem` line to your build configuration.
```ruby
MRuby::Build.new do |conf|
@@ -15,7 +15,7 @@ MRuby::Build.new do |conf|
end
```
## example
## Example
```ruby
sleep(10)
@@ -26,4 +26,4 @@ usleep(10000)
under the MIT License:
* https://www.opensource.org/licenses/mit-license.php
* <https://www.opensource.org/licenses/mit-license.php>
+8 -8
View File
@@ -21,17 +21,17 @@ Date: Tue, 21 May 2013 04:31:30 GMT
## Requirement
- [mruby-io](https://github.com/mruby/mruby/tree/master/mrbgems/mruby-io) mrbgem
- [iij/mruby-mtest](https://github.com/iij/mruby-mtest) mrgbem to run tests
- system must have RFC3493 basic socket interface
- and some POSIX API...
* [mruby-io](https://github.com/mruby/mruby/tree/master/mrbgems/mruby-io) mrbgem
* [iij/mruby-mtest](https://github.com/iij/mruby-mtest) mrgbem to run tests
* system must have RFC3493 basic socket interface
* and some POSIX API...
## TODO
- add missing methods
- write more tests
- fix possible descriptor leakage (see XXX comments)
- `UNIXSocket#recv_io` `UNIXSocket#send_io`
* add missing methods
* write more tests
* fix possible descriptor leakage (see XXX comments)
* `UNIXSocket#recv_io` `UNIXSocket#send_io`
## License
+4 -4
View File
@@ -312,21 +312,21 @@ get_hash(mrb_state *mrb, mrb_value *hash, mrb_int argc, const mrb_value *argv)
*
* Field | Float Format
* ------+--------------------------------------------------------------
* e | Convert floating point argument into exponential notation
* e | Convert floating-point argument into exponential notation
* | with one digit before the decimal point as [-]d.dddddde[+-]dd.
* | The precision specifies the number of digits after the decimal
* | point (defaulting to six).
* E | Equivalent to 'e', but uses an uppercase E to indicate
* | the exponent.
* f | Convert floating point argument as [-]ddd.dddddd,
* f | Convert floating-point argument as [-]ddd.dddddd,
* | where the precision specifies the number of digits after
* | the decimal point.
* g | Convert a floating point number using exponential form
* g | Convert a floating-point number using exponential form
* | if the exponent is less than -4 or greater than or
* | equal to the precision, or in dd.dddd form otherwise.
* | The precision specifies the number of significant digits.
* G | Equivalent to 'g', but use an uppercase 'E' in exponent form.
* a | Convert floating point argument as [-]0xh.hhhhp[+-]dd,
* a | Convert floating-point argument as [-]0xh.hhhhp[+-]dd,
* | which is consisted from optional sign, "0x", fraction part
* | as hexadecimal, "p", and exponential part as decimal.
* A | Equivalent to 'a', but use uppercase 'X' and 'P'.
+3 -1
View File
@@ -3,4 +3,6 @@ Running Tests
To run the tests, execute the following from the project's root directory.
$ make test
```
$ make test
```
+1 -1
View File
@@ -9,7 +9,7 @@ class BasicObject
end
class Module
# 15.2.2.4.12
# 15.2.2.4.12
def attr_accessor(*names)
attr_reader(*names)
attr_writer(*names)
+1 -1
View File
@@ -183,7 +183,7 @@ class Hash
end
##
# Return the contents of this hash as a string.
#
#
# ISO 15.2.13.4.30 (x)
def inspect
self._inspect({})
+1 -1
View File
@@ -123,7 +123,7 @@ fmt_u(uint32_t x, char *s)
return s;
}
/* Do not override this check. The floating point printing code below
/* Do not override this check. The floating-point printing code below
* depends on the float.h constants being right. If they are wrong, it
* may overflow the stack. */
#if LDBL_MANT_DIG == 53
+2 -2
View File
@@ -232,7 +232,7 @@ coerce_step_counter(mrb_state *mrb, mrb_value self)
* Document-class: Float
*
* <code>Float</code> objects represent inexact real numbers using
* the native architecture's double-precision floating point
* the native architecture's double-precision floating-point
* representation.
*/
@@ -812,7 +812,7 @@ flo_ceil(mrb_state *mrb, mrb_value num)
* flt.round([ndigits]) -> integer or float
*
* Rounds <i>flt</i> to a given precision in decimal digits (default 0 digits).
* Precision may be negative. Returns a floating point number when ndigits
* Precision may be negative. Returns a floating-point number when ndigits
* is more than zero.
*
* 1.4.round #=> 1
+1 -1
View File
@@ -2570,7 +2570,7 @@ mrb_str_to_dbl(mrb_state *mrb, mrb_value str, mrb_bool badcheck)
* str.to_f => float
*
* Returns the result of interpreting leading characters in <i>str</i> as a
* floating point number. Extraneous characters past the end of a valid number
* floating-point number. Extraneous characters past the end of a valid number
* are ignored. If there is not a valid number at the start of <i>str</i>,
* <code>0.0</code> is returned. This method never raises an exception.
*
View File
+1 -1
View File
@@ -67,7 +67,7 @@ MRuby.each_target do
file "#{build_dir}/LEGAL" => [MRUBY_CONFIG, __FILE__] do |t|
mkdir_p File.dirname t.name
open(t.name, 'w+') do |f|
f.puts <<LEGAL
f.puts <<LEGAL
Copyright (c) #{Time.now.year} mruby developers
Permission is hereby granted, free of charge, to any person obtaining a
+1 -1
View File
@@ -290,7 +290,7 @@ def assert_float(exp, act, msg = nil)
if e.finite? && a.finite? && (n = (e - a).abs) > Mrbtest::FLOAT_TOLERANCE
flunk(msg, " Expected |#{exp} - #{act}| (#{n}) to be <= #{Mrbtest::FLOAT_TOLERANCE}.")
elsif (e.infinite? || a.infinite?) && e != a ||
e.nan? && !a.nan? || !e.nan? && a.nan?
e.nan? && !a.nan? || !e.nan? && a.nan?
flunk(msg, " Expected #{act} to be #{exp}.")
else
pass
+1 -2
View File
@@ -90,7 +90,7 @@ assert('Literals Strings Here documents', '8.7.6.3.6') do
a = <<AAA
aaa
AAA
b = <<b_b
b = <<b_b
bbb
b_b
c = [<<CCC1, <<"CCC2", <<'CCC3']
@@ -250,7 +250,6 @@ ZZZ
assert_equal ["1", "www\n", "3", "4", "5"], w
assert_equal [1, "foo 222 333\n 444\n5\n bar\n6\n", 9], x
assert_equal "", z
end
+8 -8
View File
@@ -391,15 +391,15 @@ assert('Module#undef_method', '15.2.2.4.42') do
class Parent
def hello
end
end
end
class Child < Parent
class Child < Parent
def hello
end
end
end
class GrandChild < Child
end
class GrandChild < Child
end
end
Test4UndefMethod::Child.class_eval{ undef_method :hello }
@@ -736,9 +736,9 @@ assert('Issue 1467') do
class C1
include M1
def initialize()
super()
end
def initialize()
super()
end
end
class C2
+4 -4
View File
@@ -20,9 +20,9 @@ assert('NameError#name', '15.2.31.2.1') do
end
assert('NameError#initialize', '15.2.31.2.2') do
e = NameError.new('a', :foo)
e = NameError.new('a', :foo)
assert_equal NameError, e.class
assert_equal 'a', e.message
assert_equal :foo, e.name
assert_equal NameError, e.class
assert_equal 'a', e.message
assert_equal :foo, e.name
end
+3 -3
View File
@@ -148,9 +148,9 @@ assert('String#[]=') do
end
if Object.const_defined?(:Float)
e = 'abc'
e[1.1] = 'X'
assert_equal 'aXc', e
e = 'abc'
e[1.1] = 'X'
assert_equal 'aXc', e
end
assert_raise(TypeError) { 'a'[0] = 1 }