vagrant-unbundled 2.2.6.1 → 2.2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -9
- data/vagrant.gemspec +1 -1
- data/vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/vagrant-spec.gemspec +1 -1
- data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/CHANGELOG +79 -0
- data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/README.rdoc +109 -0
- data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/Rakefile +78 -0
- data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/lib/erubi/capture_end.rb +52 -0
- data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/lib/erubi.rb +211 -0
- data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/test/test.rb +780 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/README.md +354 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/Rakefile +18 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/TODO +15 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/central_directory.rb +208 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/compressor.rb +9 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/constants.rb +63 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/crypto/encryption.rb +11 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/crypto/null_encryption.rb +43 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/crypto/traditional_encryption.rb +99 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/decompressor.rb +13 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/deflater.rb +34 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/dos_time.rb +48 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/entry.rb +700 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/entry_set.rb +86 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/errors.rb +18 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/generic.rb +43 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/ntfs.rb +90 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/old_unix.rb +44 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/universal_time.rb +47 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/unix.rb +37 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/zip64.rb +68 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/zip64_placeholder.rb +15 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field.rb +101 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/file.rb +443 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/filesystem.rb +627 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/inflater.rb +66 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/input_stream.rb +173 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/ioextras/abstract_input_stream.rb +111 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/ioextras/abstract_output_stream.rb +43 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/ioextras.rb +36 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/null_compressor.rb +15 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/null_decompressor.rb +27 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/null_input_stream.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/output_stream.rb +189 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/pass_thru_compressor.rb +23 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/pass_thru_decompressor.rb +40 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/streamable_directory.rb +15 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/streamable_stream.rb +56 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/version.rb +3 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip.rb +71 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/example.rb +81 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/example_filesystem.rb +31 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/example_recursive.rb +54 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/gtk_ruby_zip.rb +84 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/qtzip.rb +92 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/write_simple.rb +12 -0
- data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/zipfind.rb +66 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/LICENSE +202 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/README.md +276 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/bin/rwinrm +90 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/connection.rb +84 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/connection_opts.rb +90 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/exceptions.rb +88 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/http/response_handler.rb +127 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/http/transport.rb +462 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/http/transport_factory.rb +64 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/output.rb +58 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/create_pipeline.xml.erb +167 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/fragment.rb +68 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/init_runspace_pool.xml.erb +224 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message.rb +128 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/base.rb +47 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/error_record.rb +66 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/pipeline_host_call.rb +30 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/pipeline_output.rb +48 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/pipeline_state.rb +38 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/runspacepool_host_call.rb +30 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/runspacepool_state.rb +37 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/session_capability.rb +34 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data.rb +40 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_defragmenter.rb +62 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_factory.rb +86 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_fragmenter.rb +58 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/powershell_output_decoder.rb +142 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/receive_response_reader.rb +95 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/session_capability.xml.erb +7 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/uuid.rb +39 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/base.rb +187 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/cmd.rb +63 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/power_shell.rb +206 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/retryable.rb +44 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/shell_factory.rb +56 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/version.rb +5 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/base.rb +57 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/cleanup_command.rb +60 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/close_shell.rb +49 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/command.rb +100 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/command_output.rb +75 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/command_output_decoder.rb +54 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/configuration.rb +44 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/create_pipeline.rb +64 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/create_shell.rb +115 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/header.rb +213 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/init_runspace_pool.rb +96 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/iso8601_duration.rb +58 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/keep_alive.rb +66 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/receive_response_reader.rb +128 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/send_data.rb +66 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/soap.rb +49 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/wql_pull.rb +54 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/wql_query.rb +98 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/write_stdin.rb +86 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm.rb +37 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/LICENSE +202 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/README.md +99 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/lib/winrm/shells/elevated.rb +108 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/lib/winrm-elevated/scripts/elevated_shell.ps1 +116 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/lib/winrm-elevated.rb +17 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/LICENSE +202 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/README.md +82 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/bin/rwinrmcp +87 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/core/file_transporter.rb +569 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/core/tmp_zip.rb +178 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/exceptions.rb +29 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/file_manager.rb +158 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/check_files.ps1.erb +49 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/checksum.ps1.erb +13 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/create_dir.ps1.erb +6 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/delete.ps1.erb +6 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/download.ps1.erb +17 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/exists.ps1.erb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/extract_files.ps1.erb +52 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/scripts.rb +47 -0
- data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs.rb +29 -0
- data/vendor/bundle/ruby/2.6.0/specifications/erubi-1.9.0.gemspec +38 -0
- data/vendor/bundle/ruby/2.6.0/specifications/rubyzip-2.0.0.gemspec +45 -0
- data/vendor/bundle/ruby/2.6.0/specifications/winrm-2.3.3.gemspec +73 -0
- data/vendor/bundle/ruby/2.6.0/specifications/winrm-elevated-1.1.2.gemspec +50 -0
- data/vendor/bundle/ruby/2.6.0/specifications/winrm-fs-1.3.4.gemspec +58 -0
- data/version.txt +1 -1
- metadata +142 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bbf0332bbe6ca456380199ded15ef9328a2ebaa00f92ba7d112fb4c5b43bf15
|
4
|
+
data.tar.gz: 5a524b4d511179f37c729faa12a9af27b622783a0298815e5527575f51a0e0ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc695c903cb52ca50c9d50530c0d461164210608d2ffae6961a00d252606dbcf2b5cc4b8cc9124bad784b7e655b980939c694dfce6e8dbf2ef2ac9475fac77fd
|
7
|
+
data.tar.gz: 9fabb62a9cdd8fb3070de6b6a0488e55216578725b802be4933f45dd65704a9564bc0885c4647abf7a3e6aac4a3f848d855702c735a3ba380c38c09b3dab658a
|
data/Gemfile.lock
CHANGED
@@ -11,7 +11,7 @@ GIT
|
|
11
11
|
PATH
|
12
12
|
remote: .
|
13
13
|
specs:
|
14
|
-
vagrant-unbundled (2.2.6.
|
14
|
+
vagrant-unbundled (2.2.6.2)
|
15
15
|
bcrypt_pbkdf (~> 1.0.0)
|
16
16
|
childprocess (~> 0.6.0)
|
17
17
|
ed25519 (~> 1.2.4)
|
@@ -26,7 +26,7 @@ PATH
|
|
26
26
|
rb-kqueue (~> 0.2.0)
|
27
27
|
rest-client (>= 1.6.0, < 3.0)
|
28
28
|
ruby_dep (<= 1.3.1)
|
29
|
-
rubyzip
|
29
|
+
rubyzip
|
30
30
|
vagrant_cloud (~> 2.0.3)
|
31
31
|
wdm (~> 0.1.0)
|
32
32
|
winrm (~> 2.1)
|
@@ -49,6 +49,7 @@ GEM
|
|
49
49
|
domain_name (0.5.20190701)
|
50
50
|
unf (>= 0.0.5, < 1.0.0)
|
51
51
|
ed25519 (1.2.4)
|
52
|
+
erubi (1.9.0)
|
52
53
|
erubis (2.7.0)
|
53
54
|
fake_ftp (0.1.1)
|
54
55
|
ffi (1.11.1)
|
@@ -112,7 +113,7 @@ GEM
|
|
112
113
|
rspec-support (3.5.0)
|
113
114
|
ruby_dep (1.3.1)
|
114
115
|
rubyntlm (0.6.2)
|
115
|
-
rubyzip (
|
116
|
+
rubyzip (2.0.0)
|
116
117
|
safe_yaml (1.0.5)
|
117
118
|
thor (0.18.1)
|
118
119
|
unf (0.1.4)
|
@@ -125,22 +126,23 @@ GEM
|
|
125
126
|
addressable (>= 2.3.6)
|
126
127
|
crack (>= 0.3.2)
|
127
128
|
hashdiff
|
128
|
-
winrm (2.3.
|
129
|
+
winrm (2.3.3)
|
129
130
|
builder (>= 2.1.2)
|
130
|
-
|
131
|
+
erubi (~> 1.8)
|
131
132
|
gssapi (~> 1.2)
|
132
133
|
gyoku (~> 1.0)
|
133
134
|
httpclient (~> 2.2, >= 2.2.0.2)
|
134
135
|
logging (>= 1.6.1, < 3.0)
|
135
136
|
nori (~> 2.0)
|
136
137
|
rubyntlm (~> 0.6.0, >= 0.6.1)
|
137
|
-
winrm-elevated (1.1.
|
138
|
+
winrm-elevated (1.1.2)
|
139
|
+
erubi (~> 1.8)
|
138
140
|
winrm (~> 2.0)
|
139
141
|
winrm-fs (~> 1.0)
|
140
|
-
winrm-fs (1.3.
|
141
|
-
|
142
|
+
winrm-fs (1.3.4)
|
143
|
+
erubi (~> 1.8)
|
142
144
|
logging (>= 1.6.1, < 3.0)
|
143
|
-
rubyzip (~>
|
145
|
+
rubyzip (~> 2.0)
|
144
146
|
winrm (~> 2.0)
|
145
147
|
|
146
148
|
PLATFORMS
|
data/vagrant.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_dependency "net-scp", "~> 1.2.0"
|
29
29
|
s.add_dependency "rb-kqueue", "~> 0.2.0"
|
30
30
|
s.add_dependency "rest-client", ">= 1.6.0", "< 3.0"
|
31
|
-
s.add_dependency "rubyzip"
|
31
|
+
s.add_dependency "rubyzip"
|
32
32
|
s.add_dependency "wdm", "~> 0.1.0"
|
33
33
|
s.add_dependency "winrm", "~> 2.1"
|
34
34
|
s.add_dependency "winrm-fs", "~> 1.0"
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Mitchell Hashimoto".freeze]
|
11
|
-
s.date = "2019-
|
11
|
+
s.date = "2019-11-15"
|
12
12
|
s.description = "Tool and library for testing Vagrant plugins".freeze
|
13
13
|
s.email = ["mitchell.hashimoto@gmail.com".freeze]
|
14
14
|
s.executables = ["vagrant-spec".freeze]
|
@@ -0,0 +1,79 @@
|
|
1
|
+
=== 1.9.0 (2019-09-25)
|
2
|
+
|
3
|
+
* Change default :bufvar from 'String.new' to '::String.new' to work with BasicObject (jeremyevans)
|
4
|
+
|
5
|
+
=== 1.8.0 (2018-12-18)
|
6
|
+
|
7
|
+
* Support :yield_returns_buffer option in capture_end for always returning the (potentially modified) buffer in <%|= tags (evanleck) (#15)
|
8
|
+
|
9
|
+
=== 1.7.1 (2018-03-05)
|
10
|
+
|
11
|
+
* Make whitespace handling for <%# %> tags more compatible with Erubis (jeremyevans) (#14)
|
12
|
+
|
13
|
+
=== 1.7.0 (2017-10-09)
|
14
|
+
|
15
|
+
* Fix escaping in erubi/capture_end, the setting was previously inverted (jeremyevans) (#10)
|
16
|
+
|
17
|
+
=== 1.6.1 (2017-06-27)
|
18
|
+
|
19
|
+
* Fix usage on newer versions of JRuby 9.1 (jeremyevans)
|
20
|
+
|
21
|
+
=== 1.6.0 (2017-02-27)
|
22
|
+
|
23
|
+
* Use cgi/escape if available for 6x faster HTML escaping (k0kubun, jeremyevans) (#4)
|
24
|
+
|
25
|
+
=== 1.5.0 (2017-01-26)
|
26
|
+
|
27
|
+
* Drop tilt/erubi file, as tilt now ships with Erubi support (jeremyevans)
|
28
|
+
|
29
|
+
* Drop erubi/capture file, Erubi::CaptureEngine support (jeremyevans)
|
30
|
+
|
31
|
+
=== 1.4.0 (2017-01-20)
|
32
|
+
|
33
|
+
* Allow postambles to depend on internal state of engine (jeremyevans)
|
34
|
+
|
35
|
+
* Allow overriding of behavior for <%= and <%== tags to depend on which indicator was used (jeremyevans)
|
36
|
+
|
37
|
+
* Make whitespace handling for <% %> tags more compatible with Erubis for subclasses overriding add_text (jeremyevans)
|
38
|
+
|
39
|
+
=== 1.3.0 (2016-12-29)
|
40
|
+
|
41
|
+
* Support :capture=>:explicit option in tilt support to use Erubi::CaptureEndEngine (jeremyevans)
|
42
|
+
|
43
|
+
* Add erubi/capture_end containing Erubi::CaptureEndEngine, allowing <%|= and <%|== for opening capture tags, and <%| for closing capture tags (jeremyevans)
|
44
|
+
|
45
|
+
=== 1.2.1 (2016-11-21)
|
46
|
+
|
47
|
+
* Don't automatically freeze template text strings on ruby 1.9 or 2.0 (jeremyevans)
|
48
|
+
|
49
|
+
=== 1.2.0 (2016-11-21)
|
50
|
+
|
51
|
+
* Engine#src now returns a frozen string (jeremyevans)
|
52
|
+
|
53
|
+
* Automatically freeze template text strings on ruby 2.1+, reducing garbage generated (jeremyevans)
|
54
|
+
|
55
|
+
* Allow overriding of behavior for <%= and <%== tags (ujifgc) (#1)
|
56
|
+
|
57
|
+
=== 1.1.0 (2016-11-14)
|
58
|
+
|
59
|
+
* Add :ensure option to supporting restoring bufvar to original value (jeremyevans)
|
60
|
+
|
61
|
+
* Don't have tilt support require erb (jeremyevans)
|
62
|
+
|
63
|
+
* Support :engine_class option in tilt support to override engine class used (jeremyevans)
|
64
|
+
|
65
|
+
* Support :capture option in tilt support to use Erubi::CaptureEngine (jeremyevans)
|
66
|
+
|
67
|
+
* Add erubi/capture file containing Erubi::CaptureEngine, allowing <%|= and <%|== for capture (and escaping) blocks in templates (jeremyevans)
|
68
|
+
|
69
|
+
* Raise ArgumentError if template source code contains indicators matched by regexp but not handled (jeremyevans)
|
70
|
+
|
71
|
+
* Add :bufval option to support arbitrary buffer values (jeremyevans)
|
72
|
+
|
73
|
+
* Add :regexp option to specify regexp used for scanning (jeremyevans)
|
74
|
+
|
75
|
+
* Add :src option to specify initial template source (jeremyevans)
|
76
|
+
|
77
|
+
=== 1.0.0 (2016-11-10)
|
78
|
+
|
79
|
+
* Initial Public Release
|
@@ -0,0 +1,21 @@
|
|
1
|
+
copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
|
2
|
+
copyright(c) 2016-2018 Jeremy Evans
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,109 @@
|
|
1
|
+
= Erubi
|
2
|
+
|
3
|
+
Erubi is a ERB template engine for ruby. It is a simplified fork of Erubis, using
|
4
|
+
the same basic algorithm, with the following differences:
|
5
|
+
|
6
|
+
* Handles postfix conditionals when using escaping (e.g. <tt><%= foo if bar %></tt>)
|
7
|
+
* Supports frozen_string_literal: true in templates via :freeze option
|
8
|
+
* Works with ruby's --enable-frozen-string-literal option
|
9
|
+
* Automatically freezes strings for template text when ruby optimizes it (on ruby 2.1+)
|
10
|
+
* Escapes ' (apostrophe) when escaping for better XSS protection
|
11
|
+
* Has 6x faster escaping on ruby 2.3+ by using cgi/escape
|
12
|
+
* Has 86% smaller memory footprint
|
13
|
+
* Does no monkey patching (Erubis adds a method to Kernel)
|
14
|
+
* Uses an immutable design (all options passed to the constructor, which returns a frozen object)
|
15
|
+
* Has simpler internals (1 file, <150 lines of code)
|
16
|
+
* Is not dead (Erubis hasn't been updated since 2011)
|
17
|
+
|
18
|
+
It is not designed with Erubis API compatibility in mind, though most Erubis
|
19
|
+
ERB syntax works, with the following exceptions:
|
20
|
+
|
21
|
+
* No support for <tt><%===</tt> for debug output
|
22
|
+
|
23
|
+
= Installation
|
24
|
+
|
25
|
+
gem install erubi
|
26
|
+
|
27
|
+
= Source Code
|
28
|
+
|
29
|
+
Source code is available on GitHub at https://github.com/jeremyevans/erubi
|
30
|
+
|
31
|
+
= Usage
|
32
|
+
|
33
|
+
Erubi only has built in support for retrieving the generated source for a
|
34
|
+
file:
|
35
|
+
|
36
|
+
require 'erubi'
|
37
|
+
eval(Erubi::Engine.new(File.read('filename.erb')).src)
|
38
|
+
|
39
|
+
Most users will probably use Erubi via Rails or Tilt. Erubi is the default
|
40
|
+
erb template handler in Tilt 2.0.6+ and Rails 5.1+.
|
41
|
+
|
42
|
+
== Capturing
|
43
|
+
|
44
|
+
Erubi does not support capturing block output into the template by default.
|
45
|
+
However, it comes with an +erubi/capture_end+ file that supports capturing
|
46
|
+
via <tt><%|=</tt> and <tt><%|==</tt> tags which are closed with a
|
47
|
+
<tt><%|</tt> tag:
|
48
|
+
|
49
|
+
<%|= form do %>
|
50
|
+
<input>
|
51
|
+
<%| end %>
|
52
|
+
|
53
|
+
This offers similar functionality to that offered by Rails' <tt><%=</tt>
|
54
|
+
tags, but without the corner cases with that approach (which are due to
|
55
|
+
attempting to parse ruby code via a regexp). Similar to the <tt><%=</tt>
|
56
|
+
and <tt><%==</tt> tags, <tt><%|=</tt> captures by default and
|
57
|
+
<tt><%|==</tt> captures and escapes by default, but this can be reversed
|
58
|
+
via the +:escape_capture+ or +:escape+ options.
|
59
|
+
|
60
|
+
To use the capture_end support with tilt:
|
61
|
+
|
62
|
+
require 'tilt'
|
63
|
+
require 'erubi/capture_end'
|
64
|
+
Tilt.new("filename.erb", :engine_class=>Erubi::CaptureEndEngine).render
|
65
|
+
|
66
|
+
When using the capture_end support, any methods (such as +form+ in the example
|
67
|
+
above) should return the (potentially modified) buffer. Since the buffer
|
68
|
+
variable is a local variable and not an instance variable by default, you'll
|
69
|
+
probably want to set the +:bufvar+ variable when using the capture_end
|
70
|
+
support to an instance variable, and have any methods used access that
|
71
|
+
instance variable. Example:
|
72
|
+
|
73
|
+
def form
|
74
|
+
@_buf << "<form>"
|
75
|
+
yield
|
76
|
+
@_buf << "</form>"
|
77
|
+
@_buf
|
78
|
+
end
|
79
|
+
|
80
|
+
puts eval(Erubi::CaptureEndEngine.new(<<-END, :bufvar=>:@_buf).src)
|
81
|
+
before
|
82
|
+
<%|= form do %>
|
83
|
+
inside
|
84
|
+
<%| end %>
|
85
|
+
after
|
86
|
+
END
|
87
|
+
|
88
|
+
# Output:
|
89
|
+
# before
|
90
|
+
# <form>
|
91
|
+
# inside
|
92
|
+
# </form>
|
93
|
+
# after
|
94
|
+
|
95
|
+
Alternatively, passing the option +:yield_returns_buffer => true+ will return the
|
96
|
+
buffer captured by the block instead of the last expression in the block.
|
97
|
+
|
98
|
+
= Reporting Bugs
|
99
|
+
|
100
|
+
The bug tracker is located at https://github.com/jeremyevans/erubi/issues
|
101
|
+
|
102
|
+
= License
|
103
|
+
|
104
|
+
MIT
|
105
|
+
|
106
|
+
= Authors
|
107
|
+
|
108
|
+
Jeremy Evans <code@jeremyevans.net>
|
109
|
+
kuwata-lab.com
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require "rake"
|
2
|
+
require "rake/clean"
|
3
|
+
|
4
|
+
NAME = 'erubi'
|
5
|
+
CLEAN.include ["#{NAME}-*.gem", "rdoc", "coverage"]
|
6
|
+
|
7
|
+
# Gem Packaging and Release
|
8
|
+
|
9
|
+
desc "Packages #{NAME}"
|
10
|
+
task :package=>[:clean] do |p|
|
11
|
+
sh %{gem build #{NAME}.gemspec}
|
12
|
+
end
|
13
|
+
|
14
|
+
### RDoc
|
15
|
+
|
16
|
+
RDOC_DEFAULT_OPTS = ["--line-numbers", "--inline-source", '--title', 'Erubi: Small ERB Implementation']
|
17
|
+
|
18
|
+
begin
|
19
|
+
gem 'hanna-nouveau'
|
20
|
+
RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
|
21
|
+
rescue Gem::LoadError
|
22
|
+
end
|
23
|
+
|
24
|
+
rdoc_task_class = begin
|
25
|
+
require "rdoc/task"
|
26
|
+
RDoc::Task
|
27
|
+
rescue LoadError
|
28
|
+
require "rake/rdoctask"
|
29
|
+
Rake::RDocTask
|
30
|
+
end
|
31
|
+
|
32
|
+
RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
|
33
|
+
RDOC_FILES = %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb"
|
34
|
+
|
35
|
+
rdoc_task_class.new do |rdoc|
|
36
|
+
rdoc.rdoc_dir = "rdoc"
|
37
|
+
rdoc.options += RDOC_OPTS
|
38
|
+
rdoc.rdoc_files.add RDOC_FILES
|
39
|
+
end
|
40
|
+
|
41
|
+
### Specs
|
42
|
+
|
43
|
+
spec = proc do |env|
|
44
|
+
env.each{|k,v| ENV[k] = v}
|
45
|
+
sh "#{FileUtils::RUBY} test/test.rb"
|
46
|
+
env.each{|k,v| ENV.delete(k)}
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Run specs"
|
50
|
+
task "spec" do
|
51
|
+
spec.call({})
|
52
|
+
end
|
53
|
+
|
54
|
+
task :default=>:spec
|
55
|
+
|
56
|
+
desc "Run specs with coverage"
|
57
|
+
task "spec_cov" do
|
58
|
+
spec.call('COVERAGE'=>'1')
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "Run specs with -w, some warnings filtered"
|
62
|
+
task "spec_w" do
|
63
|
+
ENV['RUBYOPT'] ? (ENV['RUBYOPT'] += " -w") : (ENV['RUBYOPT'] = '-w')
|
64
|
+
rake = ENV['RAKE'] || "#{FileUtils::RUBY} -S rake"
|
65
|
+
sh %{#{rake} 2>&1 | egrep -v \": warning: instance variable @.* not initialized|: warning: method redefined; discarding old|: warning: previous definition of|: warning: statement not reached"}
|
66
|
+
end
|
67
|
+
|
68
|
+
### Other
|
69
|
+
|
70
|
+
desc "Start an IRB shell using the extension"
|
71
|
+
task :irb do
|
72
|
+
require 'rbconfig'
|
73
|
+
ruby = ENV['RUBY'] || File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
74
|
+
irb = ENV['IRB'] || File.join(RbConfig::CONFIG['bindir'], File.basename(ruby).sub('ruby', 'irb'))
|
75
|
+
sh %{#{irb} -I lib -r #{NAME}}
|
76
|
+
end
|
77
|
+
|
78
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'erubi'
|
4
|
+
|
5
|
+
module Erubi
|
6
|
+
# An engine class that supports capturing blocks via the <%|= and <%|== tags,
|
7
|
+
# explicitly ending the captures using <%| end %> blocks.
|
8
|
+
class CaptureEndEngine < Engine
|
9
|
+
# Initializes the engine. Accepts the same arguments as ::Erubi::Engine, and these
|
10
|
+
# additional options:
|
11
|
+
# :escape_capture :: Whether to make <%|= escape by default, and <%|== not escape by default,
|
12
|
+
# defaults to the same value as :escape.
|
13
|
+
# :yield_returns_buffer :: Whether to have <%| tags insert the buffer as an expression, so that
|
14
|
+
# <%| end %> tags will have the buffer be the last expression inside
|
15
|
+
# the block, and therefore have the buffer be returned by the yield
|
16
|
+
# expression. Normally the buffer will be returned anyway, but there
|
17
|
+
# are cases where the last expression will not be the buffer,
|
18
|
+
# and therefore a different object will be returned.
|
19
|
+
def initialize(input, properties={})
|
20
|
+
properties = Hash[properties]
|
21
|
+
escape = properties.fetch(:escape){properties.fetch(:escape_html, false)}
|
22
|
+
@escape_capture = properties.fetch(:escape_capture, escape)
|
23
|
+
@yield_returns_buffer = properties.fetch(:yield_returns_buffer, false)
|
24
|
+
@bufval = properties[:bufval] ||= '::String.new'
|
25
|
+
@bufstack = '__erubi_stack'
|
26
|
+
properties[:regexp] ||= /<%(\|?={1,2}|-|\#|%|\|)?(.*?)([-=])?%>([ \t]*\r?\n)?/m
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# Handle the <%|= and <%|== tags
|
33
|
+
def handle(indicator, code, tailch, rspace, lspace)
|
34
|
+
case indicator
|
35
|
+
when '|=', '|=='
|
36
|
+
rspace = nil if tailch && !tailch.empty?
|
37
|
+
add_text(lspace) if lspace
|
38
|
+
escape_capture = !((indicator == '|=') ^ @escape_capture)
|
39
|
+
src << "begin; (#{@bufstack} ||= []) << #{@bufvar}; #{@bufvar} = #{@bufval}; #{@bufstack}.last << #{@escapefunc if escape_capture}((" << code
|
40
|
+
add_text(rspace) if rspace
|
41
|
+
when '|'
|
42
|
+
rspace = nil if tailch && !tailch.empty?
|
43
|
+
add_text(lspace) if lspace
|
44
|
+
result = @yield_returns_buffer ? " #{@bufvar}; " : ""
|
45
|
+
src << result << code << ")).to_s; ensure; #{@bufvar} = #{@bufstack}.pop; end;"
|
46
|
+
add_text(rspace) if rspace
|
47
|
+
else
|
48
|
+
super
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,211 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Erubi
|
4
|
+
VERSION = '1.9.0'
|
5
|
+
RANGE_ALL = 0..-1
|
6
|
+
|
7
|
+
if RUBY_VERSION >= '1.9'
|
8
|
+
RANGE_FIRST = 0
|
9
|
+
RANGE_LAST = -1
|
10
|
+
TEXT_END = RUBY_VERSION >= '2.1' ? "'.freeze;" : "';"
|
11
|
+
else
|
12
|
+
# :nocov:
|
13
|
+
RANGE_FIRST = 0..0
|
14
|
+
RANGE_LAST = -1..-1
|
15
|
+
TEXT_END = "';"
|
16
|
+
end
|
17
|
+
|
18
|
+
begin
|
19
|
+
require 'cgi/escape'
|
20
|
+
unless CGI.respond_to?(:escapeHTML) # work around for JRuby 9.1
|
21
|
+
CGI = Object.new
|
22
|
+
CGI.extend(defined?(::CGI::Escape) ? ::CGI::Escape : ::CGI::Util)
|
23
|
+
end
|
24
|
+
def self.h(value)
|
25
|
+
CGI.escapeHTML(value.to_s)
|
26
|
+
end
|
27
|
+
rescue LoadError
|
28
|
+
ESCAPE_TABLE = {'&' => '&'.freeze, '<' => '<'.freeze, '>' => '>'.freeze, '"' => '"'.freeze, "'" => '''.freeze}.freeze
|
29
|
+
if RUBY_VERSION >= '1.9'
|
30
|
+
# Escape the following characters with their HTML/XML
|
31
|
+
# equivalents.
|
32
|
+
def self.h(value)
|
33
|
+
value.to_s.gsub(/[&<>"']/, ESCAPE_TABLE)
|
34
|
+
end
|
35
|
+
else
|
36
|
+
def self.h(value)
|
37
|
+
value.to_s.gsub(/[&<>"']/){|s| ESCAPE_TABLE[s]}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class Engine
|
43
|
+
# The frozen ruby source code generated from the template, which can be evaled.
|
44
|
+
attr_reader :src
|
45
|
+
|
46
|
+
# The filename of the template, if one was given.
|
47
|
+
attr_reader :filename
|
48
|
+
|
49
|
+
# The variable name used for the buffer variable.
|
50
|
+
attr_reader :bufvar
|
51
|
+
|
52
|
+
# Initialize a new Erubi::Engine. Options:
|
53
|
+
# :bufval :: The value to use for the buffer variable, as a string.
|
54
|
+
# :bufvar :: The variable name to use for the buffer variable, as a string (default '::String.new')
|
55
|
+
# :ensure :: Wrap the template in a begin/ensure block restoring the previous value of bufvar.
|
56
|
+
# :escapefunc :: The function to use for escaping, as a string (default: '::Erubi.h').
|
57
|
+
# :escape :: Whether to make <%= escape by default, and <%== not escape by default.
|
58
|
+
# :escape_html :: Same as :escape, with lower priority.
|
59
|
+
# :filename :: The filename for the template.
|
60
|
+
# :freeze :: Whether to enable frozen string literals in the resulting source code.
|
61
|
+
# :outvar :: Same as bufvar, with lower priority.
|
62
|
+
# :postamble :: The postamble for the template, by default returns the resulting source code.
|
63
|
+
# :preamble :: The preamble for the template, by default initializes up the buffer variable.
|
64
|
+
# :regexp :: The regexp to use for scanning.
|
65
|
+
# :src :: The initial value to use for the source code
|
66
|
+
# :trim :: Whether to trim leading and trailing whitespace, true by default.
|
67
|
+
def initialize(input, properties={})
|
68
|
+
@escape = escape = properties.fetch(:escape){properties.fetch(:escape_html, false)}
|
69
|
+
trim = properties[:trim] != false
|
70
|
+
@filename = properties[:filename]
|
71
|
+
@bufvar = bufvar = properties[:bufvar] || properties[:outvar] || "_buf"
|
72
|
+
bufval = properties[:bufval] || '::String.new'
|
73
|
+
regexp = properties[:regexp] || /<%(={1,2}|-|\#|%)?(.*?)([-=])?%>([ \t]*\r?\n)?/m
|
74
|
+
preamble = properties[:preamble] || "#{bufvar} = #{bufval};"
|
75
|
+
postamble = properties[:postamble] || "#{bufvar}.to_s\n"
|
76
|
+
|
77
|
+
@src = src = properties[:src] || String.new
|
78
|
+
src << "# frozen_string_literal: true\n" if properties[:freeze]
|
79
|
+
src << "begin; __original_outvar = #{bufvar} if defined?(#{bufvar}); " if properties[:ensure]
|
80
|
+
|
81
|
+
unless @escapefunc = properties[:escapefunc]
|
82
|
+
if escape
|
83
|
+
@escapefunc = '__erubi.h'
|
84
|
+
src << "__erubi = ::Erubi;"
|
85
|
+
else
|
86
|
+
@escapefunc = '::Erubi.h'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
src << preamble
|
91
|
+
|
92
|
+
pos = 0
|
93
|
+
is_bol = true
|
94
|
+
input.scan(regexp) do |indicator, code, tailch, rspace|
|
95
|
+
match = Regexp.last_match
|
96
|
+
len = match.begin(0) - pos
|
97
|
+
text = input[pos, len]
|
98
|
+
pos = match.end(0)
|
99
|
+
ch = indicator ? indicator[RANGE_FIRST] : nil
|
100
|
+
|
101
|
+
lspace = nil
|
102
|
+
|
103
|
+
unless ch == '='
|
104
|
+
if text.empty?
|
105
|
+
lspace = "" if is_bol
|
106
|
+
elsif text[RANGE_LAST] == "\n"
|
107
|
+
lspace = ""
|
108
|
+
else
|
109
|
+
rindex = text.rindex("\n")
|
110
|
+
if rindex
|
111
|
+
range = rindex+1..-1
|
112
|
+
s = text[range]
|
113
|
+
if s =~ /\A[ \t]*\z/
|
114
|
+
lspace = s
|
115
|
+
text[range] = ''
|
116
|
+
end
|
117
|
+
else
|
118
|
+
if is_bol && text =~ /\A[ \t]*\z/
|
119
|
+
lspace = text.dup
|
120
|
+
text[RANGE_ALL] = ''
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
is_bol = rspace
|
127
|
+
add_text(text) if text && !text.empty?
|
128
|
+
case ch
|
129
|
+
when '='
|
130
|
+
rspace = nil if tailch && !tailch.empty?
|
131
|
+
add_text(lspace) if lspace
|
132
|
+
add_expression(indicator, code)
|
133
|
+
add_text(rspace) if rspace
|
134
|
+
when '#'
|
135
|
+
n = code.count("\n") + (rspace ? 1 : 0)
|
136
|
+
if trim && lspace && rspace
|
137
|
+
add_code("\n" * n)
|
138
|
+
else
|
139
|
+
add_text(lspace) if lspace
|
140
|
+
add_code("\n" * n)
|
141
|
+
add_text(rspace) if rspace
|
142
|
+
end
|
143
|
+
when '%'
|
144
|
+
add_text("#{lspace}#{prefix||='<%'}#{code}#{tailch}#{postfix||='%>'}#{rspace}")
|
145
|
+
when nil, '-'
|
146
|
+
if trim && lspace && rspace
|
147
|
+
add_code("#{lspace}#{code}#{rspace}")
|
148
|
+
else
|
149
|
+
add_text(lspace) if lspace
|
150
|
+
add_code(code)
|
151
|
+
add_text(rspace) if rspace
|
152
|
+
end
|
153
|
+
else
|
154
|
+
handle(indicator, code, tailch, rspace, lspace)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
rest = pos == 0 ? input : input[pos..-1]
|
158
|
+
add_text(rest)
|
159
|
+
|
160
|
+
src << "\n" unless src[RANGE_LAST] == "\n"
|
161
|
+
add_postamble(postamble)
|
162
|
+
src << "; ensure\n #{bufvar} = __original_outvar\nend\n" if properties[:ensure]
|
163
|
+
src.freeze
|
164
|
+
freeze
|
165
|
+
end
|
166
|
+
|
167
|
+
private
|
168
|
+
|
169
|
+
# Add raw text to the template
|
170
|
+
def add_text(text)
|
171
|
+
@src << " #{@bufvar} << '" << text.gsub(/['\\]/, '\\\\\&') << TEXT_END unless text.empty?
|
172
|
+
end
|
173
|
+
|
174
|
+
# Add ruby code to the template
|
175
|
+
def add_code(code)
|
176
|
+
@src << code
|
177
|
+
@src << ';' unless code[RANGE_LAST] == "\n"
|
178
|
+
end
|
179
|
+
|
180
|
+
# Add the given ruby expression result to the template,
|
181
|
+
# escaping it based on the indicator given and escape flag.
|
182
|
+
def add_expression(indicator, code)
|
183
|
+
if ((indicator == '=') ^ @escape)
|
184
|
+
add_expression_result(code)
|
185
|
+
else
|
186
|
+
add_expression_result_escaped(code)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# Add the result of Ruby expression to the template
|
191
|
+
def add_expression_result(code)
|
192
|
+
@src << " #{@bufvar} << (" << code << ').to_s;'
|
193
|
+
end
|
194
|
+
|
195
|
+
# Add the escaped result of Ruby expression to the template
|
196
|
+
def add_expression_result_escaped(code)
|
197
|
+
@src << " #{@bufvar} << #{@escapefunc}((" << code << '));'
|
198
|
+
end
|
199
|
+
|
200
|
+
# Add the given postamble to the src. Can be overridden in subclasses
|
201
|
+
# to make additional changes to src that depend on the current state.
|
202
|
+
def add_postamble(postamble)
|
203
|
+
src << postamble
|
204
|
+
end
|
205
|
+
|
206
|
+
# Raise an exception, as the base engine class does not support handling other indicators.
|
207
|
+
def handle(indicator, code, tailch, rspace, lspace)
|
208
|
+
raise ArgumentError, "Invalid indicator: #{indicator}"
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|