Skip to content

Commit

Permalink
Fixed spec:stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Stastny aka Botanicus committed Mar 22, 2010
1 parent 357b899 commit 67d82b0
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions lib/nake/tasks/spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ./tasks.rb spec/nake/argv_spec.rb spec/nake/task_spec.rb
task(:spec) do |*paths, options|
paths.push("spec") if paths.empty?
sh "spec #{paths.join(" ")}"
sh "spec", *paths
end

Task.new("spec:stubs") do |task|
Expand All @@ -12,18 +12,8 @@
Dir.glob("lib/**/*.rb").each do |file|
specfile = file.sub(/^lib/, "spec").sub(/\.rb$/, '_spec.rb')
unless File.exist?(specfile)
%x[mkdir -p #{File.dirname(specfile)}]
%x[touch #{specfile}]
puts "Created #{specfile}"
end
end
(Dir.glob("spec/rango/**/*.rb") + ["spec/rango_spec.rb"]).each do |file|
libfile = file.sub(/spec/, "lib").sub(/_spec\.rb$/, '.rb')
if !File.exist?(libfile) && File.zero?(file)
%x[rm #{file}]
puts "Removed empty file #{file}"
elsif !File.exist?(libfile)
puts "File exists just in spec, not in lib: #{file}"
sh "mkdir -p #{File.dirname(specfile)}"
sh "touch #{specfile}"
end
end
end
Expand Down

0 comments on commit 67d82b0

Please sign in to comment.