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

35 Коммитов

Автор SHA1 Сообщение Дата
Yusuke Endoh 417f3cd893 tool/generic_erb.rb: Add a hack to prevent "unused variable" warnings 2022-11-18 14:56:55 +09:00
Yusuke Endoh e19afe36ca Revert "tool/generic_erb.rb: Use ERB#result_with_hash instead of #result"
This reverts commit bd148a2bdd.

ERB#result_with_hash does not work on Ruby 2.2

https://ci.appveyor.com/project/ruby/ruby/builds/45420170
```
../tool/generic_erb.rb:33:in `block (2 levels) in <main>': undefined method `result_with_hash' for #<ERB:0x0000000002516650> (NoMethodError)
```
2022-11-18 14:45:21 +09:00
Yusuke Endoh bd148a2bdd tool/generic_erb.rb: Use ERB#result_with_hash instead of #result
to prevent the warnings:
```
./tool/generic_erb.rb:23: warning: assigned but unused variable - output
./tool/generic_erb.rb:24: warning: assigned but unused variable - vpath
```
2022-11-18 14:38:49 +09:00
Nobuyoshi Nakada a2e7b11f2a
output.rb: extract from generic_erb.rb
- writing to a file or stdout
- touching timestamp files
- overwriting only if changed
- colorizing
2022-11-01 14:34:05 +09:00
Nobuyoshi Nakada 07ff1f4b0b
Revert "Extracted AtomicWrite"
This reverts commit 2148ee78a5, mistakenly committed.
2021-03-13 09:14:20 +09:00
Nobuyoshi Nakada 2148ee78a5
Extracted AtomicWrite 2021-03-13 09:10:45 +09:00
Hiroshi SHIBATA b401fb35a4
Removed needless LOAD_PATH modification.
We can use require_relative now.
2019-07-15 13:44:37 +09:00
Hiroshi SHIBATA badfbdf32c
Move vpath.rb into tool library direcotry. 2019-07-15 13:16:16 +09:00
Hiroshi SHIBATA e8ddbc0239
Put colorize to library directory.
Same as 66299e7ca83d379d13abaa5411f3e0419334cabb
2019-07-15 09:40:22 +09:00
Jeremy Evans d2ba80b5df Revert "Fix building with 1.8 BASERUBY"
This reverts commit 05bc14d81a.

We have decided that the cost of reintroducing support for 1.8
BASERUBY outweighs the benefit.  If you are still using 1.8 and want
to build master/trunk, build and install the latest release, and use
that as BASERUBY.
2019-05-29 18:03:21 -07:00
Jeremy Evans 05bc14d81a Fix building with 1.8 BASERUBY 2019-05-27 20:55:56 -07:00
nobu c3b77e704a generic_erb.rb: get rid of fileutils
* tool/generic_erb.rb: get rid of FileUtils.touch, not to depend
  on fileutils.rb which will depend on rbconfig.rb which does not
  exist when creating encdb.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-15 07:46:55 +00:00
k0kubun 3406c5d613 Refactor ERB version checking for keyword arguments
Improving code like r62590. See r62529 for details.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-27 11:12:23 +00:00
k0kubun 8038bb2f96 tool/generic_erb.rb: check ERB version
instead of Ruby's.

When older ERB is installed but Ruby is still 2.6.0, this may cause
error like:

```
Traceback (most recent call last):
    5: from ../src/tool/generic_erb.rb:36:in `<main>'
    4: from ../src/tool/generic_erb.rb:36:in `map'
    3: from ../src/tool/generic_erb.rb:43:in `block in <main>'
    2: from ../src/tool/generic_erb.rb:43:in `block (2 levels) in <main>'
    1: from /opt/local/lib/ruby/2.6.0/erb.rb:873:in `result'
/opt/local/lib/ruby/2.6.0/erb.rb:869:in `block in result': no implicit conversion of Hash into Integer (TypeError)
```

For safety, I changed this to check ERB's version. See also: r62529.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22 15:03:08 +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
nobu 213fa8ec43 generic_erb.rb: -i option
* tool/generic_erb.rb: -i option to merge multiple template files.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-01 02:39:22 +00:00
nobu bdc6d41640 ext/extmk.rb: colorize notes [Feature #13302]
* common.mk (build-ext): pass variables to colorize.

* ext/extmk.rb: colorize notes with tool/colorize.rb.

* tool/colorize.rb: extract from tool/generic_erb.rb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 03:01:12 +00:00
naruse 2c8701fc83 suppress warning: shadowing outer local variable - dir & opt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-11 16:08:54 +00:00
normal f8d0bdedf1 tool: add descriptions and fix typos
* tool/asm_parse.rb: add description
* tool/change_maker.rb: ditto
* tool/downloader.rb: ditto
* tool/eval.rb: ditto
* tool/expand-config.rb: ditto
* tool/extlibs.rb: ditto
* tool/fake.rb: ditto
* tool/file2lastrev.rb: ditto
* tool/gem-unpack.rb: ditto
* tool/gen_dummy_probes.rb: ditto
* tool/gen_ruby_tapset.rb: ditto
* tool/generic_erb.rb: ditto
* tool/id2token.rb: ditto
* tool/ifchange: ditto
* tool/insns2vm.rb: ditto
* tool/instruction.rb: ditto
* tool/jisx0208.rb: ditto
* tool/merger.rb: ditto
* tool/mkrunnable.rb: ditto
* tool/node_name.rb: ditto
* tool/parse.rb: ditto
* tool/rbinstall.rb: ditto
* tool/rbuninstall.rb: ditto
* tool/rmdirs: ditto
* tool/runruby.rb: ditto
* tool/strip-rdoc.rb: ditto
* tool/vcs.rb: ditto
* tool/vtlh.rb: ditto
* tool/ytab.sed: ditto
* tool/enc-unicode.rb: fix typo
* tool/mk_call_iseq_optimized.rb: ditto
* tool/update-deps: ditto
  [ruby-core:76215] [Bug #12539]
  by Noah Gibbs <the.codefolio.guy@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-02 21:01:04 +00:00
nobu e712233387 ignore dump terminal
* tool/generic_erb.rb, tool/ifchange: no colorization if tput
  returned nothing or dump terminal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-31 00:02:19 +00:00
nobu be8a9db524 colorize
* tool/generic_erb.rb: use VT100 sequence if tput does not work.

* tool/ifchange: ditto and add --color option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22 14:02:38 +00:00
nobu 30b839a013 generic_erb.rb: ignore error
* tool/generic_erb.rb: ignore error that tput is not found.
  [ruby-core:71143] [Bug #11611]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22 08:56:30 +00:00
nobu 5a599dde0c generic_erb.rb: highlight
* tool/generic_erb.rb: highlight result messages too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22 06:25:33 +00:00
nobu 2092561366 generic_erb.rb: read in binary mode
* tool/generic_erb.rb: read existing file in binary mode to
  convert nothing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-27 03:42:54 +00:00
nobu 1ae1164eb0 generic_erb.rb: explicit_trim_line
* tool/generic_erb.rb: enable explicit_trim_line mode

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-06 14:54:39 +00:00
nobu ae9dbb6ce1 generic_erb.rb: --source option
* tool/generic_erb.rb: -x, --source option for debug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-16 04:13:36 +00:00
nobu d22ac50ad4 tool/vpath.rb
* tool/generic_erb.rb, tool/id2token.rb: add --path-separator option
  for mingw where make and built ruby live in different world.
* tool/vpath.rb: extract from tool/instruction.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 08:12:29 +00:00
knu d5d2440e0f Drop executable bits of files that are not executable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-22 05:54:13 +00:00
nobu bcbc1f722c generic_erb.rb: --vpath option
* tool/generic_erb.rb (vpath.open): move --vpath option from
  template/id.h.tmpl.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-25 07:20:29 +00:00
nobu 7259c3f2e0 * tool/*: executable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 07:40:05 +00:00
nobu dc960b8729 * tool/generic_erb.rb: fixed typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 23:15:59 +00:00
nobu 295c75cb7c * tool/generic_erb.rb: sends the result to stdout if no output option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-19 12:19:19 +00:00
nobu de85d6e92e * common.mk (srcs): removed ID_H_TARGET.
* tool/generic_erb.rb: always overwrites if no if-change option.

* template/id.h.tmpl: shows which token differs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-19 12:12:53 +00:00
nobu b025ce4678 * common.mk (ID_H_TARGET): phony target to update id.h.
* tool/ifchange, win32/ifchange.bat: --timestamp option added.

* tool/generic_erb.rb: --timestamp, --output and --if-change options
  added.

* template/id.h.tmpl: moved from id.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-17 10:46:23 +00:00
yugui 16c95b42ce * error.c (Init_syserr): moved to the template.
(errno_missing): removed. fixed [ruby-dev:35958].

* defs/knwon_errors.def: added. extracted from Init_syserr.

* templates/known_errors.inc.tmpl: added. Template for Init_syserr.
  c.f. [ruby-dev:35958].

* tools/generic_erb.rb: added. general purpose mapper which maps
  data+template into source code.

* common.mk (error.$(OBJEXT), incs, known_errors.inc):
  Fixed dependencies.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26 08:18:49 +00:00