Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/flay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def self.default_options
:liberal => false,
:fuzzy => false,
:only => nil,
:ext => nil,
}
end

Expand Down Expand Up @@ -113,6 +114,11 @@ def self.parse_options args = ARGV
options[:timeout] = t.to_i
end

opts.on("-x", "--ext EXTENSION", String,
"Use specified file type, regardless of filename.") do |s|
options[:ext] = s
end

extensions = ["rb"] + Flay.load_plugins

opts.separator ""
Expand Down Expand Up @@ -186,8 +192,12 @@ def process(*files) # TODO: rename from process - should act as SexpProcessor
files.each do |file|
warn "Processing #{file}" if option[:verbose]

ext = File.extname(file).sub(/^\./, "")
ext = "rb" if ext.nil? || ext.empty?
if option[:ext] then
ext = option[:ext]
else
ext = File.extname(file).sub(/^\./, "")
ext = "rb" if ext.nil? || ext.empty?
end
msg = "process_#{ext}"

unless respond_to? msg then
Expand Down