diff options
-rwxr-xr-x | .expeditor/run_linux_tests.sh | 2 | ||||
-rw-r--r-- | .expeditor/verify.pipeline.yml | 24 | ||||
-rw-r--r-- | .travis.yml | 28 | ||||
-rw-r--r-- | chef-zero.gemspec | 4 | ||||
-rw-r--r-- | lib/chef_zero/rest_base.rb | 8 | ||||
-rw-r--r-- | lib/chef_zero/rest_request.rb | 8 |
6 files changed, 18 insertions, 56 deletions
diff --git a/.expeditor/run_linux_tests.sh b/.expeditor/run_linux_tests.sh index 4c14c80..2e6c34c 100755 --- a/.expeditor/run_linux_tests.sh +++ b/.expeditor/run_linux_tests.sh @@ -50,4 +50,4 @@ else fi echo "+++ bundle exec task" -bundle exec $1 +bundle exec $@ diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index ba9f28a..4eeef42 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -6,28 +6,10 @@ expeditor: steps: -- label: run-lint-and-specs-ruby-2.4 - command: - - apt-get update - - .expeditor/run_linux_tests.sh rake spec style - expeditor: - executor: - docker: - image: ruby:2.4-buster - -- label: run-lint-and-specs-ruby-2.5 - command: - - apt-get update - - .expeditor/run_linux_tests.sh rake spec style - expeditor: - executor: - docker: - image: ruby:2.5-buster - - label: run-lint-and-specs-ruby-2.6 command: - apt-get update - - .expeditor/run_linux_tests.sh rake spec style + - .expeditor/run_linux_tests.sh rake spec pedant style expeditor: executor: docker: @@ -36,7 +18,7 @@ steps: - label: run-lint-and-specs-ruby-2.7 command: - apt-get update - - .expeditor/run_linux_tests.sh rake spec style + - .expeditor/run_linux_tests.sh rake spec pedant style expeditor: executor: docker: @@ -45,7 +27,7 @@ steps: - label: run-specs-windows command: - bundle install --jobs=7 --retry=3 --without docs debug - - bundle exec rake spec + - bundle exec rake pedant style expeditor: executor: docker: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9edbac1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -# This prevents testing branches that are created just for PRs -branches: - only: - - master - -language: ruby -cache: bundler -bundler_args: --jobs 7 --without debug - -script: - - bundle update - - bundle exec rake pedant - -matrix: - include: - - rvm: 2.5.3 - env: PEDANT_KNIFE_TESTS=true PEDANT_ALLOW_RVM=1 - - rvm: 2.5.3 - env: SINGLE_ORG=true - - rvm: 2.5.3 - env: - - CHEF_FS=true - - "GEMFILE_MOD=\"gem 'ohai', github: 'chef/ohai'; gem 'chef', github: 'chef/chef'\"" - - rvm: 2.5.3 - env: FILE_STORE=true - - rvm: 2.5.3 - script: bundle exec rake chef_spec - env: TEST=chef_spec diff --git a/chef-zero.gemspec b/chef-zero.gemspec index 36406b8..64c2d24 100644 --- a/chef-zero.gemspec +++ b/chef-zero.gemspec @@ -11,10 +11,10 @@ Gem::Specification.new do |s| s.homepage = "https://github.com/chef/chef-zero" s.license = "Apache-2.0" - s.required_ruby_version = ">= 2.4" + s.required_ruby_version = ">= 2.6" s.add_dependency "mixlib-log", ">= 2.0", "< 4.0" - s.add_dependency "hashie", ">= 2.0", "< 4.0" + s.add_dependency "hashie", ">= 2.0", "< 5.0" s.add_dependency "uuidtools", "~> 2.1" s.add_dependency "ffi-yajl", "~> 2.2" s.add_dependency "rack", "~> 2.0", ">= 2.0.6" diff --git a/lib/chef_zero/rest_base.rb b/lib/chef_zero/rest_base.rb index 89c2b12..be50de2 100644 --- a/lib/chef_zero/rest_base.rb +++ b/lib/chef_zero/rest_base.rb @@ -77,7 +77,7 @@ module ChefZero def get_data(request, rest_path = nil, *options) rest_path ||= request.rest_path - rest_path = rest_path.map { |v| URI.decode(v) } + rest_path = rest_path.map { |v| self.class.rfc2396_parser.unescape(v) } begin data_store.get(rest_path, request) rescue DataStore::DataNotFoundError @@ -284,7 +284,7 @@ module ChefZero end def self.build_uri(base_uri, rest_path) - "#{base_uri}/#{rest_path.map { |v| URI.escape(v) }.join("/")}" + "#{base_uri}/#{rest_path.map { |v| rfc2396_parser.escape(v) }.join("/")}" end def populate_defaults(request, response) @@ -324,5 +324,9 @@ module ChefZero name.size > 255 || name =~ /[+ !]/ end + + def self.rfc2396_parser + @parser ||= URI::RFC2396_Parser.new + end end end diff --git a/lib/chef_zero/rest_request.rb b/lib/chef_zero/rest_request.rb index 379cc20..c260316 100644 --- a/lib/chef_zero/rest_request.rb +++ b/lib/chef_zero/rest_request.rb @@ -1,8 +1,8 @@ require "rack/request" +require "cgi" module ChefZero class RestRequest - def initialize(env, rest_base_prefix = []) @env = env @rest_base_prefix = rest_base_prefix @@ -61,7 +61,7 @@ module ChefZero @query_params ||= begin params = Rack::Request.new(env).GET params.keys.each do |key| - params[key] = URI.unescape(params[key]) + params[key] = self.class.rfc2396_parser.unescape(params[key]) end params end @@ -80,5 +80,9 @@ module ChefZero end result end + + def self.rfc2396_parser + @parser ||= URI::RFC2396_Parser.new + end end end |