Граф коммитов

366 Коммитов

Автор SHA1 Сообщение Дата
David Rodríguez f48655d04d Remove unneeded exec bits from some files
I noticed that some files in rubygems were executable, and I could think
of no reason why they should be.

In general, I think ruby files should never have the executable bit set
unless they include a shebang, so I run the following command over the
whole repo:

```bash
find . -name '*.rb' -type f -executable -exec bash -c 'grep -L "^#!" $1 || chmod -x $1' _ {} \;
```
2019-11-09 21:36:30 +09:00
Kazuhiro NISHIYAMA cc8116b03e Fix a typo [ci skip] 2019-11-01 18:33:58 +09:00
Jeremy Evans 71d97a5ef8 Fix sample/drb/http0serv.rb
Previously, trying to use this would result in:

undefined method `uri' for #<DRb::HTTP0::ServerSide:0x00000aec9f1637f8> (NoMethodError)

Also, use a relative require to load sample/drb/http0.rb.

Fixes [Bug #13431]
2019-08-25 10:56:47 -07:00
Kenichi Kamiya 8882986d97 Drop duplicated sample code (#2389) [ci skip]
* Drop duplicated sample code

* Drop another style sample

https://github.com/ruby/ruby/pull/2389#issuecomment-522489520

* Update sample list
2019-08-19 18:43:23 +09:00
Kenichi Kamiya 9b330200f8 Remove unused variable to suppress warning (#2388) [ci skip]
```
sample/observ.rb:30: warning: assigned but unused variable - clock
```
2019-08-19 18:16:45 +09:00
Kenichi Kamiya cda8664471 Update a sample code (#2387)
Kernel#inspect does not call #to_s now

To follow fd7dc23d28
2019-08-19 18:00:29 +09:00
Kenichi Kamiya 605d2ce9b9 Accurate a sample to show having some ext (#2385) 2019-08-19 17:30:59 +09:00
Kenichi Kamiya 9d20d2b0f5 Clean sample code biorhythm (#2375)
* Standardize to load date libary code

> git grep 'require .date.' | wc -l
179
> git grep 'require .date\.rb' | wc -l
1

* Simplify
2019-08-17 15:03:00 +09:00
Kenichi Kamiya 72adc6cffb Simplify a sample code (#2374) 2019-08-17 14:56:57 +09:00
ko1 8bda94f78c For this may be a syntax error (instead of LocalJumpError) in Ruby 2.7
[Fix GH-2078]

This patch is from Yutaka HARA <yutaka.hara+github@gmail.com>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-04 06:28:57 +00:00
kazu d1dce26b94 sample/fib.py: Fix syntax error in Python 3 [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-18 23:36:47 +00:00
mame a8812080c4 Fix typo in trick2018/README [ci skip]
s/dimentional/dimensional

From: "yuuji.yaginuma" <yuuji.yaginuma@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 10:35:13 +00:00
mame 1c26ca1e7e sample/trick2013/mame/music-box.mp4: removed
The tarball will be reduced by about 568 kB.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 01:59:29 +00:00
mame 7d5fad1bc5 sample/trick2018/03-tompng: merge upstream fixes
* Remove `ruby '2.5.0'`
* Add `source 'https://rubygems.org'`
* Avoid `Kernel#Integer`

Thanks to tompng.  Fixes #14930.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17 14:35:02 +00:00
kazu 5b666803f1 Fix a typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-23 09:49:45 +00:00
svn c5229a942b * append newline at EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-21 13:07:52 +00:00
mame e613cdd53d sample/trick2018/: adds the top-five entries of TRICK 2018
See https://github.com/tric/trick2018 for TRICK 2018.
Fixes #14930.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-21 13:07:50 +00:00
kazu 9d091c851a sample/timeout.rb: Remove unnecessary increment [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 13:01:17 +00:00
kazu 23358107f9 sample/timeout.rb: fix warnings
warning: Object#timeout is deprecated, use Timeout.timeout instead.
[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-16 14:09:40 +00:00
k0kubun cc777d09f4 erb.rb: deprecate safe_level of ERB.new
Also, as it's in the middle of the list of 4 arguments, 3rd and 4th arguments
(trim_mode, eoutvar) are changed to keyword arguments.
Old ways to specify arguments are deprecated and warned now.

bin/erb: deprecate -S option.

We'll remove all of deprecated ones at Ruby 2.7+.

enc/make_encmake.rb: stopped using deprecated interface
ext/etc/mkconstants.rb: ditto
ext/socket/mkconstants.rb: ditto
sample/ripper/ruby2html.rb: ditto
spec/ruby/library/erb/defmethod/def_erb_method_spec.rb: ditto
spec/ruby/library/erb/new_spec.rb: ditto
test/erb/test_erb.rb: ditto
test/erb/test_erb_command.rb: ditto
tool/generic_erb.rb: ditto
tool/ruby_vm/helpers/dumper.rb: ditto
tool/transcode-tblgen.rb: ditto
lib/rdoc/erbio.rb: ditto
lib/rdoc/generator/darkfish.rb: ditto

[Feature #14256]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22 13:28:25 +00:00
normal 3f059374b8 sample/iseq_loader: use File.open instead of Kernel#open
This makes auditing for inadvertant command execution
easier.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12 09:31:22 +00:00
normal 6ef345ab22 sample/iseq_loader.rb: spelling fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12 09:31:17 +00:00
hsbt d675b9de6c Fixed typos.
* sample/trick2013/kinaba/remarks.markdown: algorthim -> algorithm
  * sample/trick2015/ksk_1/remarks.markdown: Limination -> Limitation

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12 09:07:47 +00:00
kazu 6064132c42 Remove unnecessary `require 'thread'`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-08 07:00:01 +00:00
nobu fb38cfb90f Update trick2013/yhara for Ruby 2.4
I need to raise LocalJumpError here (for the first "J" of the
output "JUST ANOTHER RUBY HACKER"), but this `return` does
not raise error in Ruby 2.4.

[Fix GH-1703]
Author:    Yutaka HARA <yutaka.hara+github@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-22 11:21:34 +00:00
kazu 5c10fb414a Fix NoMethodError [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-03 01:44:52 +00:00
kazu 2430822b96 Use `\A` and `\z` instead of `^` and `$` [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-02 11:26:28 +00:00
nobu cd6d919373 pty/shl.rb: update [ci skip]
* sample/pty/shl.rb: leap exited child process.
  [ruby-dev:49974] [Bug #13191]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-05 01:26:27 +00:00
nobu b163b3ff64 pty/shl.rb: update [ci skip]
* sample/pty/shl.rb: do not manage array length separately.
  [ruby-dev:49974] [Bug #13191]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-04 10:48:15 +00:00
nobu 69b6471104 pty/shl.rb: update [ci skip]
* sample/pty/shl.rb: use io/console instead of stty.
  [ruby-dev:49974] [Bug #13191]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-04 10:48:14 +00:00
nobu 0d98fd889f pty/shl.rb: update [ci skip]
* sample/pty/shl.rb: stop writer loop when the child exited.
  PTY::ChildExited no longer raises asynchronously since r20298.
  [ruby-dev:49974] [Bug #13191]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-04 10:48:13 +00:00
kazu 5b540799bf sample/pty/shl.rb: update sample
* Specify frozen_string_literal: true.
* Fix TypeError of raise.
* Use a character literal instead of Integer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-04 06:49:07 +00:00
kazu af2009a58f sample/pty/script.rb: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-04 06:49:06 +00:00
kazu 2cc0461bfa sample/pty/expect_sample.rb: Update sample
* Fix regexp capture scope bug.
* Specify frozen_string_literal: true.
* Use passive mode.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-04 06:49:04 +00:00
nobu 716610ae56 get rid of ambiguous parentheses warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29 16:06:54 +00:00
kazu 38fa442de9 fix typos [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-27 00:45:46 +00:00
hsbt 6b35c34c68 * basictest/test.rb: Adjust spaces in class declarations
with inheritance. [fix GH-1227] Patch by @adrfer
* lib/irb/*: ditto.
* lib/prime.rb: ditto.
* lib/shell/builtin-command.rb: ditto.
* object.c: ditto.
* sample/*.rb: ditto.
* test/-ext-/method/test_arity.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-07 05:18:57 +00:00
nobu 4b298ad77a Use qualified names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30 06:22:30 +00:00
rhe c9dc0164b8 import Ruby/OpenSSL 2.0.0.beta.1
* NEWS, {ext,test,sample}/openssl: Import Ruby/OpenSSL 2.0.0.beta.1.
  ext/openssl is now converted into a default gem. The full commit
  history since r55538 can be found at:
  https://github.com/ruby/openssl/compare/08e1881f5663...v2.0.0.beta.1
  [Feature #9612]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-29 05:47:09 +00:00
hsbt 203e604f46 * common.mk: test-sample was changed to test-basic.
[Feature #11982][ruby-core:72823]
* basictest/runner.rb: ditto. rename from tool/rubytest.rb.
* basictest/test.rb: ditto. rename from sample/test.rb.
* defs/gmake.mk: picked from r53540
* sample/test.rb: backword compatibility for chkbuild.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-16 01:37:47 +00:00
nobu 78d4bc9294 Revert r53539 and r53540
* basictest/test.rb: revert r53539 because it depends on r53537.

* gmake.mk: ditto, revert r53540.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-15 13:08:45 +00:00
naruse e0ea641755 Revert "* common.mk: test-sample was changed to test-basic."
This reverts r53537.
Fix chkbuild first.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-15 11:05:51 +00:00
hsbt 17238bce22 * common.mk: test-sample was changed to test-basic.
[Feature #11982][ruby-core:72823]
* basictest/runner.rb: ditto. rename from tool/rubytest.rb.
* basictest/test.rb: ditto. rename from sample/test.rb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-15 00:25:46 +00:00
svn 96f5050350 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-11 14:38:42 +00:00
svn 4a1a74991d * append newline at EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-11 14:37:45 +00:00
mame 5c28308f9f * sample/trick2015/: added the award-winning entries of TRICK 2015.
See https://github.com/tric/trick2015 for the contest outline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-11 14:37:06 +00:00
ko1 4b8da4b9c8 * iseq.c: rename methods
RubyVM::InstructionSequence#to_binary_format -> #to_binary
  RubyVM::InstructionSequence.from_binary_format -> .load_from_binary
  RubyVM::InstructionSequence.from_binary_format_extra_data ->
                             .load_from_binary_extra_data

* iseq.c: fix document of iseq.to_binary.
  [Fix GH-1134]

* sample/iseq_loader.rb: catch up this change.

* test/lib/iseq_loader_checker.rb: ditto.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 15:10:57 +00:00
ko1 ddba2014c6 * compile.c (iseq_ibf_dump): dump extra data just string length.
* sample/iseq_loader.rb: add using
  RubyVM::InstructionSequence.from_binary_format_extra_data method
  (commented out).




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 15:30:46 +00:00
svn c49cb7fed4 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 13:59:15 +00:00
ko1 3dbb390180 * introduce new ISeq binary format serializer/de-serializer
and a pre-compilation/runtime loader sample.
  [Feature #11788]

* iseq.c: add new methods:
  * RubyVM::InstructionSequence#to_binary_format(extra_data = nil)
  * RubyVM::InstructionSequence.from_binary_format(binary)
  * RubyVM::InstructionSequence.from_binary_format_extra_data(binary)

* compile.c: implement body of this new feature.

* load.c (rb_load_internal0), iseq.c (rb_iseq_load_iseq):
  call RubyVM::InstructionSequence.load_iseq(fname) with
  loading script name if this method is defined.

  We can return any ISeq object as a result value.
  Otherwise loading will be continue as usual.

  This interface is not matured and is not extensible.
  So that we don't guarantee the future compatibility of this method.
  Basically, you should'nt use this method.

* iseq.h: move ISEQ_MAJOR/MINOR_VERSION (and some definitions)
  from iseq.c.

* encoding.c (rb_data_is_encoding), internal.h: added.

* vm_core.h: add several supports for lazy load.
  * add USE_LAZY_LOAD macro to specify enable or disable of
    this feature.
  * add several fields to rb_iseq_t.
  * introduce new macro rb_iseq_check().

* insns.def: some check for lazy loading feature.

* vm_insnhelper.c: ditto.

* proc.c: ditto.

* vm.c: ditto.

* test/lib/iseq_loader_checker.rb: enabled iff suitable
  environment variables are provided.

* test/runner.rb: enable lib/iseq_loader_checker.rb.

* sample/iseq_loader.rb: add sample compiler and loader.

    $ ruby sample/iseq_loader.rb [dir]

  will compile all ruby scripts in [dir].
  With default setting, this compile creates *.rb.yarb files
  in same directory of target .rb scripts.

    $ ruby -r sample/iseq_loader.rb [app]

  will run with enable to load compiled binary data.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 13:58:50 +00:00