github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

cldwalker / thor-tasks

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 5
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: 43fe7d7

click here to add a description

click here to add a homepage

  • Branches (1)
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

My personal thor tasks — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

gh_pages tweaks: added related posts, machinetag project 
cldwalker (author)
Fri May 01 15:28:48 -0700 2009
commit  43fe7d7ddfd2bd17595c7665c635fb9dd3a0301a
tree    fbb03ee86ea3aeab4ca0b7615d5117ad56e54305
parent  079d1202d0a7590df424b94a529227faaa5891ae
thor-tasks / check.thor check.thor
100644 58 lines (54 sloc) 2.018 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Ported from http://github.com/drnic/sake-tasks/tree/master/check
# with option modifications
 
class Check < Thor
  desc "ruby", "Find all .rb files in the current directory tree and report any syntax errors"
  method_options :verbose=>:boolean, :extension=>:optional
  def ruby
    require 'open3'
    Dir["**/*.#{options[:extension] || 'rb'}"].each do |file|
      next if file.match("vendor/rails")
      next if file.match("vendor/plugins/.*/generators/.*/templates")
      puts file if options[:verbose]
      Open3.popen3("ruby -c #{file}") do |stdin, stdout, stderr|
        error = stderr.readline rescue false
        puts "#{file}:#{(error.match(/on line (\d+)/)[1] + ':') rescue nil} #{error}" if error
        stdin.close rescue false
        stdout.close rescue false
        stderr.close rescue false
      end
    end
  end
 
  desc 'erb', "Find all .erb or .rhtml files in the current directory tree and report any syntax errors"
  method_options :verbose=>:boolean
  def erb
    require 'erb'
    require 'open3'
    (Dir["**/*.erb"] + Dir["**/*.rhtml"]).each do |file|
      next if file.match("vendor/rails")
      puts file if options[:verbose]
      Open3.popen3('ruby -c') do |stdin, stdout, stderr|
        stdin.puts(ERB.new(File.read(file), nil, '-').src)
        stdin.close
        error = stderr.readline rescue false
        puts "#{file}:#{(error.match(/on line (\d+)/)[1] + ':') rescue nil} #{error}" if error
        puts error if error
        stdout.close rescue false
        stderr.close rescue false
      end
    end
  end
 
  desc 'yaml', "Find all .yml files in the current directory tree and report any syntax errors"
  method_options :verbose=>:boolean
  def yaml
    require 'yaml'
    Dir['**/*.yml'].each do |file|
      puts file if options[:verbose]
      next if file.match("vendor/rails")
      begin
        YAML.load_file(file)
      rescue => e
        puts "#{file}:#{(e.message.match(/on line (\d+)/)[1] + ':') rescue nil} #{e.message}"
      end
    end
  end
end
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server