Skip to content
Browse files

Merge pull request #15 from TBAA/master

Added warning on @send_on
  • Loading branch information...
2 parents d717b2c + 6d5d641 commit 3a035e62585bc1d61170f45adc7acc0bcbeda17d @radar radar committed Jan 2, 2012
Showing with 24 additions and 9 deletions.
  1. +24 −9 lib/application_checker.rb
View
33 lib/application_checker.rb
@@ -50,15 +50,15 @@ def check_ar_methods
)
end
end
-
+
def check_validation_on_methods
files = []
-
+
["validate_on_create", "validate_on_update"].each do |v|
lines = grep_for(v, "app/models/")
files += extract_filenames(lines) || []
end
-
+
unless files.empty?
alert(
"Updated syntax for validate_on_* methods",
@@ -68,15 +68,15 @@ def check_validation_on_methods
)
end
end
-
+
def check_before_validation_on_methods
files = []
-
+
%w(before_validation_on_create before_validation_on_update).each do |v|
lines = grep_for(v, "app/models/")
files += extract_filenames(lines) || []
end
-
+
unless files.empty?
alert(
"Updated syntax for before_validation_on_* methods",
@@ -223,7 +223,7 @@ def check_generators
unless generators.empty?
files = generators.reject do |g|
- grep_for("def manifest", g).empty?
+ grep_for("def manifest", g).empty?
end.compact
unless files.empty?
@@ -267,7 +267,7 @@ def check_old_helpers
lines += grep_for("<% .*form_tag.* do.*%>", "app/views/**/*")
lines += grep_for("<% .*fields_for.* do.*%>", "app/views/**/*")
lines += grep_for("<% .*field_set_tag.* do.*%>", "app/views/**/*")
-
+
files = extract_filenames(lines)
if !files.blank?
@@ -343,6 +343,21 @@ def check_old_session_setting
end
end
+ #Check for old ActionMailer :send_on attributes
+ def check_old_action_mailer_send_on_setting
+ files = []
+ lines = grep_for("@sent_on", "app/*")
+ files += extract_filenames(lines) || []
+
+ unless files.empty?
+ alert(
+ "Deprecated ActionMailer attribute :send_on",
+ "This is deprecated without replace.",
+ "http://stackoverflow.com/questions/7367185/weird-error-when-delivering-mail-undefined-method-index-for-2011-09-09-2215",
+ files
+ )
+ end
+ end
private
def grep_for_with_perl_regex(text, where = "./", double_quote = false)
grep_for(text, where, double_quote, true)
@@ -355,7 +370,7 @@ def grep_for_with_perl_regex(text, where = "./", double_quote = false)
def grep_for(text, where = "./", double_quote = false, perl_regex = false)
# If they're on Windows, they probably don't have grep.
@probably_has_grep ||= (Config::CONFIG['host_os'].downcase =~ /mswin|windows|mingw/).nil?
-
+
# protect against double root paths in Rails 3
where.gsub!(Regexp.new(base_path),'')

0 comments on commit 3a035e6

Please sign in to comment.
Something went wrong with that request. Please try again.