lib/chef-dk/cli.rb in chef-dk-4.1.7 vs lib/chef-dk/cli.rb in chef-dk-4.2.0
- old
+ new
@@ -118,10 +118,11 @@
msg("\nAvailable Commands:")
justify_length = subcommands.map(&:length).max + 2
subcommand_specs.each do |name, spec|
next if spec.hidden
+
msg(" #{"#{name}".ljust(justify_length)}#{spec.description}")
end
end
def exit(n)
@@ -153,11 +154,11 @@
end
private
def normalized_exit_code(maybe_integer)
- if maybe_integer.kind_of?(Integer) && (0..255).cover?(maybe_integer)
+ if maybe_integer.is_a?(Integer) && (0..255).cover?(maybe_integer)
maybe_integer
else
0
end
end
@@ -184,9 +185,10 @@
# when they have the embedded_bin_dir before the omnibus_bin_dir -- both of which will
# defeat appbundler and interact very badly with our intent.
def sanity_check!
# When installed outside of omnibus, trust the user to configure their PATH
return true unless omnibus_install?
+
paths = env[path_key].split(File::PATH_SEPARATOR)
paths.map! { |p| drive_upcase(Chef::Util::PathHelper.cleanpath(p)) }
embed_index = paths.index(drive_upcase(Chef::Util::PathHelper.cleanpath(omnibus_embedded_bin_dir)))
bin_index = paths.index(drive_upcase(Chef::Util::PathHelper.cleanpath(omnibus_bin_dir)))
if embed_index