Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ruby_file?(file)
- !!file.readlines[0].match(/#!.*ruby/) || File.extname(file.path) == ".rb"
- end
- def bash_file?(file)
- !!file.readlines[0].match(/#!.*bash/) || File.extname(file.path) == ".sh"
- end
- def valid?(file_name)
- system('ruby', '-c', file_name)
- end
- def valid?(file_name)
- system('bash', '-n', file_name)
- end
- Dir["**/*"].each do |file_name|
- file = File.new file_name
- next if file.binmode? || !ruby_file?(file) # || !bash_file?(file)
- puts "#{file_name}: #{valid? file_name}"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement