Rename for tabcompletion-friendliness.

This commit is contained in:
☈king 2012-11-14 22:37:37 -07:00 committed by rking@sharpsaw.org
parent 7a5d21ba74
commit 848b6bdbeb
54 changed files with 26 additions and 21 deletions

View File

@ -3,14 +3,16 @@ require 'guard/guard'
module ::Guard
class Bacon < Guard
def run_all
system "bundle exec bacon -Itest -q -a"
system "rake spec"
puts
true
end
def run_spec(path)
if File.exists?(path)
@success &&= system "bundle exec bacon -Itest -q #{path}"
cmd = "bundle exec bacon -Ispec -q #{path}"
puts cmd
@success &&= system cmd
puts
end
end
@ -33,32 +35,32 @@ module ::Guard
end
guard 'bacon' do
def deduce_test_from(token)
"test/test_#{token}.rb"
def deduce_spec_from(token)
"spec/#{token}_spec.rb"
end
Dir['lib/pry/*.rb'].each do |rb|
rb[%r(lib/pry/(.+)\.rb$)]
test_rb = deduce_test_from $1
if File.exists?(test_rb)
watch(rb) { test_rb }
spec_rb = deduce_spec_from $1
if File.exists?(spec_rb)
watch(rb) { spec_rb }
else
exempt = %w(
commands
version
).map {|token| deduce_test_from token}
puts 'Missing ' + test_rb if
ENV['WANT_TEST_COMPLAINTS'] and not exempt.include?(test_rb)
).map {|token| deduce_spec_from token}
puts 'Missing ' + spec_rb if
ENV['WANT_SPEC_COMPLAINTS'] and not exempt.include?(spec_rb)
end
end
watch(%r{^lib/pry/commands/([^.]+)\.rb}) { |m| "test/test_commands/test_#{m[1]}.rb" }
watch(%r{^lib/pry/commands/([^.]+)\.rb}) { |m| "spec/commands/#{m[1]}_spec.rb" }
# If no such mapping exists, just run all of them
watch(%r{^lib/}) { :all }
# If we modified one test file, run it
watch(%r{^test.*/test_.+\.rb$})
# If we modified one spec file, run it
watch(%r{^spec/.+\.rb$})
end
# vim:ft=ruby

View File

@ -18,7 +18,7 @@ def apply_spec_defaults(s)
s.homepage = 'http://pry.github.com'
s.executables = ['pry']
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- test/*`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")
s.add_dependency('coderay', '~> 1.0.5')
s.add_dependency('slop', ['~> 3.3.1'])
s.add_dependency('method_source','~> 0.8')
@ -47,8 +47,11 @@ task :default => [:test]
desc "Run tests"
task :test do
check_dependencies unless ENV['SKIP_DEP_CHECK']
sh "bacon -Itest -rubygems -a -q"
all_specs = Dir['spec/**/*_spec.rb']
all_specs.shuffle! if all_specs.respond_to? :shuffle!
sh "bacon -Ispec -rubygems -a -q #{all_specs.join ' '}"
end
task :spec => :test
desc "Run pry"
task :pry do

View File

@ -36,13 +36,13 @@ describe Pry::Code do
end
should 'check for files relative to origin pwd' do
Dir.chdir('test') do |f|
Pry::Code.from_file('test/' + File.basename(__FILE__)).code_type.should == :ruby
Dir.chdir('spec') do |f|
Pry::Code.from_file('spec/' + File.basename(__FILE__)).code_type.should == :ruby
end
end
should 'find files that are relative to the current working directory' do
Dir.chdir('test') do |f|
Dir.chdir('spec') do |f|
Pry::Code.from_file(File.basename(__FILE__)).code_type.should == :ruby
end
end

View File

@ -56,7 +56,7 @@ describe "whereami" do
it 'should show description and correct code when __LINE__ and __FILE__ are outside @method.source_location' do
class Cor
def blimey!
eval <<-END, binding, "test/test_commands/example.erb", 1
eval <<-END, binding, "spec/cmd/example.erb", 1
pry_eval(binding, 'whereami')
END
end
@ -70,7 +70,7 @@ describe "whereami" do
it 'should show description and correct code when @method.source_location would raise an error' do
class Cor
eval <<-END, binding, "test/test_commands/example.erb", 1
eval <<-END, binding, "spec/cmd/example.erb", 1
def blimey!
pry_eval(binding, 'whereami')
end

View File

@ -276,7 +276,7 @@ OUTPUT
end
describe "nesting" do
test = File.read("test/example_nesting.rb")
test = File.read("spec/example_nesting.rb")
test.lines.each_with_index do |line, i|
result = line.split("#").last.strip