提交 01303576 编写于 作者: J Justin Collins

Check initializer for session settings

not just environment.rb
上级 c4041f2d
* Check initializer for session settings
* Add --checks option to list checks
## 0.4.1
* Fix reported line numbers when using new Erubis parser
......
......@@ -3,11 +3,33 @@ require 'checks/base_check'
class CheckSessionSettings < BaseCheck
Checks.add self
SessionSettings = Sexp.new(:colon2, Sexp.new(:const, :ActionController), :Base)
def run_check
settings = tracker.config[:rails] and
tracker.config[:rails][:action_controller] and
tracker.config[:rails][:action_controller][:session]
check_for_issues settings
if tracker.initializers["session_store.rb"]
process tracker.initializers["session_store.rb"]
end
end
def process_attrasgn exp
if exp[1] == SessionSettings and exp[2] == :session= and
hash? exp[3][1]
check_for_issues exp[3][1]
end
exp
end
private
def check_for_issues settings
if settings and hash? settings
hash_iterate settings do |key, value|
if symbol? key
......
......@@ -75,7 +75,7 @@ class Processor
def process_initializer name, src
res = BaseProcessor.new(@tracker).process src
res = AliasProcessor.new.process res
@tracker.initializers[name] = res
@tracker.initializers[Pathname.new(name).basename.to_s] = res
end
#Process source for a library file
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册