TextMate command - run DocTest


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #!/usr/bin/env ruby
  2.  
  3. $LOAD_PATH << "#{ENV["TM_SUPPORT_PATH"]}/lib"
  4. require "web_preview"
  5.  
  6. class SymfonyDocTest
  7.  
  8. attr_reader :root_dir, :test_file
  9.  
  10. def initialize(args=ENV)
  11. @root_dir = ENV['TM_PROJECT_DIRECTORY']
  12. @test_file = ENV['TM_FILEPATH']
  13. end
  14.  
  15. def appname
  16. 'frontend'
  17. end
  18.  
  19. def test_file
  20. @test_file.split(@root_dir +'/')
  21. end
  22.  
  23. def run
  24. Dir.chdir @root_dir do
  25. system "symfony doctest #{appname} #{@test_file}"
  26. end
  27. end
  28. end
  29.  
  30. dt = SymfonyDocTest.new
  31.  
  32. html_header "DocTest - #{dt.test_file}"
  33. puts "<pre><code>"
  34. dt.run
  35. puts "</code></pre>"
  36. html_footer

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.