ed-precompiled_erb 5.0.3-arm64-darwin

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/libexec/erb ADDED
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env ruby
2
+ # Tiny eRuby --- ERB2
3
+ # Copyright (c) 1999-2000,2002 Masatoshi SEKI
4
+ # You can redistribute it and/or modify it under the same terms as Ruby.
5
+
6
+ require 'erb'
7
+
8
+ class ERB
9
+ module Main
10
+ def ARGV.switch
11
+ return nil if self.empty?
12
+ arg = self.shift
13
+ return nil if arg == '--'
14
+ case arg
15
+ when /\A-(.)(.*)/
16
+ if $1 == '-'
17
+ arg, @maybe_arg = arg.split(/=/, 2)
18
+ return arg
19
+ end
20
+ raise 'unknown switch "-"' if $2[0] == ?- and $1 != 'T'
21
+ if $2.size > 0
22
+ self.unshift "-#{$2}"
23
+ @maybe_arg = $2
24
+ else
25
+ @maybe_arg = nil
26
+ end
27
+ "-#{$1}"
28
+ when /\A(\w+)=/
29
+ arg
30
+ else
31
+ self.unshift arg
32
+ nil
33
+ end
34
+ end
35
+
36
+ def ARGV.req_arg
37
+ (@maybe_arg || self.shift || raise('missing argument')).tap {
38
+ @maybe_arg = nil
39
+ }
40
+ end
41
+
42
+ def trim_mode_opt(trim_mode, disable_percent)
43
+ return trim_mode if disable_percent
44
+ case trim_mode
45
+ when 0
46
+ return '%'
47
+ when 1
48
+ return '%>'
49
+ when 2
50
+ return '%<>'
51
+ when '-'
52
+ return '%-'
53
+ end
54
+ end
55
+ module_function :trim_mode_opt
56
+
57
+ def run(factory=ERB)
58
+ trim_mode = 0
59
+ disable_percent = false
60
+ variables = {}
61
+ begin
62
+ while switch = ARGV.switch
63
+ case switch
64
+ when '-x' # ruby source
65
+ output = true
66
+ when '-n' # line number
67
+ number = true
68
+ when '-v' # verbose
69
+ $VERBOSE = true
70
+ when '--version' # version
71
+ STDERR.puts factory.version
72
+ exit
73
+ when '-d', '--debug' # debug
74
+ $DEBUG = true
75
+ when '-r' # require
76
+ require ARGV.req_arg
77
+ when '-T' # trim mode
78
+ arg = ARGV.req_arg
79
+ if arg == '-'
80
+ trim_mode = arg
81
+ next
82
+ end
83
+ raise "invalid trim mode #{arg.dump}" unless arg =~ /\A[0-2]\z/
84
+ trim_mode = arg.to_i
85
+ when '-E', '--encoding'
86
+ arg = ARGV.req_arg
87
+ set_encoding(*arg.split(/:/, 2))
88
+ when '-U'
89
+ set_encoding(Encoding::UTF_8, Encoding::UTF_8)
90
+ when '-P'
91
+ disable_percent = true
92
+ when '--help'
93
+ raise ''
94
+ when /\A-/
95
+ raise "Unknown switch: #{switch.dump}"
96
+ else
97
+ var, val = *switch.split('=', 2)
98
+ (variables ||= {})[var] = val
99
+ end
100
+ end
101
+ rescue # usage
102
+ message = $!.to_s
103
+ STDERR.puts message unless message.empty?
104
+ STDERR.puts 'Usage:'
105
+ STDERR.puts " #{File.basename($0)} [options] [filepaths]"
106
+ STDERR.puts <<EOU
107
+
108
+ Options:
109
+ -d --debug Set $DEBUG to enable debugging.
110
+ -E ex[:in] --encoding ex[:in]
111
+ Set default external and internal encodings.
112
+ -h --help Print this text and exit.
113
+ -n Print generated Ruby source code with line numbers;
114
+ ignored if given without option -x.
115
+ -P Disable execution tag shorthand (for lines beginning with '%').
116
+ -r library Load the named library.
117
+ -T trim_mode Specify trim_mode:
118
+ '0' means '%'; '1' means '%>'; '2' means '<>'; '-' means '%-'.
119
+ -U Set default encoding to UTF-8.
120
+ -v Set $VERBOSE to enable debugging,
121
+ --version Print ERB version string and exit.
122
+ -x Print generated Ruby source code.
123
+ -- Treat all following words as filepaths (not options).
124
+ name=value Set the variable named name to the given string value.
125
+
126
+ Filepaths:
127
+ The erb program reads the text from all files at the filepaths as a single ERB template:
128
+ plain text, possibly with embedded ERB tags;
129
+ filepaths may be repeated.
130
+
131
+ The pseudo-filepath '-' (hyphen character) specifies the standard input.
132
+
133
+ If no filepaths are given, the sole input is the standard input.
134
+
135
+ See details and examples at https://docs.ruby-lang.org/en/master/erb_executable_md.html
136
+ EOU
137
+ exit 1
138
+ end
139
+
140
+ $<.set_encoding(Encoding::UTF_8, nil)
141
+ src = $<.read
142
+ filename = $FILENAME
143
+ exit 2 unless src
144
+ trim = trim_mode_opt(trim_mode, disable_percent)
145
+ erb = factory.new(src, trim_mode: trim)
146
+ erb.filename = filename
147
+ if output
148
+ if number
149
+ erb.src.each_line.with_index do |line, l|
150
+ puts "%3d %s"%[l+1, line]
151
+ end
152
+ else
153
+ puts erb.src
154
+ end
155
+ else
156
+ bind = TOPLEVEL_BINDING
157
+ if variables
158
+ enc = erb.encoding
159
+ for var, val in variables do
160
+ val = val.encode(enc) if val
161
+ bind.local_variable_set(var, val)
162
+ end
163
+ end
164
+ erb.run(bind)
165
+ end
166
+ end
167
+ module_function :run
168
+
169
+ def set_encoding(extern, intern = nil)
170
+ verbose, $VERBOSE = $VERBOSE, nil
171
+ Encoding.default_external = extern unless extern.nil? || extern == ""
172
+ Encoding.default_internal = intern unless intern.nil? || intern == ""
173
+ [$stdin, $stdout, $stderr].each do |io|
174
+ io.set_encoding(extern, intern)
175
+ end
176
+ ensure
177
+ $VERBOSE = verbose
178
+ end
179
+ module_function :set_encoding
180
+ class << self; private :set_encoding; end
181
+ end
182
+ end
183
+
184
+ ERB::Main.run
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ed-precompiled_erb
3
+ version: !ruby/object:Gem::Version
4
+ version: 5.0.3
5
+ platform: arm64-darwin
6
+ authors:
7
+ - Masatoshi SEKI
8
+ - Takashi Kokubun
9
+ bindir: libexec
10
+ cert_chain: []
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: An easy to use but powerful templating system for Ruby.
14
+ email:
15
+ - seki@ruby-lang.org
16
+ - k0kubun@ruby-lang.org
17
+ executables:
18
+ - erb
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - ".document"
23
+ - ".github/dependabot.yml"
24
+ - ".github/workflows/dependabot_automerge.yml"
25
+ - ".github/workflows/sync-ruby.yml"
26
+ - ".github/workflows/test.yml"
27
+ - ".gitignore"
28
+ - ".rdoc_options"
29
+ - BDSL
30
+ - COPYING
31
+ - Gemfile
32
+ - LICENSE.txt
33
+ - NEWS.md
34
+ - README.md
35
+ - Rakefile
36
+ - _doc/cgi.rb
37
+ - _doc/erb_executable.md
38
+ - bin/console
39
+ - bin/setup
40
+ - erb.gemspec
41
+ - ext/erb/escape/escape.c
42
+ - ext/erb/escape/extconf.rb
43
+ - lib/erb.rb
44
+ - lib/erb/3.2/escape.bundle
45
+ - lib/erb/3.3/escape.bundle
46
+ - lib/erb/3.4/escape.bundle
47
+ - lib/erb/compiler.rb
48
+ - lib/erb/def_method.rb
49
+ - lib/erb/util.rb
50
+ - lib/erb/version.rb
51
+ - libexec/erb
52
+ homepage: https://github.com/ruby/erb
53
+ licenses:
54
+ - Ruby
55
+ - BSD-2-Clause
56
+ metadata:
57
+ homepage_uri: https://github.com/ruby/erb
58
+ source_code_uri: https://github.com/ruby/erb
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '3.2'
67
+ - - "<"
68
+ - !ruby/object:Gem::Version
69
+ version: 3.5.dev
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubygems_version: 3.6.7
77
+ specification_version: 4
78
+ summary: An easy to use but powerful templating system for Ruby.
79
+ test_files: []