diff --git a/vendor/plugins/active_record_validations_delete/init.rb b/vendor/plugins/active_record_validations_delete/init.rb deleted file mode 100644 index 475c3b2..0000000 --- a/vendor/plugins/active_record_validations_delete/init.rb +++ /dev/null @@ -1,9 +0,0 @@ -# monkey patch to remove a single error from the errors collection -# http://dev.rubyonrails.org/ticket/8137 - -ActiveRecord::Errors.module_eval do - # remove a single error from the errors collection by key - def delete(key) - @errors.delete(key.to_s) - end -end diff --git a/vendor/plugins/attachment_fu_validates_attachment/init.rb b/vendor/plugins/attachment_fu_validates_attachment/init.rb deleted file mode 100644 index 1e8a949..0000000 --- a/vendor/plugins/attachment_fu_validates_attachment/init.rb +++ /dev/null @@ -1,34 +0,0 @@ -# friendlier attachment validations by Tim Lucas -# ref.: http://toolmantim.com/article/2007/12/3/rollin_your_own_attachment_fu_messages_evil_twin_stylee - -Technoweenie::AttachmentFu::InstanceMethods.module_eval do - protected - def attachment_valid? - if self.filename.nil? - errors.add :empty, attachment_validation_options[:empty] - return - end - [:content_type, :size].each do |option| - if attachment_validation_options[option] && attachment_options[option] && !attachment_options[option].include?(self.send(option)) - errors.add option, attachment_validation_options[option] - end - end - end -end - -Technoweenie::AttachmentFu::ClassMethods.module_eval do - # Options: - # * :empty - Base error message when no file is uploaded. Default is "No file uploaded" - # * :content_type - Base error message when the uploaded file is not a valid content type. - # * :size - Base error message when the uploaded file is not a valid size. - # - # Example: - # validates_attachment :content_type => "The file you uploaded was not a JPEG, PNG or GIF", - # :size => "The image you uploaded was larger than the maximum size of 10MB" - def validates_attachment(options={}) - options[:empty] ||= "No file uploaded" - class_inheritable_accessor :attachment_validation_options - self.attachment_validation_options = options - validate :attachment_valid? - end -end diff --git a/vendor/plugins/monkey_patches/active_record_validations_delete/init.rb b/vendor/plugins/monkey_patches/active_record_validations_delete/init.rb new file mode 100644 index 0000000..475c3b2 --- /dev/null +++ b/vendor/plugins/monkey_patches/active_record_validations_delete/init.rb @@ -0,0 +1,9 @@ +# monkey patch to remove a single error from the errors collection +# http://dev.rubyonrails.org/ticket/8137 + +ActiveRecord::Errors.module_eval do + # remove a single error from the errors collection by key + def delete(key) + @errors.delete(key.to_s) + end +end diff --git a/vendor/plugins/monkey_patches/attachment_fu_validates_attachment/init.rb b/vendor/plugins/monkey_patches/attachment_fu_validates_attachment/init.rb new file mode 100644 index 0000000..1e8a949 --- /dev/null +++ b/vendor/plugins/monkey_patches/attachment_fu_validates_attachment/init.rb @@ -0,0 +1,34 @@ +# friendlier attachment validations by Tim Lucas +# ref.: http://toolmantim.com/article/2007/12/3/rollin_your_own_attachment_fu_messages_evil_twin_stylee + +Technoweenie::AttachmentFu::InstanceMethods.module_eval do + protected + def attachment_valid? + if self.filename.nil? + errors.add :empty, attachment_validation_options[:empty] + return + end + [:content_type, :size].each do |option| + if attachment_validation_options[option] && attachment_options[option] && !attachment_options[option].include?(self.send(option)) + errors.add option, attachment_validation_options[option] + end + end + end +end + +Technoweenie::AttachmentFu::ClassMethods.module_eval do + # Options: + # * :empty - Base error message when no file is uploaded. Default is "No file uploaded" + # * :content_type - Base error message when the uploaded file is not a valid content type. + # * :size - Base error message when the uploaded file is not a valid size. + # + # Example: + # validates_attachment :content_type => "The file you uploaded was not a JPEG, PNG or GIF", + # :size => "The image you uploaded was larger than the maximum size of 10MB" + def validates_attachment(options={}) + options[:empty] ||= "No file uploaded" + class_inheritable_accessor :attachment_validation_options + self.attachment_validation_options = options + validate :attachment_valid? + end +end diff --git a/vendor/plugins/monkey_patches/schema_dumper_sort_indexes/init.rb b/vendor/plugins/monkey_patches/schema_dumper_sort_indexes/init.rb new file mode 100644 index 0000000..aa6a5e1 --- /dev/null +++ b/vendor/plugins/monkey_patches/schema_dumper_sort_indexes/init.rb @@ -0,0 +1,22 @@ +# based on https://rails.lighthouseapp.com/projects/8994/tickets/1266-order-add_index-statements-in-schemarb +# only needed for rails < 2.2 +if Rails::VERSION::STRING < "2.2.0" + class ActiveRecord::SchemaDumper + def indexes(table, stream) + if (indexes = @connection.indexes(table)).any? + + add_index_statements = indexes.map do |index| + statment_parts = [ ('add_index ' + index.table.inspect) ] + statment_parts << index.columns.inspect + statment_parts << (':name => ' + index.name.inspect) + statment_parts << ':unique => true' if index.unique + + ' ' + statment_parts.join(', ') + end + + stream.puts add_index_statements.sort.join("\n") + stream.puts + end + end + end +end diff --git a/vendor/plugins/monkey_patches/touch/init.rb b/vendor/plugins/monkey_patches/touch/init.rb new file mode 100644 index 0000000..df721a4 --- /dev/null +++ b/vendor/plugins/monkey_patches/touch/init.rb @@ -0,0 +1,13 @@ +if ActiveRecord::Base.instance_methods.include?("touch") && Class.const_defined?('TOUCH_LOADED') + puts "W: ActiveRecord already provides a touch method, which means you must be using rails 2.3.3 or later." + puts "W: In this case the touch plugin could probably be removed" +end +TOUCH_LOADED = true + +module Touch + def touch + update_attribute(:updated_at, Time.now) + end +end + +ActiveRecord::Base.send(:include, Touch) diff --git a/vendor/plugins/monkey_patches/white_list_sanitizer_unescape_before_reescape/init.rb b/vendor/plugins/monkey_patches/white_list_sanitizer_unescape_before_reescape/init.rb new file mode 100644 index 0000000..a5105ca --- /dev/null +++ b/vendor/plugins/monkey_patches/white_list_sanitizer_unescape_before_reescape/init.rb @@ -0,0 +1,35 @@ +# monkey patch to fix WhiteListSanitizer bug +# http://apidock.com/rails/HTML/WhiteListSanitizer/process_attributes_for +# +# this was solved in rails 2.2.1, then remove this patch when upgrade to it + +HTML::WhiteListSanitizer.module_eval do + + def sanitize_with_filter_fixes(*args, &block) + text = sanitize_without_filter_fixes(*args, &block) + if text + final_text = text.gsub(/<!/, '(.*)/, '\1') #FIX for itheora comments + + final_text = final_text.gsub(/&quot;/, '"') #FIX problems with archive.org + final_text + end + end + alias_method_chain :sanitize, :filter_fixes + + # unescape before reescape to avoid: + # & -> & -> &amp; -> &amp;amp; -> &amp;amp;amp; -> etc + protected + def process_attributes_for(node, options) + return unless node.attributes + node.attributes.keys.each do |attr_name| + value = node.attributes[attr_name].to_s + + if !options[:attributes].include?(attr_name) || contains_bad_protocols?(attr_name, value) + node.attributes.delete(attr_name) + else + node.attributes[attr_name] = attr_name == 'style' ? sanitize_css(value) : CGI::escapeHTML(value.gsub('&', '&')) + end + end + end +end diff --git a/vendor/plugins/monkey_patches/will_paginate_check_finder_sql/init.rb b/vendor/plugins/monkey_patches/will_paginate_check_finder_sql/init.rb new file mode 100644 index 0000000..73a5496 --- /dev/null +++ b/vendor/plugins/monkey_patches/will_paginate_check_finder_sql/init.rb @@ -0,0 +1,18 @@ +# monkey patch to fix WillPaginate bug +# this was solved in will_paginate 3.x.pre, then remove this patch when upgrade to it +# +# http://sod.lighthouseapp.com/projects/17958/tickets/120-paginate-association-with-finder_sql-raises-typeerror +require 'will_paginate' + +WillPaginate::Finder::ClassMethods.module_eval do + def paginate_with_finder_sql(*args) + if respond_to?(:proxy_reflection) && !proxy_reflection.options[:finder_sql].nil? + # note: paginate_by_sql ignores the blocks. So don't pass the block + paginate_by_sql(@finder_sql, args.extract_options!) + else + paginate_without_finder_sql(*args) + end + end + # patch to deal with the custom_sql scenario + alias_method_chain :paginate, :finder_sql +end diff --git a/vendor/plugins/schema_dumper_sort_indexes/init.rb b/vendor/plugins/schema_dumper_sort_indexes/init.rb deleted file mode 100644 index aa6a5e1..0000000 --- a/vendor/plugins/schema_dumper_sort_indexes/init.rb +++ /dev/null @@ -1,22 +0,0 @@ -# based on https://rails.lighthouseapp.com/projects/8994/tickets/1266-order-add_index-statements-in-schemarb -# only needed for rails < 2.2 -if Rails::VERSION::STRING < "2.2.0" - class ActiveRecord::SchemaDumper - def indexes(table, stream) - if (indexes = @connection.indexes(table)).any? - - add_index_statements = indexes.map do |index| - statment_parts = [ ('add_index ' + index.table.inspect) ] - statment_parts << index.columns.inspect - statment_parts << (':name => ' + index.name.inspect) - statment_parts << ':unique => true' if index.unique - - ' ' + statment_parts.join(', ') - end - - stream.puts add_index_statements.sort.join("\n") - stream.puts - end - end - end -end diff --git a/vendor/plugins/touch/init.rb b/vendor/plugins/touch/init.rb deleted file mode 100644 index df721a4..0000000 --- a/vendor/plugins/touch/init.rb +++ /dev/null @@ -1,13 +0,0 @@ -if ActiveRecord::Base.instance_methods.include?("touch") && Class.const_defined?('TOUCH_LOADED') - puts "W: ActiveRecord already provides a touch method, which means you must be using rails 2.3.3 or later." - puts "W: In this case the touch plugin could probably be removed" -end -TOUCH_LOADED = true - -module Touch - def touch - update_attribute(:updated_at, Time.now) - end -end - -ActiveRecord::Base.send(:include, Touch) diff --git a/vendor/plugins/white_list_sanitizer_unescape_before_reescape/init.rb b/vendor/plugins/white_list_sanitizer_unescape_before_reescape/init.rb deleted file mode 100644 index a5105ca..0000000 --- a/vendor/plugins/white_list_sanitizer_unescape_before_reescape/init.rb +++ /dev/null @@ -1,35 +0,0 @@ -# monkey patch to fix WhiteListSanitizer bug -# http://apidock.com/rails/HTML/WhiteListSanitizer/process_attributes_for -# -# this was solved in rails 2.2.1, then remove this patch when upgrade to it - -HTML::WhiteListSanitizer.module_eval do - - def sanitize_with_filter_fixes(*args, &block) - text = sanitize_without_filter_fixes(*args, &block) - if text - final_text = text.gsub(/<!/, '(.*)/, '\1') #FIX for itheora comments - - final_text = final_text.gsub(/&quot;/, '"') #FIX problems with archive.org - final_text - end - end - alias_method_chain :sanitize, :filter_fixes - - # unescape before reescape to avoid: - # & -> & -> &amp; -> &amp;amp; -> &amp;amp;amp; -> etc - protected - def process_attributes_for(node, options) - return unless node.attributes - node.attributes.keys.each do |attr_name| - value = node.attributes[attr_name].to_s - - if !options[:attributes].include?(attr_name) || contains_bad_protocols?(attr_name, value) - node.attributes.delete(attr_name) - else - node.attributes[attr_name] = attr_name == 'style' ? sanitize_css(value) : CGI::escapeHTML(value.gsub('&', '&')) - end - end - end -end diff --git a/vendor/plugins/will_paginate_check_finder_sql/init.rb b/vendor/plugins/will_paginate_check_finder_sql/init.rb deleted file mode 100644 index 73a5496..0000000 --- a/vendor/plugins/will_paginate_check_finder_sql/init.rb +++ /dev/null @@ -1,18 +0,0 @@ -# monkey patch to fix WillPaginate bug -# this was solved in will_paginate 3.x.pre, then remove this patch when upgrade to it -# -# http://sod.lighthouseapp.com/projects/17958/tickets/120-paginate-association-with-finder_sql-raises-typeerror -require 'will_paginate' - -WillPaginate::Finder::ClassMethods.module_eval do - def paginate_with_finder_sql(*args) - if respond_to?(:proxy_reflection) && !proxy_reflection.options[:finder_sql].nil? - # note: paginate_by_sql ignores the blocks. So don't pass the block - paginate_by_sql(@finder_sql, args.extract_options!) - else - paginate_without_finder_sql(*args) - end - end - # patch to deal with the custom_sql scenario - alias_method_chain :paginate, :finder_sql -end -- libgit2 0.21.2