Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'find'
- require 'fileutils'
- $to_list = ['ruby', 'eruby', 'eruby-rails', 'html', 'javascript', 'javascript=jquery', 'ruby-rails', 'ruby-rails-rjs', 'ruby-rspec']
- def in_list?(name)
- $to_list.any? { |el| name =~ /#{el}/ }
- end
- def snippet?(name)
- name =~ /(\/.+\.snippet$)/
- end
- Find.find(ARGV[0]) do |f|
- if File.directory?(f) && in_list?(f)
- puts f.upcase
- (f.length + 3).times { print "=" }
- puts ""
- end
- if File.file?(f) && in_list?(f) && snippet?(f)
- f =~ /(\w+)\.snippet$/
- puts $1
- ($1.length + 3).times { print "=" }
- puts ""
- File.open(f).each_line { |line| puts line }
- puts "\n"
- end
- end
Add Comment
Please, Sign In to add comment