xref: /freebsd/contrib/file/magic/Magdir/ruby (revision 792bbaba989533a1fc93823df1720c8c4aaf0442)
1
2#------------------------------------------------------------------------------
3# $File: ruby,v 1.6 2016/07/27 09:46:29 rrt Exp $
4# ruby:  file(1) magic for Ruby scripting language
5# URL:  http://www.ruby-lang.org/
6# From: Reuben Thomas <rrt@sc3d.org>
7
8# Ruby scripts
90	search/1/w	#!\ /usr/bin/ruby	Ruby script text executable
10!:strength + 15
11!:mime text/x-ruby
120	search/1/w	#!\ /usr/local/bin/ruby	Ruby script text executable
13!:strength + 15
14!:mime text/x-ruby
150	search/1	#!/usr/bin/env\ ruby	Ruby script text executable
16!:strength + 15
17!:mime text/x-ruby
180	search/1	#!\ /usr/bin/env\ ruby	Ruby script text executable
19!:strength + 15
20!:mime text/x-ruby
21
22# What looks like ruby, but does not have a shebang
23# (modules and such)
24# From: Lubomir Rintel <lkundrak@v3.sk>
250	regex		\^[\ \t]*require[\ \t]'[A-Za-z_/]+'
26>0	regex		include\ [A-Z]|def\ [a-z]|\ do$
27>>0	regex		\^[\ \t]*end([\ \t]*[;#].*)?$		Ruby script text
28!:mime	text/x-ruby
290	regex		\^[\ \t]*(class|module)[\ \t][A-Z]
30>0	regex		(modul|includ)e\ [A-Z]|def\ [a-z]
31>>0	regex		\^[\ \t]*end([\ \t]*[;#].*)?$		Ruby module source text
32!:mime	text/x-ruby
33