vagrant-unbundled 2.0.0.1 → 2.0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +34 -0
- data/Gemfile.lock +10 -10
- data/README.md +2 -2
- data/contrib/sudoers/linux-suse +6 -7
- data/lib/vagrant/plugin/v2/command.rb +3 -0
- data/lib/vagrant/plugin/v2/communicator.rb +1 -1
- data/lib/vagrant/registry.rb +1 -1
- data/lib/vagrant/util/downloader.rb +1 -2
- data/lib/vagrant/util/is_port_open.rb +2 -1
- data/lib/vagrant/util/keypair.rb +1 -1
- data/lib/vagrant/util/platform.rb +39 -23
- data/plugins/commands/destroy/command.rb +31 -10
- data/plugins/communicators/ssh/communicator.rb +1 -0
- data/plugins/communicators/winrm/helper.rb +6 -1
- data/plugins/guests/solaris11/cap/change_host_name.rb +0 -2
- data/plugins/guests/solaris11/cap/configure_networks.rb +1 -7
- data/plugins/guests/solaris11/plugin.rb +5 -35
- data/plugins/guests/windows/cap/public_key.rb +2 -0
- data/plugins/guests/windows/guest_network.rb +3 -3
- data/plugins/guests/windows/scripts/reboot_detect.ps1 +5 -0
- data/plugins/providers/docker/driver.rb +1 -1
- data/plugins/providers/docker/executor/local.rb +4 -0
- data/plugins/providers/docker/executor/vagrant.rb +4 -0
- data/plugins/providers/hyperv/scripts/import_vm_vmcx.ps1 +1 -1
- data/plugins/providers/virtualbox/driver/meta.rb +1 -0
- data/plugins/providers/virtualbox/driver/version_5_2.rb +16 -0
- data/plugins/providers/virtualbox/plugin.rb +1 -0
- data/plugins/providers/virtualbox/synced_folder.rb +1 -1
- data/plugins/provisioners/chef/provisioner/chef_client.rb +30 -23
- data/plugins/provisioners/chef/provisioner/chef_solo.rb +26 -19
- data/plugins/provisioners/chef/provisioner/chef_zero.rb +29 -22
- data/plugins/provisioners/puppet/provisioner/puppet.rb +23 -4
- data/plugins/provisioners/salt/bootstrap-salt.ps1 +15 -3
- data/plugins/provisioners/salt/bootstrap-salt.sh +2 -0
- data/plugins/provisioners/salt/config.rb +11 -0
- data/plugins/provisioners/salt/provisioner.rb +10 -7
- data/plugins/provisioners/shell/provisioner.rb +1 -1
- data/templates/locales/en.yml +5 -0
- data/test/unit/base.rb +2 -0
- data/test/unit/plugins/commands/destroy/command_test.rb +155 -0
- data/test/unit/plugins/communicators/winrm/helper_test.rb +33 -0
- data/test/unit/plugins/guests/solaris11/cap/change_host_name_test.rb +36 -0
- data/test/unit/plugins/guests/solaris11/cap/configure_networks_test.rb +56 -0
- data/test/unit/plugins/providers/virtualbox/synced_folder_test.rb +26 -0
- data/test/unit/plugins/provisioners/salt/config_test.rb +42 -0
- data/test/unit/plugins/provisioners/salt/provisioner_test.rb +16 -1
- data/test/unit/plugins/provisioners/shell/config_test.rb +3 -3
- data/test/unit/plugins/pushes/local-exec/config_test.rb +2 -2
- data/test/unit/vagrant/util/downloader_test.rb +28 -0
- data/test/unit/vagrant/util/platform_test.rb +58 -0
- data/vagrant.gemspec +1 -1
- data/vendor/bundle/ruby/2.4.0/bin/rwinrmcp +5 -0
- data/vendor/bundle/ruby/2.4.0/bin/vagrant +5 -0
- data/vendor/bundle/ruby/2.4.0/bin/vagrant-spec +5 -0
- data/vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-af86757912f7/vagrant-spec.gemspec +3 -3
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/CHANGELOG.md +216 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/Gemfile +32 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/README.md +121 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/Rakefile +32 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/data/unicode.data +0 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/idna/native.rb +59 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/idna/pure.rb +677 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/idna.rb +25 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/template.rb +1065 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/uri.rb +2492 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/version.rb +30 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable.rb +2 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/idna_spec.rb +298 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/net_http_compat_spec.rb +28 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/rack_mount_compat_spec.rb +104 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/security_spec.rb +57 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/template_spec.rb +1419 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/uri_spec.rb +6468 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/spec_helper.rb +21 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/clobber.rake +2 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/gem.rake +91 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/git.rake +45 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/metrics.rake +22 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/rspec.rake +21 -0
- data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/yard.rake +27 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/.gitignore +15 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/.rspec +1 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/.travis.yml +13 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/.yardopts +1 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/Gemfile +6 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/LICENSE +19 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/README.md +265 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/Rakefile +13 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/changelog.md +72 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/hashdiff.gemspec +25 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/diff.rb +232 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/lcs.rb +69 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/linear_compare_array.rb +155 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/patch.rb +88 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/util.rb +146 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/version.rb +3 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff.rb +6 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/best_diff_spec.rb +74 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/diff_array_spec.rb +60 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/diff_spec.rb +339 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/lcs_spec.rb +75 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/linear_compare_array_spec.rb +48 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/patch_spec.rb +183 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/util_spec.rb +78 -0
- data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/spec_helper.rb +13 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/CHANGELOG.md +250 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/CONTRIBUTING.md +46 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/LICENSE.md +20 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/README.md +122 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapter.rb +49 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapter_error.rb +15 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/gson.rb +20 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/jr_jackson.rb +25 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/json_common.rb +23 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/json_gem.rb +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/json_pure.rb +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/nsjsonserialization.rb +32 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/oj.rb +25 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/ok_json.rb +23 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/yajl.rb +19 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/convertible_hash_keys.rb +43 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/options.rb +39 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/options_cache.rb +29 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/parse_error.rb +17 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/vendor/okjson.rb +606 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/version.rb +17 -0
- data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json.rb +161 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.gitignore +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.rubocop.yml +32 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.rubocop_defaults.yml +177 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.travis.yml +24 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.yardopts +1 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/2.0-Upgrade.md +52 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/CHANGELOG.md +330 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/Gemfile +10 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/README.md +202 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/Rakefile +49 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/bin/console +14 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/data/list.txt +12288 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/domain.rb +235 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/errors.rb +39 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/list.rb +243 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/rule.rb +348 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/version.rb +10 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix.rb +175 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/public_suffix.gemspec +25 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/.empty +2 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/acceptance_test.rb +127 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_find.rb +66 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_find_all.rb +102 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_names.rb +91 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_select.rb +26 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_select_incremental.rb +25 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_valid.rb +101 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/domain_profiler.rb +12 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/find_profiler.rb +12 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/find_profiler_jp.rb +12 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/initialization_profiler.rb +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/list_profsize.rb +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/object_binsize.rb +57 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/psl_test.rb +49 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/test_helper.rb +13 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/tests.txt +98 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/domain_test.rb +104 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/errors_test.rb +23 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/list_test.rb +239 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/public_suffix_test.rb +186 -0
- data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/rule_test.rb +220 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/.gemtest +0 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/.gitignore +34 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/.rspec-tm +2 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/.travis.yml +24 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/CHANGELOG.md +1460 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/Gemfile +9 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/LICENSE +20 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/README.md +1045 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/Rakefile +30 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/api.rb +97 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/assertion_failure.rb +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/callback_registry.rb +35 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/config.rb +18 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/cucumber.rb +10 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/deprecation.rb +9 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/errors.rb +17 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/curb_adapter.rb +337 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +228 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/excon_adapter.rb +162 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/client.rb +14 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/request.rb +10 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/response.rb +43 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/streamer.rb +25 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/webmock.rb +68 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb_adapter.rb +37 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/httpclient_adapter.rb +240 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/manticore_adapter.rb +127 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/net_http.rb +362 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/patron_adapter.rb +130 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +174 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb +36 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/minitest.rb +41 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rack_response.rb +69 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_body_diff.rb +64 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_execution_verifier.rb +78 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_pattern.rb +343 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_registry.rb +35 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_signature.rb +54 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_signature_snippet.rb +61 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_stub.rb +100 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/response.rb +153 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/responses_sequence.rb +40 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rspec/matchers/request_pattern_matcher.rb +78 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rspec/matchers/webmock_matcher.rb +52 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rspec/matchers.rb +27 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rspec.rb +35 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/stub_registry.rb +67 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/stub_request_snippet.rb +34 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/test_unit.rb +22 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/hash_counter.rb +32 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/hash_keys_stringifier.rb +25 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/hash_validator.rb +17 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/headers.rb +49 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/json.rb +78 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/query_mapper.rb +279 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/uri.rb +111 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/version_checker.rb +111 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/version.rb +3 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/webmock.rb +156 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock.rb +54 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/minitest/test_helper.rb +34 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/minitest/test_webmock.rb +9 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/minitest/webmock_spec.rb +60 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/curb/curb_spec.rb +466 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/curb/curb_spec_helper.rb +147 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/em_http_request/em_http_request_spec.rb +406 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +77 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/excon/excon_spec.rb +75 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/excon/excon_spec_helper.rb +50 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/http_rb/http_rb_spec.rb +73 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/http_rb/http_rb_spec_helper.rb +51 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/httpclient/httpclient_spec.rb +209 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/httpclient/httpclient_spec_helper.rb +57 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/manticore/manticore_spec.rb +56 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/manticore/manticore_spec_helper.rb +35 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/net_http/net_http_shared.rb +142 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/net_http/net_http_spec.rb +317 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/net_http/net_http_spec_helper.rb +64 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/patron/patron_spec.rb +118 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/patron/patron_spec_helper.rb +54 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +313 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/callbacks.rb +147 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/request_expectations.rb +916 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/returning_declared_responses.rb +388 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/stubbing_requests.rb +583 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +135 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +60 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/webmock_shared.rb +41 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/fixtures/test.txt +1 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/quality_spec.rb +84 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/spec_helper.rb +48 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/example_curl_output.txt +22 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/failures.rb +9 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/my_rack_app.rb +53 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/network_connection.rb +19 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/webmock_server.rb +69 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/api_spec.rb +75 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/errors_spec.rb +129 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/matchers/hash_including_matcher_spec.rb +87 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/rack_response_spec.rb +112 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_body_diff_spec.rb +90 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_execution_verifier_spec.rb +208 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_pattern_spec.rb +590 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_registry_spec.rb +76 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_signature_snippet_spec.rb +89 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_signature_spec.rb +155 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_stub_spec.rb +199 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/response_spec.rb +282 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/stub_registry_spec.rb +103 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/stub_request_snippet_spec.rb +95 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/hash_counter_spec.rb +39 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/headers_spec.rb +28 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/json_spec.rb +33 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/query_mapper_spec.rb +138 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/uri_spec.rb +299 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/version_checker_spec.rb +65 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/webmock_spec.rb +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/test/http_request.rb +24 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/test/shared_test.rb +95 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/test/test_helper.rb +23 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/test/test_webmock.rb +6 -0
- data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/webmock.gemspec +46 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/.gitignore +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/.rspec +3 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/.rubocop.yml +9 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/.travis.yml +9 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/Gemfile +5 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/LICENSE +202 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/README.md +79 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/Rakefile +28 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/VERSION +1 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/Vagrantfile +9 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/appveyor.yml +38 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/bin/rwinrmcp +86 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/changelog.md +60 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/core/file_transporter.rb +527 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/core/tmp_zip.rb +177 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/exceptions.rb +28 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/file_manager.rb +118 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/check_files.ps1.erb +49 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/checksum.ps1.erb +13 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/create_dir.ps1.erb +6 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/delete.ps1.erb +6 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/download.ps1.erb +8 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/exists.ps1.erb +10 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/extract_files.ps1.erb +52 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/scripts.rb +31 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs.rb +28 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/config-example.yml +3 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/integration/file_manager_spec.rb +224 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/integration/tmp_zip_spec.rb +26 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/matchers.rb +58 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/spec_helper.rb +71 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/unit/tmp_zip_spec.rb +79 -0
- data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/winrm-fs.gemspec +37 -0
- data/vendor/bundle/ruby/2.4.0/specifications/addressable-2.5.2.gemspec +39 -0
- data/vendor/bundle/ruby/2.4.0/specifications/hashdiff-0.3.7.gemspec +39 -0
- data/vendor/bundle/ruby/2.4.0/specifications/multi_json-1.12.2.gemspec +33 -0
- data/vendor/bundle/ruby/2.4.0/specifications/public_suffix-3.0.1.gemspec +41 -0
- data/vendor/bundle/ruby/2.4.0/specifications/webmock-2.3.2.gemspec +79 -0
- data/vendor/bundle/ruby/2.4.0/specifications/winrm-fs-1.1.1.gemspec +57 -0
- data/version.txt +1 -1
- metadata +295 -11
- data/plugins/guests/solaris11/cap/halt.rb +0 -26
- data/plugins/guests/solaris11/cap/insert_public_key.rb +0 -21
- data/plugins/guests/solaris11/cap/mount_virtualbox_shared_folder.rb +0 -45
- data/plugins/guests/solaris11/cap/remove_public_key.rb +0 -21
- data/plugins/guests/solaris11/cap/rsync.rb +0 -29
- data/test/unit/plugins/guests/solaris11/cap/halt_test.rb +0 -44
@@ -0,0 +1,677 @@
|
|
1
|
+
# encoding:utf-8
|
2
|
+
#--
|
3
|
+
# Copyright (C) Bob Aman
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#++
|
17
|
+
|
18
|
+
|
19
|
+
module Addressable
|
20
|
+
module IDNA
|
21
|
+
# This module is loosely based on idn_actionmailer by Mick Staugaard,
|
22
|
+
# the unicode library by Yoshida Masato, and the punycode implementation
|
23
|
+
# by Kazuhiro Nishiyama. Most of the code was copied verbatim, but
|
24
|
+
# some reformatting was done, and some translation from C was done.
|
25
|
+
#
|
26
|
+
# Without their code to work from as a base, we'd all still be relying
|
27
|
+
# on the presence of libidn. Which nobody ever seems to have installed.
|
28
|
+
#
|
29
|
+
# Original sources:
|
30
|
+
# http://github.com/staugaard/idn_actionmailer
|
31
|
+
# http://www.yoshidam.net/Ruby.html#unicode
|
32
|
+
# http://rubyforge.org/frs/?group_id=2550
|
33
|
+
|
34
|
+
|
35
|
+
UNICODE_TABLE = File.expand_path(
|
36
|
+
File.join(File.dirname(__FILE__), '../../..', 'data/unicode.data')
|
37
|
+
)
|
38
|
+
|
39
|
+
ACE_PREFIX = "xn--"
|
40
|
+
|
41
|
+
UTF8_REGEX = /\A(?:
|
42
|
+
[\x09\x0A\x0D\x20-\x7E] # ASCII
|
43
|
+
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
|
44
|
+
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
|
45
|
+
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
|
46
|
+
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
|
47
|
+
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
|
48
|
+
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4nil5
|
49
|
+
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
|
50
|
+
)*\z/mnx
|
51
|
+
|
52
|
+
UTF8_REGEX_MULTIBYTE = /(?:
|
53
|
+
[\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
|
54
|
+
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
|
55
|
+
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
|
56
|
+
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
|
57
|
+
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
|
58
|
+
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4nil5
|
59
|
+
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
|
60
|
+
)/mnx
|
61
|
+
|
62
|
+
# :startdoc:
|
63
|
+
|
64
|
+
# Converts from a Unicode internationalized domain name to an ASCII
|
65
|
+
# domain name as described in RFC 3490.
|
66
|
+
def self.to_ascii(input)
|
67
|
+
input = input.to_s unless input.is_a?(String)
|
68
|
+
input = input.dup
|
69
|
+
if input.respond_to?(:force_encoding)
|
70
|
+
input.force_encoding(Encoding::ASCII_8BIT)
|
71
|
+
end
|
72
|
+
if input =~ UTF8_REGEX && input =~ UTF8_REGEX_MULTIBYTE
|
73
|
+
parts = unicode_downcase(input).split('.')
|
74
|
+
parts.map! do |part|
|
75
|
+
if part.respond_to?(:force_encoding)
|
76
|
+
part.force_encoding(Encoding::ASCII_8BIT)
|
77
|
+
end
|
78
|
+
if part =~ UTF8_REGEX && part =~ UTF8_REGEX_MULTIBYTE
|
79
|
+
ACE_PREFIX + punycode_encode(unicode_normalize_kc(part))
|
80
|
+
else
|
81
|
+
part
|
82
|
+
end
|
83
|
+
end
|
84
|
+
parts.join('.')
|
85
|
+
else
|
86
|
+
input
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Converts from an ASCII domain name to a Unicode internationalized
|
91
|
+
# domain name as described in RFC 3490.
|
92
|
+
def self.to_unicode(input)
|
93
|
+
input = input.to_s unless input.is_a?(String)
|
94
|
+
parts = input.split('.')
|
95
|
+
parts.map! do |part|
|
96
|
+
if part =~ /^#{ACE_PREFIX}(.+)/
|
97
|
+
begin
|
98
|
+
punycode_decode(part[/^#{ACE_PREFIX}(.+)/, 1])
|
99
|
+
rescue Addressable::IDNA::PunycodeBadInput
|
100
|
+
# toUnicode is explicitly defined as never-fails by the spec
|
101
|
+
part
|
102
|
+
end
|
103
|
+
else
|
104
|
+
part
|
105
|
+
end
|
106
|
+
end
|
107
|
+
output = parts.join('.')
|
108
|
+
if output.respond_to?(:force_encoding)
|
109
|
+
output.force_encoding(Encoding::UTF_8)
|
110
|
+
end
|
111
|
+
output
|
112
|
+
end
|
113
|
+
|
114
|
+
# Unicode normalization form KC.
|
115
|
+
def self.unicode_normalize_kc(input)
|
116
|
+
input = input.to_s unless input.is_a?(String)
|
117
|
+
unpacked = input.unpack("U*")
|
118
|
+
unpacked =
|
119
|
+
unicode_compose(unicode_sort_canonical(unicode_decompose(unpacked)))
|
120
|
+
return unpacked.pack("U*")
|
121
|
+
end
|
122
|
+
|
123
|
+
##
|
124
|
+
# Unicode aware downcase method.
|
125
|
+
#
|
126
|
+
# @api private
|
127
|
+
# @param [String] input
|
128
|
+
# The input string.
|
129
|
+
# @return [String] The downcased result.
|
130
|
+
def self.unicode_downcase(input)
|
131
|
+
input = input.to_s unless input.is_a?(String)
|
132
|
+
unpacked = input.unpack("U*")
|
133
|
+
unpacked.map! { |codepoint| lookup_unicode_lowercase(codepoint) }
|
134
|
+
return unpacked.pack("U*")
|
135
|
+
end
|
136
|
+
(class <<self; private :unicode_downcase; end)
|
137
|
+
|
138
|
+
def self.unicode_compose(unpacked)
|
139
|
+
unpacked_result = []
|
140
|
+
length = unpacked.length
|
141
|
+
|
142
|
+
return unpacked if length == 0
|
143
|
+
|
144
|
+
starter = unpacked[0]
|
145
|
+
starter_cc = lookup_unicode_combining_class(starter)
|
146
|
+
starter_cc = 256 if starter_cc != 0
|
147
|
+
for i in 1...length
|
148
|
+
ch = unpacked[i]
|
149
|
+
cc = lookup_unicode_combining_class(ch)
|
150
|
+
|
151
|
+
if (starter_cc == 0 &&
|
152
|
+
(composite = unicode_compose_pair(starter, ch)) != nil)
|
153
|
+
starter = composite
|
154
|
+
startercc = lookup_unicode_combining_class(composite)
|
155
|
+
else
|
156
|
+
unpacked_result << starter
|
157
|
+
starter = ch
|
158
|
+
startercc = cc
|
159
|
+
end
|
160
|
+
end
|
161
|
+
unpacked_result << starter
|
162
|
+
return unpacked_result
|
163
|
+
end
|
164
|
+
(class <<self; private :unicode_compose; end)
|
165
|
+
|
166
|
+
def self.unicode_compose_pair(ch_one, ch_two)
|
167
|
+
if ch_one >= HANGUL_LBASE && ch_one < HANGUL_LBASE + HANGUL_LCOUNT &&
|
168
|
+
ch_two >= HANGUL_VBASE && ch_two < HANGUL_VBASE + HANGUL_VCOUNT
|
169
|
+
# Hangul L + V
|
170
|
+
return HANGUL_SBASE + (
|
171
|
+
(ch_one - HANGUL_LBASE) * HANGUL_VCOUNT + (ch_two - HANGUL_VBASE)
|
172
|
+
) * HANGUL_TCOUNT
|
173
|
+
elsif ch_one >= HANGUL_SBASE &&
|
174
|
+
ch_one < HANGUL_SBASE + HANGUL_SCOUNT &&
|
175
|
+
(ch_one - HANGUL_SBASE) % HANGUL_TCOUNT == 0 &&
|
176
|
+
ch_two >= HANGUL_TBASE && ch_two < HANGUL_TBASE + HANGUL_TCOUNT
|
177
|
+
# Hangul LV + T
|
178
|
+
return ch_one + (ch_two - HANGUL_TBASE)
|
179
|
+
end
|
180
|
+
|
181
|
+
p = []
|
182
|
+
ucs4_to_utf8 = lambda do |ch|
|
183
|
+
if ch < 128
|
184
|
+
p << ch
|
185
|
+
elsif ch < 2048
|
186
|
+
p << (ch >> 6 | 192)
|
187
|
+
p << (ch & 63 | 128)
|
188
|
+
elsif ch < 0x10000
|
189
|
+
p << (ch >> 12 | 224)
|
190
|
+
p << (ch >> 6 & 63 | 128)
|
191
|
+
p << (ch & 63 | 128)
|
192
|
+
elsif ch < 0x200000
|
193
|
+
p << (ch >> 18 | 240)
|
194
|
+
p << (ch >> 12 & 63 | 128)
|
195
|
+
p << (ch >> 6 & 63 | 128)
|
196
|
+
p << (ch & 63 | 128)
|
197
|
+
elsif ch < 0x4000000
|
198
|
+
p << (ch >> 24 | 248)
|
199
|
+
p << (ch >> 18 & 63 | 128)
|
200
|
+
p << (ch >> 12 & 63 | 128)
|
201
|
+
p << (ch >> 6 & 63 | 128)
|
202
|
+
p << (ch & 63 | 128)
|
203
|
+
elsif ch < 0x80000000
|
204
|
+
p << (ch >> 30 | 252)
|
205
|
+
p << (ch >> 24 & 63 | 128)
|
206
|
+
p << (ch >> 18 & 63 | 128)
|
207
|
+
p << (ch >> 12 & 63 | 128)
|
208
|
+
p << (ch >> 6 & 63 | 128)
|
209
|
+
p << (ch & 63 | 128)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
ucs4_to_utf8.call(ch_one)
|
214
|
+
ucs4_to_utf8.call(ch_two)
|
215
|
+
|
216
|
+
return lookup_unicode_composition(p)
|
217
|
+
end
|
218
|
+
(class <<self; private :unicode_compose_pair; end)
|
219
|
+
|
220
|
+
def self.unicode_sort_canonical(unpacked)
|
221
|
+
unpacked = unpacked.dup
|
222
|
+
i = 1
|
223
|
+
length = unpacked.length
|
224
|
+
|
225
|
+
return unpacked if length < 2
|
226
|
+
|
227
|
+
while i < length
|
228
|
+
last = unpacked[i-1]
|
229
|
+
ch = unpacked[i]
|
230
|
+
last_cc = lookup_unicode_combining_class(last)
|
231
|
+
cc = lookup_unicode_combining_class(ch)
|
232
|
+
if cc != 0 && last_cc != 0 && last_cc > cc
|
233
|
+
unpacked[i] = last
|
234
|
+
unpacked[i-1] = ch
|
235
|
+
i -= 1 if i > 1
|
236
|
+
else
|
237
|
+
i += 1
|
238
|
+
end
|
239
|
+
end
|
240
|
+
return unpacked
|
241
|
+
end
|
242
|
+
(class <<self; private :unicode_sort_canonical; end)
|
243
|
+
|
244
|
+
def self.unicode_decompose(unpacked)
|
245
|
+
unpacked_result = []
|
246
|
+
for cp in unpacked
|
247
|
+
if cp >= HANGUL_SBASE && cp < HANGUL_SBASE + HANGUL_SCOUNT
|
248
|
+
l, v, t = unicode_decompose_hangul(cp)
|
249
|
+
unpacked_result << l
|
250
|
+
unpacked_result << v if v
|
251
|
+
unpacked_result << t if t
|
252
|
+
else
|
253
|
+
dc = lookup_unicode_compatibility(cp)
|
254
|
+
unless dc
|
255
|
+
unpacked_result << cp
|
256
|
+
else
|
257
|
+
unpacked_result.concat(unicode_decompose(dc.unpack("U*")))
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
return unpacked_result
|
262
|
+
end
|
263
|
+
(class <<self; private :unicode_decompose; end)
|
264
|
+
|
265
|
+
def self.unicode_decompose_hangul(codepoint)
|
266
|
+
sindex = codepoint - HANGUL_SBASE;
|
267
|
+
if sindex < 0 || sindex >= HANGUL_SCOUNT
|
268
|
+
l = codepoint
|
269
|
+
v = t = nil
|
270
|
+
return l, v, t
|
271
|
+
end
|
272
|
+
l = HANGUL_LBASE + sindex / HANGUL_NCOUNT
|
273
|
+
v = HANGUL_VBASE + (sindex % HANGUL_NCOUNT) / HANGUL_TCOUNT
|
274
|
+
t = HANGUL_TBASE + sindex % HANGUL_TCOUNT
|
275
|
+
if t == HANGUL_TBASE
|
276
|
+
t = nil
|
277
|
+
end
|
278
|
+
return l, v, t
|
279
|
+
end
|
280
|
+
(class <<self; private :unicode_decompose_hangul; end)
|
281
|
+
|
282
|
+
def self.lookup_unicode_combining_class(codepoint)
|
283
|
+
codepoint_data = UNICODE_DATA[codepoint]
|
284
|
+
(codepoint_data ?
|
285
|
+
(codepoint_data[UNICODE_DATA_COMBINING_CLASS] || 0) :
|
286
|
+
0)
|
287
|
+
end
|
288
|
+
(class <<self; private :lookup_unicode_combining_class; end)
|
289
|
+
|
290
|
+
def self.lookup_unicode_compatibility(codepoint)
|
291
|
+
codepoint_data = UNICODE_DATA[codepoint]
|
292
|
+
(codepoint_data ?
|
293
|
+
codepoint_data[UNICODE_DATA_COMPATIBILITY] : nil)
|
294
|
+
end
|
295
|
+
(class <<self; private :lookup_unicode_compatibility; end)
|
296
|
+
|
297
|
+
def self.lookup_unicode_lowercase(codepoint)
|
298
|
+
codepoint_data = UNICODE_DATA[codepoint]
|
299
|
+
(codepoint_data ?
|
300
|
+
(codepoint_data[UNICODE_DATA_LOWERCASE] || codepoint) :
|
301
|
+
codepoint)
|
302
|
+
end
|
303
|
+
(class <<self; private :lookup_unicode_lowercase; end)
|
304
|
+
|
305
|
+
def self.lookup_unicode_composition(unpacked)
|
306
|
+
return COMPOSITION_TABLE[unpacked]
|
307
|
+
end
|
308
|
+
(class <<self; private :lookup_unicode_composition; end)
|
309
|
+
|
310
|
+
HANGUL_SBASE = 0xac00
|
311
|
+
HANGUL_LBASE = 0x1100
|
312
|
+
HANGUL_LCOUNT = 19
|
313
|
+
HANGUL_VBASE = 0x1161
|
314
|
+
HANGUL_VCOUNT = 21
|
315
|
+
HANGUL_TBASE = 0x11a7
|
316
|
+
HANGUL_TCOUNT = 28
|
317
|
+
HANGUL_NCOUNT = HANGUL_VCOUNT * HANGUL_TCOUNT # 588
|
318
|
+
HANGUL_SCOUNT = HANGUL_LCOUNT * HANGUL_NCOUNT # 11172
|
319
|
+
|
320
|
+
UNICODE_DATA_COMBINING_CLASS = 0
|
321
|
+
UNICODE_DATA_EXCLUSION = 1
|
322
|
+
UNICODE_DATA_CANONICAL = 2
|
323
|
+
UNICODE_DATA_COMPATIBILITY = 3
|
324
|
+
UNICODE_DATA_UPPERCASE = 4
|
325
|
+
UNICODE_DATA_LOWERCASE = 5
|
326
|
+
UNICODE_DATA_TITLECASE = 6
|
327
|
+
|
328
|
+
begin
|
329
|
+
if defined?(FakeFS)
|
330
|
+
fakefs_state = FakeFS.activated?
|
331
|
+
FakeFS.deactivate!
|
332
|
+
end
|
333
|
+
# This is a sparse Unicode table. Codepoints without entries are
|
334
|
+
# assumed to have the value: [0, 0, nil, nil, nil, nil, nil]
|
335
|
+
UNICODE_DATA = File.open(UNICODE_TABLE, "rb") do |file|
|
336
|
+
Marshal.load(file.read)
|
337
|
+
end
|
338
|
+
ensure
|
339
|
+
if defined?(FakeFS)
|
340
|
+
FakeFS.activate! if fakefs_state
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
COMPOSITION_TABLE = {}
|
345
|
+
for codepoint, data in UNICODE_DATA
|
346
|
+
canonical = data[UNICODE_DATA_CANONICAL]
|
347
|
+
exclusion = data[UNICODE_DATA_EXCLUSION]
|
348
|
+
|
349
|
+
if canonical && exclusion == 0
|
350
|
+
COMPOSITION_TABLE[canonical.unpack("C*")] = codepoint
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
UNICODE_MAX_LENGTH = 256
|
355
|
+
ACE_MAX_LENGTH = 256
|
356
|
+
|
357
|
+
PUNYCODE_BASE = 36
|
358
|
+
PUNYCODE_TMIN = 1
|
359
|
+
PUNYCODE_TMAX = 26
|
360
|
+
PUNYCODE_SKEW = 38
|
361
|
+
PUNYCODE_DAMP = 700
|
362
|
+
PUNYCODE_INITIAL_BIAS = 72
|
363
|
+
PUNYCODE_INITIAL_N = 0x80
|
364
|
+
PUNYCODE_DELIMITER = 0x2D
|
365
|
+
|
366
|
+
PUNYCODE_MAXINT = 1 << 64
|
367
|
+
|
368
|
+
PUNYCODE_PRINT_ASCII =
|
369
|
+
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" +
|
370
|
+
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" +
|
371
|
+
" !\"\#$%&'()*+,-./" +
|
372
|
+
"0123456789:;<=>?" +
|
373
|
+
"@ABCDEFGHIJKLMNO" +
|
374
|
+
"PQRSTUVWXYZ[\\]^_" +
|
375
|
+
"`abcdefghijklmno" +
|
376
|
+
"pqrstuvwxyz{|}~\n"
|
377
|
+
|
378
|
+
# Input is invalid.
|
379
|
+
class PunycodeBadInput < StandardError; end
|
380
|
+
# Output would exceed the space provided.
|
381
|
+
class PunycodeBigOutput < StandardError; end
|
382
|
+
# Input needs wider integers to process.
|
383
|
+
class PunycodeOverflow < StandardError; end
|
384
|
+
|
385
|
+
def self.punycode_encode(unicode)
|
386
|
+
unicode = unicode.to_s unless unicode.is_a?(String)
|
387
|
+
input = unicode.unpack("U*")
|
388
|
+
output = [0] * (ACE_MAX_LENGTH + 1)
|
389
|
+
input_length = input.size
|
390
|
+
output_length = [ACE_MAX_LENGTH]
|
391
|
+
|
392
|
+
# Initialize the state
|
393
|
+
n = PUNYCODE_INITIAL_N
|
394
|
+
delta = out = 0
|
395
|
+
max_out = output_length[0]
|
396
|
+
bias = PUNYCODE_INITIAL_BIAS
|
397
|
+
|
398
|
+
# Handle the basic code points:
|
399
|
+
input_length.times do |j|
|
400
|
+
if punycode_basic?(input[j])
|
401
|
+
if max_out - out < 2
|
402
|
+
raise PunycodeBigOutput,
|
403
|
+
"Output would exceed the space provided."
|
404
|
+
end
|
405
|
+
output[out] = input[j]
|
406
|
+
out += 1
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
410
|
+
h = b = out
|
411
|
+
|
412
|
+
# h is the number of code points that have been handled, b is the
|
413
|
+
# number of basic code points, and out is the number of characters
|
414
|
+
# that have been output.
|
415
|
+
|
416
|
+
if b > 0
|
417
|
+
output[out] = PUNYCODE_DELIMITER
|
418
|
+
out += 1
|
419
|
+
end
|
420
|
+
|
421
|
+
# Main encoding loop:
|
422
|
+
|
423
|
+
while h < input_length
|
424
|
+
# All non-basic code points < n have been
|
425
|
+
# handled already. Find the next larger one:
|
426
|
+
|
427
|
+
m = PUNYCODE_MAXINT
|
428
|
+
input_length.times do |j|
|
429
|
+
m = input[j] if (n...m) === input[j]
|
430
|
+
end
|
431
|
+
|
432
|
+
# Increase delta enough to advance the decoder's
|
433
|
+
# <n,i> state to <m,0>, but guard against overflow:
|
434
|
+
|
435
|
+
if m - n > (PUNYCODE_MAXINT - delta) / (h + 1)
|
436
|
+
raise PunycodeOverflow, "Input needs wider integers to process."
|
437
|
+
end
|
438
|
+
delta += (m - n) * (h + 1)
|
439
|
+
n = m
|
440
|
+
|
441
|
+
input_length.times do |j|
|
442
|
+
# Punycode does not need to check whether input[j] is basic:
|
443
|
+
if input[j] < n
|
444
|
+
delta += 1
|
445
|
+
if delta == 0
|
446
|
+
raise PunycodeOverflow,
|
447
|
+
"Input needs wider integers to process."
|
448
|
+
end
|
449
|
+
end
|
450
|
+
|
451
|
+
if input[j] == n
|
452
|
+
# Represent delta as a generalized variable-length integer:
|
453
|
+
|
454
|
+
q = delta; k = PUNYCODE_BASE
|
455
|
+
while true
|
456
|
+
if out >= max_out
|
457
|
+
raise PunycodeBigOutput,
|
458
|
+
"Output would exceed the space provided."
|
459
|
+
end
|
460
|
+
t = (
|
461
|
+
if k <= bias
|
462
|
+
PUNYCODE_TMIN
|
463
|
+
elsif k >= bias + PUNYCODE_TMAX
|
464
|
+
PUNYCODE_TMAX
|
465
|
+
else
|
466
|
+
k - bias
|
467
|
+
end
|
468
|
+
)
|
469
|
+
break if q < t
|
470
|
+
output[out] =
|
471
|
+
punycode_encode_digit(t + (q - t) % (PUNYCODE_BASE - t))
|
472
|
+
out += 1
|
473
|
+
q = (q - t) / (PUNYCODE_BASE - t)
|
474
|
+
k += PUNYCODE_BASE
|
475
|
+
end
|
476
|
+
|
477
|
+
output[out] = punycode_encode_digit(q)
|
478
|
+
out += 1
|
479
|
+
bias = punycode_adapt(delta, h + 1, h == b)
|
480
|
+
delta = 0
|
481
|
+
h += 1
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
delta += 1
|
486
|
+
n += 1
|
487
|
+
end
|
488
|
+
|
489
|
+
output_length[0] = out
|
490
|
+
|
491
|
+
outlen = out
|
492
|
+
outlen.times do |j|
|
493
|
+
c = output[j]
|
494
|
+
unless c >= 0 && c <= 127
|
495
|
+
raise StandardError, "Invalid output char."
|
496
|
+
end
|
497
|
+
unless PUNYCODE_PRINT_ASCII[c]
|
498
|
+
raise PunycodeBadInput, "Input is invalid."
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
502
|
+
output[0..outlen].map { |x| x.chr }.join("").sub(/\0+\z/, "")
|
503
|
+
end
|
504
|
+
(class <<self; private :punycode_encode; end)
|
505
|
+
|
506
|
+
def self.punycode_decode(punycode)
|
507
|
+
input = []
|
508
|
+
output = []
|
509
|
+
|
510
|
+
if ACE_MAX_LENGTH * 2 < punycode.size
|
511
|
+
raise PunycodeBigOutput, "Output would exceed the space provided."
|
512
|
+
end
|
513
|
+
punycode.each_byte do |c|
|
514
|
+
unless c >= 0 && c <= 127
|
515
|
+
raise PunycodeBadInput, "Input is invalid."
|
516
|
+
end
|
517
|
+
input.push(c)
|
518
|
+
end
|
519
|
+
|
520
|
+
input_length = input.length
|
521
|
+
output_length = [UNICODE_MAX_LENGTH]
|
522
|
+
|
523
|
+
# Initialize the state
|
524
|
+
n = PUNYCODE_INITIAL_N
|
525
|
+
|
526
|
+
out = i = 0
|
527
|
+
max_out = output_length[0]
|
528
|
+
bias = PUNYCODE_INITIAL_BIAS
|
529
|
+
|
530
|
+
# Handle the basic code points: Let b be the number of input code
|
531
|
+
# points before the last delimiter, or 0 if there is none, then
|
532
|
+
# copy the first b code points to the output.
|
533
|
+
|
534
|
+
b = 0
|
535
|
+
input_length.times do |j|
|
536
|
+
b = j if punycode_delimiter?(input[j])
|
537
|
+
end
|
538
|
+
if b > max_out
|
539
|
+
raise PunycodeBigOutput, "Output would exceed the space provided."
|
540
|
+
end
|
541
|
+
|
542
|
+
b.times do |j|
|
543
|
+
unless punycode_basic?(input[j])
|
544
|
+
raise PunycodeBadInput, "Input is invalid."
|
545
|
+
end
|
546
|
+
output[out] = input[j]
|
547
|
+
out+=1
|
548
|
+
end
|
549
|
+
|
550
|
+
# Main decoding loop: Start just after the last delimiter if any
|
551
|
+
# basic code points were copied; start at the beginning otherwise.
|
552
|
+
|
553
|
+
in_ = b > 0 ? b + 1 : 0
|
554
|
+
while in_ < input_length
|
555
|
+
|
556
|
+
# in_ is the index of the next character to be consumed, and
|
557
|
+
# out is the number of code points in the output array.
|
558
|
+
|
559
|
+
# Decode a generalized variable-length integer into delta,
|
560
|
+
# which gets added to i. The overflow checking is easier
|
561
|
+
# if we increase i as we go, then subtract off its starting
|
562
|
+
# value at the end to obtain delta.
|
563
|
+
|
564
|
+
oldi = i; w = 1; k = PUNYCODE_BASE
|
565
|
+
while true
|
566
|
+
if in_ >= input_length
|
567
|
+
raise PunycodeBadInput, "Input is invalid."
|
568
|
+
end
|
569
|
+
digit = punycode_decode_digit(input[in_])
|
570
|
+
in_+=1
|
571
|
+
if digit >= PUNYCODE_BASE
|
572
|
+
raise PunycodeBadInput, "Input is invalid."
|
573
|
+
end
|
574
|
+
if digit > (PUNYCODE_MAXINT - i) / w
|
575
|
+
raise PunycodeOverflow, "Input needs wider integers to process."
|
576
|
+
end
|
577
|
+
i += digit * w
|
578
|
+
t = (
|
579
|
+
if k <= bias
|
580
|
+
PUNYCODE_TMIN
|
581
|
+
elsif k >= bias + PUNYCODE_TMAX
|
582
|
+
PUNYCODE_TMAX
|
583
|
+
else
|
584
|
+
k - bias
|
585
|
+
end
|
586
|
+
)
|
587
|
+
break if digit < t
|
588
|
+
if w > PUNYCODE_MAXINT / (PUNYCODE_BASE - t)
|
589
|
+
raise PunycodeOverflow, "Input needs wider integers to process."
|
590
|
+
end
|
591
|
+
w *= PUNYCODE_BASE - t
|
592
|
+
k += PUNYCODE_BASE
|
593
|
+
end
|
594
|
+
|
595
|
+
bias = punycode_adapt(i - oldi, out + 1, oldi == 0)
|
596
|
+
|
597
|
+
# I was supposed to wrap around from out + 1 to 0,
|
598
|
+
# incrementing n each time, so we'll fix that now:
|
599
|
+
|
600
|
+
if i / (out + 1) > PUNYCODE_MAXINT - n
|
601
|
+
raise PunycodeOverflow, "Input needs wider integers to process."
|
602
|
+
end
|
603
|
+
n += i / (out + 1)
|
604
|
+
i %= out + 1
|
605
|
+
|
606
|
+
# Insert n at position i of the output:
|
607
|
+
|
608
|
+
# not needed for Punycode:
|
609
|
+
# raise PUNYCODE_INVALID_INPUT if decode_digit(n) <= base
|
610
|
+
if out >= max_out
|
611
|
+
raise PunycodeBigOutput, "Output would exceed the space provided."
|
612
|
+
end
|
613
|
+
|
614
|
+
#memmove(output + i + 1, output + i, (out - i) * sizeof *output)
|
615
|
+
output[i + 1, out - i] = output[i, out - i]
|
616
|
+
output[i] = n
|
617
|
+
i += 1
|
618
|
+
|
619
|
+
out += 1
|
620
|
+
end
|
621
|
+
|
622
|
+
output_length[0] = out
|
623
|
+
|
624
|
+
output.pack("U*")
|
625
|
+
end
|
626
|
+
(class <<self; private :punycode_decode; end)
|
627
|
+
|
628
|
+
def self.punycode_basic?(codepoint)
|
629
|
+
codepoint < 0x80
|
630
|
+
end
|
631
|
+
(class <<self; private :punycode_basic?; end)
|
632
|
+
|
633
|
+
def self.punycode_delimiter?(codepoint)
|
634
|
+
codepoint == PUNYCODE_DELIMITER
|
635
|
+
end
|
636
|
+
(class <<self; private :punycode_delimiter?; end)
|
637
|
+
|
638
|
+
def self.punycode_encode_digit(d)
|
639
|
+
d + 22 + 75 * ((d < 26) ? 1 : 0)
|
640
|
+
end
|
641
|
+
(class <<self; private :punycode_encode_digit; end)
|
642
|
+
|
643
|
+
# Returns the numeric value of a basic codepoint
|
644
|
+
# (for use in representing integers) in the range 0 to
|
645
|
+
# base - 1, or PUNYCODE_BASE if codepoint does not represent a value.
|
646
|
+
def self.punycode_decode_digit(codepoint)
|
647
|
+
if codepoint - 48 < 10
|
648
|
+
codepoint - 22
|
649
|
+
elsif codepoint - 65 < 26
|
650
|
+
codepoint - 65
|
651
|
+
elsif codepoint - 97 < 26
|
652
|
+
codepoint - 97
|
653
|
+
else
|
654
|
+
PUNYCODE_BASE
|
655
|
+
end
|
656
|
+
end
|
657
|
+
(class <<self; private :punycode_decode_digit; end)
|
658
|
+
|
659
|
+
# Bias adaptation method
|
660
|
+
def self.punycode_adapt(delta, numpoints, firsttime)
|
661
|
+
delta = firsttime ? delta / PUNYCODE_DAMP : delta >> 1
|
662
|
+
# delta >> 1 is a faster way of doing delta / 2
|
663
|
+
delta += delta / numpoints
|
664
|
+
difference = PUNYCODE_BASE - PUNYCODE_TMIN
|
665
|
+
|
666
|
+
k = 0
|
667
|
+
while delta > (difference * PUNYCODE_TMAX) / 2
|
668
|
+
delta /= difference
|
669
|
+
k += PUNYCODE_BASE
|
670
|
+
end
|
671
|
+
|
672
|
+
k + (difference + 1) * delta / (delta + PUNYCODE_SKEW)
|
673
|
+
end
|
674
|
+
(class <<self; private :punycode_adapt; end)
|
675
|
+
end
|
676
|
+
# :startdoc:
|
677
|
+
end
|