代码拉取完成,页面将自动刷新
require 'pry'
class ConsoleCLI < Thor
def self.to_s
'Console'
end
def initialize(*args)
trap('INT') { puts; exit } # exit on ^C
super
end
default_command :default
desc '', 'Start a REPL'
def default
Pry.start
end
desc 'docs', 'Start a REPL in the "Docs" module'
def docs
require 'docs'
Docs.pry
end
end
Pry::Commands.create_command 'test' do
description 'Run tests in the "test" directory'
group 'Testing'
banner <<-BANNER
Usage: test [<path>]
If <path> is a file, run it ("_test.rb" suffix is optional).
If <path> is a directory, run all test files inside it.
Default to all test files.
BANNER
def process
if pattern = args.first
pattern.prepend 'test/'
if File.directory?(pattern)
pattern << '/**/*_test.rb'
elsif File.extname(pattern).empty?
pattern << '*_test.rb'
end
else
pattern = 'test/**/*_test.rb'
end
paths = Dir.glob(pattern).map(&File.method(:expand_path))
if paths.empty?
output.puts 'No test files found.'
return
end
pid = fork do
begin
$LOAD_PATH.unshift 'test'
paths.each(&method(:require))
rescue Exception => e
_pry_.last_exception = e
run 'wtf?'
exit!
end
end
Process.wait(pid)
end
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。