Skip to content
The Ruby Programming Language [mirror]
Ruby C Yacc Makefile Objective-C C++ Other
Branch: master
Clone or download

Latest commit

kamipo and nobu Fix `make benchmark` example
`make benchmark ARGS=../benchmark/erb_render.yml` does not work.

```
% make benchmark ARGS=../benchmark/erb_render.yml
/Users/kamipo/.rbenv/shims/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \
	            --executables="compare-ruby::/Users/kamipo/.rbenv/shims/ruby --disable=gems -I.ext/common --disable-gem" \
	            --executables="built-ruby::./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems --disable-gem" \
	            ../benchmark/erb_render.yml 
Traceback (most recent call last):
	6: from ./benchmark/benchmark-driver/exe/benchmark-driver:112:in `<main>'
	5: from ./benchmark/benchmark-driver/exe/benchmark-driver:112:in `flat_map'
	4: from ./benchmark/benchmark-driver/exe/benchmark-driver:112:in `each'
	3: from ./benchmark/benchmark-driver/exe/benchmark-driver:122:in `block in <main>'
	2: from /Users/kamipo/.rbenv/versions/2.6.6/lib/ruby/2.6.0/psych.rb:577:in `load_file'
	1: from /Users/kamipo/.rbenv/versions/2.6.6/lib/ruby/2.6.0/psych.rb:577:in `open'
/Users/kamipo/.rbenv/versions/2.6.6/lib/ruby/2.6.0/psych.rb:577:in `initialize': No such file or directory @ rb_sysopen - ../benchmark/erb_render.yml (Errno::ENOENT)
make: *** [benchmark] Error 1

% make benchmark ARGS=benchmark/erb_render.yml
/Users/kamipo/.rbenv/shims/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \
	            --executables="compare-ruby::/Users/kamipo/.rbenv/shims/ruby --disable=gems -I.ext/common --disable-gem" \
	            --executables="built-ruby::./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems --disable-gem" \
	            benchmark/erb_render.yml 
Calculating -------------------------------------
                     compare-ruby  built-ruby 
          erb_render     825.454k    783.664k i/s -      1.500M times in 1.817181s 1.914086s

Comparison:
                       erb_render
        compare-ruby:    825454.4 i/s 
          built-ruby:    783663.8 i/s - 1.05x  slower

```
Latest commit 9d24ddb Jun 6, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Run tests in more parallel Jun 5, 2020
basictest Fixed misspellings Dec 20, 2019
benchmark Fix `make benchmark` example Jun 7, 2020
bin Removed the old executables of racc Dec 31, 2019
bootstraptest Moved already resolved test Apr 27, 2020
ccan Fix typos [ci skip] Oct 14, 2019
coroutine Patch assembly so that it aligns properly Apr 1, 2020
coverage Fix typo May 21, 2019
cygwin Merged recipes for the same target May 27, 2020
defs Run tests in more parallel Jun 5, 2020
doc Update extension.rdoc for Ruby 3 keyword argument separation [ci skip] Jun 1, 2020
enc sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
ext [ruby/psych] Add LICENSE to the gem Jun 5, 2020
gems power_assert repository is transferred to ruby/power_assert Apr 18, 2020
include RUBY_ASSERT_NOASSUME May 29, 2020
internal Properly resolve refinements in defined? on private call [Bug #16932] Jun 3, 2020
lib Remove experimental feaures and related code completely Jun 6, 2020
libexec Sync Bundler PR #3624 with HEAD commits May 22, 2020
man [rubygems/rubygems] Rebuild bundler man pages Jun 4, 2020
misc Add T_IMEMO support to lldb May 7, 2020
missing sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
sample [ruby/openssl] Look up digest by name instead of constant May 13, 2020
spec Fix build failures Jun 6, 2020
template Hash marks in Makefile need to be escaped [Bug #16935] Jun 6, 2020
test Add leading arguments support to arguments forwarding Jun 7, 2020
tool [rubygems/rubygems] Test against compact_index 0.13.0 Jun 4, 2020
win32 No GITPULLOPTIONS by default Jun 4, 2020
.dir-locals.el emacs mode addition Feb 6, 2020
.document Moved `Dir.open` and `Dir#initialize` to dir.rb Apr 6, 2020
.editorconfig Remove duplicated and change order Mar 21, 2019
.gdbinit Redmine /projects/ruby-trunk is now redirected Jan 1, 2020
.gitattributes Add tool/leaked-globals to .gitattributes [ci skip] Jul 15, 2019
.gitignore Revert "Moved aclocal.m4 to macro directory" Apr 5, 2020
.rspec_parallel Introduce test-bundler-parallel task. Aug 21, 2019
.travis.yml Travis s390x-linux is too unstable May 3, 2020
BSDL [ruby/irb] Reformat LICENSE.txt [ci skip] Feb 1, 2020
CONTRIBUTING.md [DOC] Please see _the_ official issue tracker... [ci skip] Jun 13, 2014
COPYING COPYING: reformat as RDoc Feb 2, 2019
COPYING.ja COPYING: reformat as RDoc Feb 2, 2019
GPL * GPL: update text of GPLv2. [ruby-core:44488] [Bug #6328] Jun 3, 2012
KNOWNBUGS.rb compile.c: fix positions encode Apr 5, 2018
LEGAL [DOC] Use note-list to pretend original plain-text looks [ci skip] May 26, 2020
NEWS.md Update NEWS / documentation with GC.start(compact:true) May 29, 2020
README.EXT README.EXT: add redirect [ruby-core:68631] Mar 25, 2015
README.EXT.ja README.EXT.ja: add redirect [ruby-core:68631] Mar 30, 2015
README.ja.md README*.md: `defines.h` moved [ci skip] Jan 31, 2020
README.md Fix bundled gems installation on a fresh clone Mar 14, 2020
aclocal.m4 Merge pull request #2991 from shyouhei/ruby.h Apr 8, 2020
addr2line.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
addr2line.h add #include guard hack Apr 13, 2020
appveyor.yml Fix AppVeyor pull request CI (#2983) Mar 26, 2020
array.c Fix max, min, minmax documentation (#3131) May 27, 2020
array.rb Removed useless shebang and executable bit [ci skip] Feb 1, 2020
ast.c Separate builtin initialization calls Dec 29, 2019
ast.rb Fix variable name and add more example [ci skip] Jan 2, 2020
bignum.c Respect BIGNUM_DEBUG defined by command line option May 28, 2020
builtin.c take care of USE_LAZY_LOAD=1. Dec 25, 2019
builtin.h Get rid of redefinition of `rb_execution_context_t` Mar 19, 2020
class.c Ensure origins for all included, prepended, and refined modules Jun 3, 2020
common.mk Fixup test-bundler-parallel Jun 5, 2020
compar.c decouple internal.h headers Dec 26, 2019
compile.c compile.c: Mark cursor in debug list May 30, 2020
complex.c Ensure origins for all included, prepended, and refined modules Jun 3, 2020
configure.ac No GITPULLOPTIONS by default Jun 4, 2020
constant.h add #include guard hack Apr 13, 2020
cont.c Ensure that the head of the vacancy list is correctly inserted into t… Jun 4, 2020
debug.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
debug_counter.c Avoid doubly showing debug counters Mar 15, 2020
debug_counter.h Add a debug_counter for JIT cancel on leave May 29, 2020
dir.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
dir.rb Moved `Dir.[]` to dir.rb Apr 6, 2020
dln.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
dln.h add #include guard hack Apr 13, 2020
dln_find.c dln_find.c: MAXPATHLEN is not used already Jun 2, 2016
dmydln.c UNREACHABLE_RETURN Jul 24, 2018
dmyenc.c load.c: tweak the return value Dec 3, 2014
dmyext.c dmyenc.c: separate Nov 27, 2014
encindex.h add #include guard hack Apr 13, 2020
encoding.c Fallback to built-in UTF-8 for miniruby May 16, 2020
enum.c docs: fix typo Jun 7, 2020
enumerator.c Update Enumerable::Yielder#to_proc document (#3142) May 27, 2020
error.c Use receiver #name rather than #inspect to build NameError message May 26, 2020
eval.c Ensure origins for all included, prepended, and refined modules Jun 3, 2020
eval_error.c Merge pull request #3047 from mame/suppress-backtrace May 14, 2020
eval_intern.h Create backtrace location array directly Dec 13, 2019
eval_jump.c drop-in type check for rb_define_global_function Aug 29, 2019
file.c Allow Dir.home to work for non-login procs when $HOME not set May 23, 2020
gc.c Combine sweeping and moving May 29, 2020
gc.h Rename RUBY_MARK_NO_PIN_UNLESS_NULL to RUBY_MARK_MOVABLE_UNLESS_NULL Jan 22, 2020
gc.rb Update NEWS / documentation with GC.start(compact:true) May 29, 2020
gem_prelude.rb Do not call 'gem "did_you_mean"' for now Dec 1, 2019
golf_prelude.rb golf_prelude.rb: suppress the redefining warning Jun 22, 2019
goruby.c goruby.c: FD leak [ci skip] Mar 9, 2017
hash.c Enhanced Rdoc for Hash (#3178) Jun 3, 2020
hrtime.h hrtime.h: fix typo in non-builtin overflow check Aug 30, 2018
id_table.c reroute redefinition of NDEBUG Apr 21, 2020
id_table.h sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
inits.c Defer initialization May 16, 2020
insns.def vm_insnhelper.c: merge opt_eq_func / opt_eql_func Jun 2, 2020
internal.h export debug utility functions May 29, 2020
io.c Fixed a variable name [Bug #16903] May 21, 2020
io.rb Define IO#read/write_nonblock with builtins. Nov 8, 2019
iseq.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
iseq.h add #include guard hack Apr 13, 2020
kernel.rb support builtin for Kernel#Float Apr 22, 2020
lex.c.blt keywords: shrink struct kwtable Jan 21, 2018
load.c [DOC] relative filename `Kernel#.require` and `Kernel#.load` [ci skip] Jun 1, 2020
loadpath.c -Wno-overlength-strings Jan 16, 2018
localeinit.c internal.h: remove dependecy on ruby/encoding.h Jan 9, 2018
main.c main.c: Add doxygen mainpage Aug 8, 2019
marshal.c Ensure origins for all included, prepended, and refined modules Jun 3, 2020
math.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
method.h add #include guard hack Apr 13, 2020
mini_builtin.c decouple internal.h headers Dec 26, 2019
miniinit.c support builtin features with Ruby and C. Nov 8, 2019
mjit.c Eliminate a call instruction on JIT cancel path May 27, 2020
mjit.h Carve out mjit_exec_slowpath May 27, 2020
mjit_compile.c Eliminate a call instruction on JIT cancel path May 27, 2020
mjit_worker.c sed -i s/RUBY3/RBIMPL/g May 11, 2020
node.c decouple internal.h headers Dec 26, 2019
node.h Constified code_loc_gen May 14, 2020
numeric.c numeric.c: optimize `float ** 2` case by fastpath May 11, 2020
object.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
pack.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
pack.rb Rubified the APIs of pack.c Nov 8, 2019
parse.y Add leading arguments support to arguments forwarding Jun 7, 2020
prelude.rb Define IO#read/write_nonblock with builtins. Nov 8, 2019
probes.d change lingering dtrace probe documentation from function- to method- May 30, 2015
probes_helper.h internal/vm.h rework Dec 26, 2019
proc.c [DOC] Separated Method#[] from Method#call [Bug #16813] [ci skip] Apr 24, 2020
process.c Allow Dir.home to work for non-login procs when $HOME not set May 23, 2020
random.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
range.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
rational.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
re.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
regcomp.c Fix issues detected by code analysis tool (mainly Coverity). Sep 15, 2018
regenc.c Merge Onigmo 6.1.1 Feb 11, 2017
regenc.h initializer paren-string `{("str")}` is a C99ism Jan 2, 2018
regerror.c Escape control codes in regexp warning message Jun 29, 2019
regexec.c Only define history_root member of the Oniguruma re_registers struct … Apr 23, 2019
regint.h Merge Onigmo 6.1.1 Feb 11, 2017
regparse.c Fixed misspellings Dec 20, 2019
regparse.h Fix typos. Jan 18, 2018
regsyntax.c Merge Onigmo 6.0.0 Dec 10, 2016
ruby-runner.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
ruby.c Defer initialization May 16, 2020
ruby_assert.h Use RUBY_DEBUG instead of NDEBUG May 25, 2020
ruby_atomic.h Solaris does not provide atomic_sub family Apr 26, 2020
rubystub.c rubystub.c: sys/param.h for MAXPATHLEN Aug 20, 2016
signal.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
siphash.c switch SipHash from SipHash24 to SipHash13 variant Jan 20, 2017
siphash.h blacklist UBSAN's unsigned integer overflow Nov 7, 2018
sparc.c configure.ac Sep 29, 2017
sprintf.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
st.c Removed no longer used constants [Bug #16934] Jun 4, 2020
strftime.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
string.c add static modifier for rb_str_ord func May 27, 2020
struct.c Added GC guard for splatted array May 8, 2020
symbol.c [DOC] Added document for rb_check_symbol() [ci skip] May 24, 2020
symbol.h add #include guard hack Apr 13, 2020
thread.c Make Thread#thread_variable? similar to #thread_variable_get May 26, 2020
thread_pthread.c Get rid of -Wgnu-folding-constant errors May 1, 2020
thread_pthread.h add #include guard hack Apr 13, 2020
thread_sync.c Thread scheduler for light weight concurrency. May 14, 2020
thread_win32.c Remove IA64 support. Jun 19, 2019
thread_win32.h add #include guard hack Apr 13, 2020
time.c Append subsec part instead of creating new string Jun 3, 2020
timev.h decouple internal.h headers Dec 26, 2019
trace_point.rb Fix output of example [ci skip] Jan 4, 2020
transcode.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
transcode_data.h add #include guard hack Apr 13, 2020
transient_heap.c decouple internal.h headers Dec 26, 2019
transient_heap.h add #include guard hack Apr 13, 2020
util.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
variable.c sed -i 's|ruby/impl|ruby/internal|' May 11, 2020
variable.h add #include guard hack Apr 13, 2020
version.c Provides ruby2_keywords Oct 22, 2019
version.h * 2020-06-07 [ci skip] Jun 6, 2020
vm.c Moved vm_empty_cc to local in vm.c [Bug #16934] Jun 4, 2020
vm_args.c Suppress probably impossible maybe-uninitialized warning May 10, 2020
vm_backtrace.c Add compaction support for backtrace objects May 7, 2020
vm_callinfo.h Moved vm_empty_cc to local in vm.c [Bug #16934] Jun 4, 2020
vm_core.h Thread scheduler for light weight concurrency. May 14, 2020
vm_debug.h add #include guard hack Apr 13, 2020
vm_dump.c Prefer configured printf format for mingw gcc 10 May 26, 2020
vm_eval.c drop varargs.h support May 11, 2020
vm_exec.c Add VM insns counter like debug_counter (#2789) Dec 28, 2019
vm_exec.h add #include guard hack Apr 13, 2020
vm_insnhelper.c Properly resolve refinements in defined? on private call [Bug #16932] Jun 3, 2020
vm_insnhelper.h Suppress warnings no inline ruby debug (#3107) May 22, 2020
vm_method.c Properly resolve refinements in defined? on private call [Bug #16932] Jun 3, 2020
vm_opts.h add #include guard hack Apr 13, 2020
vm_trace.c Clear all trace events during teardown Mar 30, 2020
vsnprintf.c [win32] suppress false warning by mingw gcc Mar 4, 2020
warning.rb Fix a typo [ci skip] Jan 2, 2020

README.md

Build Status Build status Actions Status Actions Status Actions Status Actions Status Actions Status

What's Ruby

Ruby is an interpreted object-oriented programming language often used for web development. It also offers many scripting features to process plain text and serialized files, or manage system tasks. It is simple, straightforward, and extensible.

Features of Ruby

  • Simple Syntax
  • Normal Object-oriented Features (e.g. class, method calls)
  • Advanced Object-oriented Features (e.g. mix-in, singleton-method)
  • Operator Overloading
  • Exception Handling
  • Iterators and Closures
  • Garbage Collection
  • Dynamic Loading of Object Files (on some architectures)
  • Highly Portable (works on many Unix-like/POSIX compatible platforms as well as Windows, macOS, Haiku, etc.) cf. https://github.com/ruby/ruby/blob/master/doc/contributing.rdoc#platform-maintainers

How to get Ruby

For a complete list of ways to install Ruby, including using third-party tools like rvm, see:

https://www.ruby-lang.org/en/downloads/

Git

The mirror of the Ruby source tree can be checked out with the following command:

$ git clone https://github.com/ruby/ruby.git

There are some other branches under development. Try the following command to see the list of branches:

$ git ls-remote https://github.com/ruby/ruby.git

You may also want to use https://git.ruby-lang.org/ruby.git (actual master of Ruby source) if you are a committer.

Subversion

Stable branches for older Ruby versions can be checked out with the following command:

$ svn co https://svn.ruby-lang.org/repos/ruby/branches/ruby_2_6/ ruby

Try the following command to see the list of branches:

$ svn ls https://svn.ruby-lang.org/repos/ruby/branches/

Ruby home page

https://www.ruby-lang.org/

Mailing list

There is a mailing list to discuss Ruby. To subscribe to this list, please send the following phrase:

subscribe

in the mail body (not subject) to the address ruby-talk-request@ruby-lang.org.

How to compile and install

  1. If you want to use Microsoft Visual C++ to compile Ruby, read win32/README.win32 instead of this document.

  2. If ./configure does not exist or is older than configure.ac, run autoconf to (re)generate configure.

  3. Run ./configure, which will generate config.h and Makefile.

    Some C compiler flags may be added by default depending on your environment. Specify optflags=.. and warnflags=.. as necessary to override them.

  4. Edit include/ruby/defines.h if you need. Usually this step will not be needed.

  5. Remove comment mark(#) before the module names from ext/Setup (or add module names if not present), if you want to link modules statically.

    If you don't want to compile non static extension modules (probably on architectures which do not allow dynamic loading), remove comment mark from the line "#option nodynamic" in ext/Setup.

    Usually this step will not be needed.

  6. Run make.

    • On Mac, set RUBY_CODESIGN environment variable with a signing identity. It uses the identity to sign ruby binary. See also codesign(1).
  7. Optionally, run 'make check' to check whether the compiled Ruby interpreter works well. If you see the message "check succeeded", your Ruby works as it should (hopefully).

  8. Run 'make install'.

    This command will create the following directories and install files into them.

    • ${DESTDIR}${prefix}/bin
    • ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
    • ${DESTDIR}${prefix}/lib
    • ${DESTDIR}${prefix}/lib/ruby
    • ${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
    • ${DESTDIR}${prefix}/lib/ruby/site_ruby
    • ${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
    • ${DESTDIR}${prefix}/lib/ruby/vendor_ruby
    • ${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
    • ${DESTDIR}${prefix}/lib/ruby/gems/${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/share/man/man1
    • ${DESTDIR}${prefix}/share/ri/${MAJOR}.${MINOR}.${TEENY}/system

    If Ruby's API version is 'x.y.z', the ${MAJOR} is 'x', the ${MINOR} is 'y', and the ${TEENY} is 'z'.

    NOTE: teeny of the API version may be different from one of Ruby's program version

    You may have to be a super user to install Ruby.

If you fail to compile Ruby, please send the detailed error report with the error log and machine/OS type, to help others.

Some extension libraries may not get compiled because of lack of necessary external libraries and/or headers, then you will need to run 'make distclean-ext' to remove old configuration after installing them in such case.

Copying

See the file COPYING.

Feedback

Questions about the Ruby language can be asked on the Ruby-Talk mailing list (https://www.ruby-lang.org/en/community/mailing-lists) or on websites like (https://stackoverflow.com).

Bugs should be reported at https://bugs.ruby-lang.org. Read HowToReport for more information.

Contributing

See the file CONTRIBUTING.md

The Author

Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in 1995.

matz@ruby-lang.org

You can’t perform that action at this time.