-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.lisp
executable file
·29 lines (24 loc) · 899 Bytes
/
models.lisp
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
#!/usr/bin/sbcl --script
(defvar *results* '())
(defvar *filenames*
(directory "/home/jacek/Programming/work/vps/app/models/*.rb"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun process-line (file line count)
(if (search "ActiveRecord" line) (format T "+++ ~A~%" line))
(if (or (search "belongs_to" line)
(search "has_one" line)
(search "has_many" line)
(search "has_and" line))
(format T "~A~%" line)
(format nil "------------- ~A~%" line)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun main (filenames)
(let ((count 0))
(loop for f in filenames do
(setq count (+ 1 count))
(with-open-file (stream f )
(do ((line (read-line stream nil)
(read-line stream nil)))
((null line))
(process-line f line count) ) ))))
(main (directory "/home/jacek/Programming/work/vps/app/models/*.rb"))