class Chef::Knife::RoleTest
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/role_test.rb, line 31 def run test_path = "#{::KnifeRoleTest.root}/lib/knife_role_test/roles.rb" env_vars = { "KRT_ROLE_PATH" => Chef::Config[:role_path] } Open3.popen3(env_vars, test_path, *test_args) do |stdin, stdout, stderr, wait_thr| stderr_text = stderr.read stdout_text = stdout.read puts stderr_text puts stdout_text stdout_text end end
test_args()
click to toggle source
# File lib/chef/knife/role_test.rb, line 20 def test_args if config[:all] [] elsif name_args.size > 0 ['-n', "/#{test_pattern}/"] else ui.fatal "Must specify -a or some roles" exit 1 end end
test_pattern()
click to toggle source
# File lib/chef/knife/role_test.rb, line 16 def test_pattern name_args.map {|x| "^test_role_#{Regexp.escape(x)}$" }.join('|') end