summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-01-23 18:30:56 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2020-01-23 18:30:56 -0800
commita03803284313244dc936137521fdb3b39de3fe9b (patch)
tree36d6e7bcdd83c2b802a99c622f1d19d0584c2d85
parentca5cf342b9d63118b9d2248d0fa516b87d9cb0a1 (diff)
downloadchef-a03803284313244dc936137521fdb3b39de3fe9b.tar.gz
Ruby 2.7 IRB and remaining fixes
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/chef_class.rb10
-rw-r--r--lib/chef/shell.rb22
-rw-r--r--spec/functional/shell_spec.rb4
3 files changed, 29 insertions, 7 deletions
diff --git a/lib/chef/chef_class.rb b/lib/chef/chef_class.rb
index dc87ebd271..edc229f203 100644
--- a/lib/chef/chef_class.rb
+++ b/lib/chef/chef_class.rb
@@ -1,6 +1,6 @@
#
# Author:: Lamont Granquist (<lamont@chef.io>)
-# Copyright:: Copyright 2015-2018, Chef Software Inc.
+# Copyright:: Copyright 2015-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -97,8 +97,8 @@ class Chef
#
# @return [Array<Class>] Modified Priority Array of Provider Classes to use for the resource_name on the node
#
- def set_provider_priority_array(resource_name, priority_array, *filter, &block)
- result = provider_priority_map.set_priority_array(resource_name.to_sym, priority_array, *filter, &block)
+ def set_provider_priority_array(resource_name, priority_array, **filter, &block)
+ result = provider_priority_map.set_priority_array(resource_name.to_sym, priority_array, **filter, &block)
result = result.dup if result
result
end
@@ -112,8 +112,8 @@ class Chef
#
# @return [Array<Class>] Modified Priority Array of Resource Classes to use for the resource_name on the node
#
- def set_resource_priority_array(resource_name, priority_array, *filter, &block)
- result = resource_priority_map.set_priority_array(resource_name.to_sym, priority_array, *filter, &block)
+ def set_resource_priority_array(resource_name, priority_array, **filter, &block)
+ result = resource_priority_map.set_priority_array(resource_name.to_sym, priority_array, **filter, &block)
result = result.dup if result
result
end
diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb
index 68c286abb1..e5f7dc64b9 100644
--- a/lib/chef/shell.rb
+++ b/lib/chef/shell.rb
@@ -61,6 +61,11 @@ module Shell
# to get access to the main object before irb starts.
::IRB.setup(nil)
+ irb_conf[:USE_COLORIZE] = options.config[:use_colorize]
+ irb_conf[:USE_SINGLELINE] = options.config[:use_singleline]
+ irb_conf[:USE_MULTILINE] = options.config[:use_multiline]
+ pp irb_conf[:USE_MULTILINE]
+
irb = IRB::Irb.new
if solo_mode?
@@ -127,6 +132,8 @@ module Shell
conf.prompt_n = "#{Chef::Dist::EXEC}#{leader(m)} ?> "
conf.prompt_s = "#{Chef::Dist::EXEC}#{leader(m)}%l> "
conf.use_tracer = false
+ conf.instance_variable_set(:@use_multiline, false)
+ conf.instance_variable_set(:@use_singleline, false)
end
end
@@ -219,6 +226,21 @@ module Shell
#{Chef::Dist::USER_CONF_DIR}/knife.rb if -s option is given.
FOOTER
+ option :use_multiline,
+ long: "--[no-]multiline",
+ default: true,
+ description: "[Do not] use multiline editor module"
+
+ option :use_singleline,
+ long: "--[no-]singleline",
+ default: true,
+ description: "[Do not] use singleline editor module"
+
+ option :use_colorize,
+ long: "--[no-]colorize",
+ default: true,
+ description: "[Do not] use colorization"
+
option :config_file,
short: "-c CONFIG",
long: "--config CONFIG",
diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb
index dd0455fc9e..cb4fd92681 100644
--- a/spec/functional/shell_spec.rb
+++ b/spec/functional/shell_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Daniel DeLeo (<dan@chef.io>)
-# Copyright:: Copyright 2012-2019, Chef Software Inc.
+# Copyright:: Copyright 2012-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -82,7 +82,7 @@ describe Shell do
require "pty"
config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA)
- reader, writer, pid = PTY.spawn("bundle exec chef-shell -c #{config} #{options}")
+ reader, writer, pid = PTY.spawn("bundle exec chef-shell --no-multiline --no-singleline --no-colorize -c #{config} #{options}")
read_until(reader, "chef (#{Chef::VERSION})>")
yield reader, writer if block_given?
writer.puts('"done"')