Sha256: c9ff59ca1471b9507e79d13ef17f6d845a80530e11a1b20e526ae809bb8579e1
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
#!/usr/bin/env ruby require 'clip' require 'bad_encodings' options = Clip do |p| p.optional 'e', 'file-extensions', :desc => %Q{Set file extensions to search (comma-separated). E.g. 'rb,yml'. To search all files, just pass a comma ','}, :multi => true, :default => "rb,rake,haml,sass,erb" p.flag 'v', 'verbose', :desc => 'Make it chatty.' end if options.valid? && !options.remainder.empty? ENV['VERBOSE'] = 'true' if options.verbose? paths = [] options.remainder.each do |dir| paths << [File.expand_path(dir), dir] if File.exists?(dir) end else $stderr.puts "find_bad_encodings dir1 [dir2 ...] [options]\n" + options.to_s exit end raise ArgumentError, "Requires Ruby 1.9" unless RUBY_VERSION > '1.9' bad_lines = [] paths.each do |path| bad_lines += BadEncodings.find_lines_in_path(path[0], options.file_extensions).map! {|bl| [bl[0].sub(path[0],path[1]), bl[1]] } end unless bad_lines.empty? puts 'The following bad encodings were found:' bad_lines.each do |line| puts "[%s:%d]" % [line[0], line[1]] end else puts 'No bad encodings found' end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bad_encodings-ruby19-1.0.0 | bin/find_bad_encodings |