mack-active_record 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (379) hide show
  1. data/lib/gems/activerecord-2.2.2/lib/active_record/aggregations.rb +261 -0
  2. data/lib/gems/activerecord-2.2.2/lib/active_record/association_preload.rb +374 -0
  3. data/lib/gems/activerecord-2.2.2/lib/active_record/associations/association_collection.rb +453 -0
  4. data/lib/gems/activerecord-2.2.2/lib/active_record/associations/association_proxy.rb +272 -0
  5. data/lib/gems/activerecord-2.2.2/lib/active_record/associations/belongs_to_association.rb +58 -0
  6. data/lib/gems/activerecord-2.2.2/lib/active_record/associations/belongs_to_polymorphic_association.rb +49 -0
  7. data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_and_belongs_to_many_association.rb +121 -0
  8. data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_many_association.rb +121 -0
  9. data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_many_through_association.rb +256 -0
  10. data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_one_association.rb +115 -0
  11. data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_one_through_association.rb +31 -0
  12. data/lib/gems/activerecord-2.2.2/lib/active_record/associations.rb +2227 -0
  13. data/lib/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb +387 -0
  14. data/lib/gems/activerecord-2.2.2/lib/active_record/base.rb +2967 -0
  15. data/lib/gems/activerecord-2.2.2/lib/active_record/calculations.rb +299 -0
  16. data/lib/gems/activerecord-2.2.2/lib/active_record/callbacks.rb +331 -0
  17. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb +355 -0
  18. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb +136 -0
  19. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb +201 -0
  20. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb +94 -0
  21. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
  22. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb +705 -0
  23. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb +434 -0
  24. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract_adapter.rb +210 -0
  25. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb +585 -0
  26. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb +1065 -0
  27. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
  28. data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/sqlite_adapter.rb +418 -0
  29. data/lib/gems/activerecord-2.2.2/lib/active_record/dirty.rb +183 -0
  30. data/lib/gems/activerecord-2.2.2/lib/active_record/dynamic_finder_match.rb +41 -0
  31. data/lib/gems/activerecord-2.2.2/lib/active_record/fixtures.rb +998 -0
  32. data/lib/gems/activerecord-2.2.2/lib/active_record/i18n_interpolation_deprecation.rb +26 -0
  33. data/lib/gems/activerecord-2.2.2/lib/active_record/locale/en.yml +54 -0
  34. data/lib/gems/activerecord-2.2.2/lib/active_record/locking/optimistic.rb +148 -0
  35. data/lib/gems/activerecord-2.2.2/lib/active_record/locking/pessimistic.rb +77 -0
  36. data/lib/gems/activerecord-2.2.2/lib/active_record/migration.rb +560 -0
  37. data/lib/gems/activerecord-2.2.2/lib/active_record/named_scope.rb +181 -0
  38. data/lib/gems/activerecord-2.2.2/lib/active_record/observer.rb +197 -0
  39. data/lib/gems/activerecord-2.2.2/lib/active_record/query_cache.rb +21 -0
  40. data/lib/gems/activerecord-2.2.2/lib/active_record/reflection.rb +307 -0
  41. data/lib/gems/activerecord-2.2.2/lib/active_record/schema.rb +51 -0
  42. data/lib/gems/activerecord-2.2.2/lib/active_record/schema_dumper.rb +177 -0
  43. data/lib/gems/activerecord-2.2.2/lib/active_record/serialization.rb +98 -0
  44. data/lib/gems/activerecord-2.2.2/lib/active_record/serializers/json_serializer.rb +80 -0
  45. data/lib/gems/activerecord-2.2.2/lib/active_record/serializers/xml_serializer.rb +338 -0
  46. data/lib/gems/activerecord-2.2.2/lib/active_record/test_case.rb +60 -0
  47. data/lib/gems/activerecord-2.2.2/lib/active_record/timestamp.rb +41 -0
  48. data/lib/gems/activerecord-2.2.2/lib/active_record/transactions.rb +185 -0
  49. data/lib/gems/activerecord-2.2.2/lib/active_record/validations.rb +1061 -0
  50. data/lib/gems/activerecord-2.2.2/lib/active_record/version.rb +9 -0
  51. data/lib/gems/activerecord-2.2.2/lib/active_record.rb +81 -0
  52. data/lib/gems/activerecord-2.2.2/lib/activerecord.rb +1 -0
  53. data/lib/gems/activesupport-2.2.2/lib/active_support/base64.rb +33 -0
  54. data/lib/gems/activesupport-2.2.2/lib/active_support/basic_object.rb +24 -0
  55. data/lib/gems/activesupport-2.2.2/lib/active_support/buffered_logger.rb +122 -0
  56. data/lib/gems/activesupport-2.2.2/lib/active_support/cache/compressed_mem_cache_store.rb +20 -0
  57. data/lib/gems/activesupport-2.2.2/lib/active_support/cache/drb_store.rb +15 -0
  58. data/lib/gems/activesupport-2.2.2/lib/active_support/cache/file_store.rb +72 -0
  59. data/lib/gems/activesupport-2.2.2/lib/active_support/cache/mem_cache_store.rb +127 -0
  60. data/lib/gems/activesupport-2.2.2/lib/active_support/cache/memory_store.rb +52 -0
  61. data/lib/gems/activesupport-2.2.2/lib/active_support/cache/synchronized_memory_store.rb +47 -0
  62. data/lib/gems/activesupport-2.2.2/lib/active_support/cache.rb +223 -0
  63. data/lib/gems/activesupport-2.2.2/lib/active_support/callbacks.rb +280 -0
  64. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/access.rb +53 -0
  65. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/conversions.rb +183 -0
  66. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/extract_options.rb +20 -0
  67. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/grouping.rb +106 -0
  68. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/random_access.rb +12 -0
  69. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array.rb +13 -0
  70. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/base64/encoding.rb +16 -0
  71. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/base64.rb +4 -0
  72. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb +12 -0
  73. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/bigdecimal/conversions.rb +37 -0
  74. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/bigdecimal.rb +6 -0
  75. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/blank.rb +58 -0
  76. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +14 -0
  77. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/cgi.rb +5 -0
  78. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/attribute_accessors.rb +54 -0
  79. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/delegating_attributes.rb +46 -0
  80. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/inheritable_attributes.rb +140 -0
  81. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/removal.rb +50 -0
  82. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class.rb +4 -0
  83. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/behavior.rb +42 -0
  84. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/calculations.rb +230 -0
  85. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/conversions.rb +107 -0
  86. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date.rb +10 -0
  87. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time/calculations.rb +126 -0
  88. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time/conversions.rb +96 -0
  89. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time.rb +12 -0
  90. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/duplicable.rb +43 -0
  91. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/enumerable.rb +107 -0
  92. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/exception.rb +41 -0
  93. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/file/atomic.rb +46 -0
  94. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/file.rb +5 -0
  95. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/float/rounding.rb +24 -0
  96. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/float/time.rb +27 -0
  97. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/float.rb +7 -0
  98. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/conversions.rb +259 -0
  99. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/deep_merge.rb +23 -0
  100. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/diff.rb +19 -0
  101. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/except.rb +25 -0
  102. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/indifferent_access.rb +137 -0
  103. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/keys.rb +52 -0
  104. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/reverse_merge.rb +35 -0
  105. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/slice.rb +33 -0
  106. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash.rb +14 -0
  107. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer/even_odd.rb +29 -0
  108. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer/inflections.rb +20 -0
  109. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer/time.rb +45 -0
  110. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer.rb +9 -0
  111. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
  112. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/daemonizing.rb +7 -0
  113. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/debugger.rb +13 -0
  114. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/reporting.rb +59 -0
  115. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/requires.rb +24 -0
  116. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel.rb +5 -0
  117. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/load_error.rb +38 -0
  118. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/logger.rb +143 -0
  119. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/aliasing.rb +74 -0
  120. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
  121. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attr_internal.rb +32 -0
  122. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attribute_accessors.rb +58 -0
  123. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/delegation.rb +95 -0
  124. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/inclusion.rb +30 -0
  125. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/introspection.rb +90 -0
  126. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/loading.rb +23 -0
  127. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/model_naming.rb +23 -0
  128. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/synchronization.rb +39 -0
  129. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module.rb +23 -0
  130. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/name_error.rb +17 -0
  131. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb +44 -0
  132. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/conversions.rb +19 -0
  133. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/time.rb +81 -0
  134. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric.rb +9 -0
  135. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/conversions.rb +14 -0
  136. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/extending.rb +80 -0
  137. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/instance_variables.rb +74 -0
  138. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/metaclass.rb +13 -0
  139. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/misc.rb +74 -0
  140. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object.rb +5 -0
  141. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/pathname/clean_within.rb +14 -0
  142. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/pathname.rb +7 -0
  143. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/proc.rb +12 -0
  144. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/process/daemon.rb +25 -0
  145. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/process.rb +1 -0
  146. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/blockless_step.rb +32 -0
  147. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/conversions.rb +27 -0
  148. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/include_range.rb +30 -0
  149. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/overlaps.rb +15 -0
  150. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range.rb +11 -0
  151. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/rexml.rb +36 -0
  152. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/access.rb +82 -0
  153. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/behavior.rb +13 -0
  154. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/conversions.rb +28 -0
  155. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/filters.rb +26 -0
  156. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/inflections.rb +167 -0
  157. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/iterators.rb +21 -0
  158. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/multibyte.rb +81 -0
  159. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/starts_ends_with.rb +35 -0
  160. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/xchar.rb +11 -0
  161. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string.rb +22 -0
  162. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/symbol.rb +14 -0
  163. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/behavior.rb +13 -0
  164. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/calculations.rb +303 -0
  165. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/conversions.rb +90 -0
  166. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/zones.rb +86 -0
  167. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time.rb +42 -0
  168. data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext.rb +4 -0
  169. data/lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb +621 -0
  170. data/lib/gems/activesupport-2.2.2/lib/active_support/deprecation.rb +243 -0
  171. data/lib/gems/activesupport-2.2.2/lib/active_support/duration.rb +96 -0
  172. data/lib/gems/activesupport-2.2.2/lib/active_support/gzip.rb +25 -0
  173. data/lib/gems/activesupport-2.2.2/lib/active_support/inflections.rb +55 -0
  174. data/lib/gems/activesupport-2.2.2/lib/active_support/inflector.rb +397 -0
  175. data/lib/gems/activesupport-2.2.2/lib/active_support/json/decoding.rb +63 -0
  176. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/date.rb +21 -0
  177. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/date_time.rb +21 -0
  178. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/enumerable.rb +12 -0
  179. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/false_class.rb +5 -0
  180. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/hash.rb +47 -0
  181. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/nil_class.rb +5 -0
  182. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/numeric.rb +5 -0
  183. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/object.rb +6 -0
  184. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/regexp.rb +5 -0
  185. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/string.rb +36 -0
  186. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/symbol.rb +5 -0
  187. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/time.rb +21 -0
  188. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/true_class.rb +5 -0
  189. data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoding.rb +37 -0
  190. data/lib/gems/activesupport-2.2.2/lib/active_support/json/variable.rb +10 -0
  191. data/lib/gems/activesupport-2.2.2/lib/active_support/json.rb +23 -0
  192. data/lib/gems/activesupport-2.2.2/lib/active_support/locale/en.yml +32 -0
  193. data/lib/gems/activesupport-2.2.2/lib/active_support/memoizable.rb +82 -0
  194. data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte/chars.rb +679 -0
  195. data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte/exceptions.rb +8 -0
  196. data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte/unicode_database.rb +71 -0
  197. data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte.rb +33 -0
  198. data/lib/gems/activesupport-2.2.2/lib/active_support/option_merger.rb +17 -0
  199. data/lib/gems/activesupport-2.2.2/lib/active_support/ordered_hash.rb +58 -0
  200. data/lib/gems/activesupport-2.2.2/lib/active_support/ordered_options.rb +19 -0
  201. data/lib/gems/activesupport-2.2.2/lib/active_support/rescuable.rb +108 -0
  202. data/lib/gems/activesupport-2.2.2/lib/active_support/secure_random.rb +197 -0
  203. data/lib/gems/activesupport-2.2.2/lib/active_support/string_inquirer.rb +21 -0
  204. data/lib/gems/activesupport-2.2.2/lib/active_support/test_case.rb +24 -0
  205. data/lib/gems/activesupport-2.2.2/lib/active_support/testing/core_ext/test/unit/assertions.rb +72 -0
  206. data/lib/gems/activesupport-2.2.2/lib/active_support/testing/core_ext/test.rb +6 -0
  207. data/lib/gems/activesupport-2.2.2/lib/active_support/testing/default.rb +9 -0
  208. data/lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb +452 -0
  209. data/lib/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb +120 -0
  210. data/lib/gems/activesupport-2.2.2/lib/active_support/time_with_zone.rb +328 -0
  211. data/lib/gems/activesupport-2.2.2/lib/active_support/values/time_zone.rb +403 -0
  212. data/lib/gems/activesupport-2.2.2/lib/active_support/values/unicode_tables.dat +0 -0
  213. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/blankslate.rb +113 -0
  214. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +20 -0
  215. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/css.rb +250 -0
  216. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +115 -0
  217. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +139 -0
  218. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +63 -0
  219. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +328 -0
  220. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder.rb +13 -0
  221. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +216 -0
  222. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/exceptions.rb +53 -0
  223. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n.rb +194 -0
  224. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb +849 -0
  225. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb +47 -0
  226. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb +228 -0
  227. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb +55 -0
  228. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb +219 -0
  229. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb +40 -0
  230. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb +18 -0
  231. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
  232. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb +22 -0
  233. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb +23 -0
  234. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
  235. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb +86 -0
  236. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb +23 -0
  237. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb +23 -0
  238. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb +283 -0
  239. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb +136 -0
  240. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb +204 -0
  241. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb +161 -0
  242. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb +27 -0
  243. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb +274 -0
  244. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
  245. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb +194 -0
  246. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb +22 -0
  247. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb +35 -0
  248. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb +232 -0
  249. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb +139 -0
  250. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb +144 -0
  251. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb +131 -0
  252. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb +282 -0
  253. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb +30 -0
  254. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb +74 -0
  255. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb +205 -0
  256. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb +171 -0
  257. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb +288 -0
  258. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb +196 -0
  259. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb +67 -0
  260. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb +73 -0
  261. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb +161 -0
  262. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb +20 -0
  263. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb +33 -0
  264. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb +30 -0
  265. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb +27 -0
  266. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
  267. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
  268. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb +30 -0
  269. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
  270. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb +20 -0
  271. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
  272. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb +30 -0
  273. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb +20 -0
  274. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb +25 -0
  275. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
  276. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
  277. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb +18 -0
  278. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb +163 -0
  279. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb +18 -0
  280. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
  281. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb +24 -0
  282. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb +18 -0
  283. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb +34 -0
  284. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb +35 -0
  285. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb +33 -0
  286. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb +59 -0
  287. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb +47 -0
  288. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
  289. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb +121 -0
  290. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb +30 -0
  291. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
  292. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb +33 -0
  293. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
  294. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
  295. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
  296. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb +165 -0
  297. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb +270 -0
  298. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
  299. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
  300. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb +187 -0
  301. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb +35 -0
  302. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb +29 -0
  303. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb +193 -0
  304. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb +185 -0
  305. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb +37 -0
  306. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb +185 -0
  307. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb +16 -0
  308. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
  309. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb +185 -0
  310. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb +163 -0
  311. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb +188 -0
  312. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb +13 -0
  313. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb +232 -0
  314. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb +181 -0
  315. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb +197 -0
  316. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
  317. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb +276 -0
  318. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb +163 -0
  319. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb +218 -0
  320. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb +168 -0
  321. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb +268 -0
  322. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
  323. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb +288 -0
  324. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb +211 -0
  325. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb +170 -0
  326. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb +181 -0
  327. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb +232 -0
  328. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb +187 -0
  329. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb +176 -0
  330. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb +215 -0
  331. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
  332. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb +13 -0
  333. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb +173 -0
  334. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb +165 -0
  335. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb +172 -0
  336. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb +183 -0
  337. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb +170 -0
  338. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb +212 -0
  339. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb +13 -0
  340. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb +202 -0
  341. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb +23 -0
  342. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb +22 -0
  343. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
  344. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb +20 -0
  345. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb +25 -0
  346. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb +25 -0
  347. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
  348. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
  349. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
  350. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb +52 -0
  351. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb +51 -0
  352. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb +44 -0
  353. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb +98 -0
  354. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb +56 -0
  355. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb +292 -0
  356. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb +508 -0
  357. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb +56 -0
  358. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb +40 -0
  359. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb +94 -0
  360. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb +198 -0
  361. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb +129 -0
  362. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb +33 -0
  363. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +1021 -0
  364. data/lib/gems/activesupport-2.2.2/lib/active_support/vendor.rb +34 -0
  365. data/lib/gems/activesupport-2.2.2/lib/active_support/version.rb +9 -0
  366. data/lib/gems/activesupport-2.2.2/lib/active_support/whiny_nil.rb +58 -0
  367. data/lib/gems/activesupport-2.2.2/lib/active_support.rb +61 -0
  368. data/lib/gems/activesupport-2.2.2/lib/activesupport.rb +1 -0
  369. data/lib/gems.rb +13 -0
  370. data/lib/mack-active_record/database.rb +4 -4
  371. data/lib/mack-active_record/migration_generator/migration_generator.rb +6 -2
  372. data/lib/mack-active_record/model_generator/manifest.yml +3 -3
  373. data/lib/mack-active_record/model_generator/model_generator.rb +8 -1
  374. data/lib/mack-active_record/model_generator/templates/model.rb.template +1 -1
  375. data/lib/mack-active_record/model_generator/templates/rspec.rb.template +1 -1
  376. data/lib/mack-active_record/model_generator/templates/test.rb.template +1 -1
  377. data/lib/mack-active_record.rb +3 -1
  378. data/lib/mack-active_record_tasks.rb +3 -0
  379. metadata +457 -16
@@ -0,0 +1,434 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters # :nodoc:
3
+ module SchemaStatements
4
+ # Returns a Hash of mappings from the abstract data types to the native
5
+ # database types. See TableDefinition#column for details on the recognized
6
+ # abstract data types.
7
+ def native_database_types
8
+ {}
9
+ end
10
+
11
+ # This is the maximum length a table alias can be
12
+ def table_alias_length
13
+ 255
14
+ end
15
+
16
+ # Truncates a table alias according to the limits of the current adapter.
17
+ def table_alias_for(table_name)
18
+ table_name[0..table_alias_length-1].gsub(/\./, '_')
19
+ end
20
+
21
+ # def tables(name = nil) end
22
+
23
+ def table_exists?(table_name)
24
+ tables.include?(table_name.to_s)
25
+ end
26
+
27
+ # Returns an array of indexes for the given table.
28
+ # def indexes(table_name, name = nil) end
29
+
30
+ # Returns an array of Column objects for the table specified by +table_name+.
31
+ # See the concrete implementation for details on the expected parameter values.
32
+ def columns(table_name, name = nil) end
33
+
34
+ # Creates a new table with the name +table_name+. +table_name+ may either
35
+ # be a String or a Symbol.
36
+ #
37
+ # There are two ways to work with +create_table+. You can use the block
38
+ # form or the regular form, like this:
39
+ #
40
+ # === Block form
41
+ # # create_table() passes a TableDefinition object to the block.
42
+ # # This form will not only create the table, but also columns for the
43
+ # # table.
44
+ # create_table(:suppliers) do |t|
45
+ # t.column :name, :string, :limit => 60
46
+ # # Other fields here
47
+ # end
48
+ #
49
+ # === Regular form
50
+ # # Creates a table called 'suppliers' with no columns.
51
+ # create_table(:suppliers)
52
+ # # Add a column to 'suppliers'.
53
+ # add_column(:suppliers, :name, :string, {:limit => 60})
54
+ #
55
+ # The +options+ hash can include the following keys:
56
+ # [<tt>:id</tt>]
57
+ # Whether to automatically add a primary key column. Defaults to true.
58
+ # Join tables for +has_and_belongs_to_many+ should set <tt>:id => false</tt>.
59
+ # [<tt>:primary_key</tt>]
60
+ # The name of the primary key, if one is to be added automatically.
61
+ # Defaults to +id+.
62
+ # [<tt>:options</tt>]
63
+ # Any extra options you want appended to the table definition.
64
+ # [<tt>:temporary</tt>]
65
+ # Make a temporary table.
66
+ # [<tt>:force</tt>]
67
+ # Set to true to drop the table before creating it.
68
+ # Defaults to false.
69
+ #
70
+ # ===== Examples
71
+ # ====== Add a backend specific option to the generated SQL (MySQL)
72
+ # create_table(:suppliers, :options => 'ENGINE=InnoDB DEFAULT CHARSET=utf8')
73
+ # generates:
74
+ # CREATE TABLE suppliers (
75
+ # id int(11) DEFAULT NULL auto_increment PRIMARY KEY
76
+ # ) ENGINE=InnoDB DEFAULT CHARSET=utf8
77
+ #
78
+ # ====== Rename the primary key column
79
+ # create_table(:objects, :primary_key => 'guid') do |t|
80
+ # t.column :name, :string, :limit => 80
81
+ # end
82
+ # generates:
83
+ # CREATE TABLE objects (
84
+ # guid int(11) DEFAULT NULL auto_increment PRIMARY KEY,
85
+ # name varchar(80)
86
+ # )
87
+ #
88
+ # ====== Do not add a primary key column
89
+ # create_table(:categories_suppliers, :id => false) do |t|
90
+ # t.column :category_id, :integer
91
+ # t.column :supplier_id, :integer
92
+ # end
93
+ # generates:
94
+ # CREATE TABLE categories_suppliers (
95
+ # category_id int,
96
+ # supplier_id int
97
+ # )
98
+ #
99
+ # See also TableDefinition#column for details on how to create columns.
100
+ def create_table(table_name, options = {})
101
+ table_definition = TableDefinition.new(self)
102
+ table_definition.primary_key(options[:primary_key] || Base.get_primary_key(table_name)) unless options[:id] == false
103
+
104
+ yield table_definition
105
+
106
+ if options[:force] && table_exists?(table_name)
107
+ drop_table(table_name, options)
108
+ end
109
+
110
+ create_sql = "CREATE#{' TEMPORARY' if options[:temporary]} TABLE "
111
+ create_sql << "#{quote_table_name(table_name)} ("
112
+ create_sql << table_definition.to_sql
113
+ create_sql << ") #{options[:options]}"
114
+ execute create_sql
115
+ end
116
+
117
+ # A block for changing columns in +table+.
118
+ #
119
+ # === Example
120
+ # # change_table() yields a Table instance
121
+ # change_table(:suppliers) do |t|
122
+ # t.column :name, :string, :limit => 60
123
+ # # Other column alterations here
124
+ # end
125
+ #
126
+ # ===== Examples
127
+ # ====== Add a column
128
+ # change_table(:suppliers) do |t|
129
+ # t.column :name, :string, :limit => 60
130
+ # end
131
+ #
132
+ # ====== Add 2 integer columns
133
+ # change_table(:suppliers) do |t|
134
+ # t.integer :width, :height, :null => false, :default => 0
135
+ # end
136
+ #
137
+ # ====== Add created_at/updated_at columns
138
+ # change_table(:suppliers) do |t|
139
+ # t.timestamps
140
+ # end
141
+ #
142
+ # ====== Add a foreign key column
143
+ # change_table(:suppliers) do |t|
144
+ # t.references :company
145
+ # end
146
+ #
147
+ # Creates a <tt>company_id(integer)</tt> column
148
+ #
149
+ # ====== Add a polymorphic foreign key column
150
+ # change_table(:suppliers) do |t|
151
+ # t.belongs_to :company, :polymorphic => true
152
+ # end
153
+ #
154
+ # Creates <tt>company_type(varchar)</tt> and <tt>company_id(integer)</tt> columns
155
+ #
156
+ # ====== Remove a column
157
+ # change_table(:suppliers) do |t|
158
+ # t.remove :company
159
+ # end
160
+ #
161
+ # ====== Remove several columns
162
+ # change_table(:suppliers) do |t|
163
+ # t.remove :company_id
164
+ # t.remove :width, :height
165
+ # end
166
+ #
167
+ # ====== Remove an index
168
+ # change_table(:suppliers) do |t|
169
+ # t.remove_index :company_id
170
+ # end
171
+ #
172
+ # See also Table for details on
173
+ # all of the various column transformation
174
+ def change_table(table_name)
175
+ yield Table.new(table_name, self)
176
+ end
177
+
178
+ # Renames a table.
179
+ # ===== Example
180
+ # rename_table('octopuses', 'octopi')
181
+ def rename_table(table_name, new_name)
182
+ raise NotImplementedError, "rename_table is not implemented"
183
+ end
184
+
185
+ # Drops a table from the database.
186
+ def drop_table(table_name, options = {})
187
+ execute "DROP TABLE #{quote_table_name(table_name)}"
188
+ end
189
+
190
+ # Adds a new column to the named table.
191
+ # See TableDefinition#column for details of the options you can use.
192
+ def add_column(table_name, column_name, type, options = {})
193
+ add_column_sql = "ALTER TABLE #{quote_table_name(table_name)} ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
194
+ add_column_options!(add_column_sql, options)
195
+ execute(add_column_sql)
196
+ end
197
+
198
+ # Removes the column(s) from the table definition.
199
+ # ===== Examples
200
+ # remove_column(:suppliers, :qualification)
201
+ # remove_columns(:suppliers, :qualification, :experience)
202
+ def remove_column(table_name, *column_names)
203
+ column_names.flatten.each do |column_name|
204
+ execute "ALTER TABLE #{quote_table_name(table_name)} DROP #{quote_column_name(column_name)}"
205
+ end
206
+ end
207
+ alias :remove_columns :remove_column
208
+
209
+ # Changes the column's definition according to the new options.
210
+ # See TableDefinition#column for details of the options you can use.
211
+ # ===== Examples
212
+ # change_column(:suppliers, :name, :string, :limit => 80)
213
+ # change_column(:accounts, :description, :text)
214
+ def change_column(table_name, column_name, type, options = {})
215
+ raise NotImplementedError, "change_column is not implemented"
216
+ end
217
+
218
+ # Sets a new default value for a column. If you want to set the default
219
+ # value to +NULL+, you are out of luck. You need to
220
+ # DatabaseStatements#execute the appropriate SQL statement yourself.
221
+ # ===== Examples
222
+ # change_column_default(:suppliers, :qualification, 'new')
223
+ # change_column_default(:accounts, :authorized, 1)
224
+ def change_column_default(table_name, column_name, default)
225
+ raise NotImplementedError, "change_column_default is not implemented"
226
+ end
227
+
228
+ # Renames a column.
229
+ # ===== Example
230
+ # rename_column(:suppliers, :description, :name)
231
+ def rename_column(table_name, column_name, new_column_name)
232
+ raise NotImplementedError, "rename_column is not implemented"
233
+ end
234
+
235
+ # Adds a new index to the table. +column_name+ can be a single Symbol, or
236
+ # an Array of Symbols.
237
+ #
238
+ # The index will be named after the table and the first column name,
239
+ # unless you pass <tt>:name</tt> as an option.
240
+ #
241
+ # When creating an index on multiple columns, the first column is used as a name
242
+ # for the index. For example, when you specify an index on two columns
243
+ # [<tt>:first</tt>, <tt>:last</tt>], the DBMS creates an index for both columns as well as an
244
+ # index for the first column <tt>:first</tt>. Using just the first name for this index
245
+ # makes sense, because you will never have to create a singular index with this
246
+ # name.
247
+ #
248
+ # ===== Examples
249
+ # ====== Creating a simple index
250
+ # add_index(:suppliers, :name)
251
+ # generates
252
+ # CREATE INDEX suppliers_name_index ON suppliers(name)
253
+ # ====== Creating a unique index
254
+ # add_index(:accounts, [:branch_id, :party_id], :unique => true)
255
+ # generates
256
+ # CREATE UNIQUE INDEX accounts_branch_id_party_id_index ON accounts(branch_id, party_id)
257
+ # ====== Creating a named index
258
+ # add_index(:accounts, [:branch_id, :party_id], :unique => true, :name => 'by_branch_party')
259
+ # generates
260
+ # CREATE UNIQUE INDEX by_branch_party ON accounts(branch_id, party_id)
261
+ def add_index(table_name, column_name, options = {})
262
+ column_names = Array(column_name)
263
+ index_name = index_name(table_name, :column => column_names)
264
+
265
+ if Hash === options # legacy support, since this param was a string
266
+ index_type = options[:unique] ? "UNIQUE" : ""
267
+ index_name = options[:name] || index_name
268
+ else
269
+ index_type = options
270
+ end
271
+ quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(", ")
272
+ execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} (#{quoted_column_names})"
273
+ end
274
+
275
+ # Remove the given index from the table.
276
+ #
277
+ # Remove the suppliers_name_index in the suppliers table.
278
+ # remove_index :suppliers, :name
279
+ # Remove the index named accounts_branch_id_index in the accounts table.
280
+ # remove_index :accounts, :column => :branch_id
281
+ # Remove the index named accounts_branch_id_party_id_index in the accounts table.
282
+ # remove_index :accounts, :column => [:branch_id, :party_id]
283
+ # Remove the index named by_branch_party in the accounts table.
284
+ # remove_index :accounts, :name => :by_branch_party
285
+ def remove_index(table_name, options = {})
286
+ execute "DROP INDEX #{quote_column_name(index_name(table_name, options))} ON #{table_name}"
287
+ end
288
+
289
+ def index_name(table_name, options) #:nodoc:
290
+ if Hash === options # legacy support
291
+ if options[:column]
292
+ "index_#{table_name}_on_#{Array(options[:column]) * '_and_'}"
293
+ elsif options[:name]
294
+ options[:name]
295
+ else
296
+ raise ArgumentError, "You must specify the index name"
297
+ end
298
+ else
299
+ index_name(table_name, :column => options)
300
+ end
301
+ end
302
+
303
+ # Returns a string of <tt>CREATE TABLE</tt> SQL statement(s) for recreating the
304
+ # entire structure of the database.
305
+ def structure_dump
306
+ end
307
+
308
+ def dump_schema_information #:nodoc:
309
+ sm_table = ActiveRecord::Migrator.schema_migrations_table_name
310
+ migrated = select_values("SELECT version FROM #{sm_table}")
311
+ migrated.map { |v| "INSERT INTO #{sm_table} (version) VALUES ('#{v}');" }.join("\n\n")
312
+ end
313
+
314
+ # Should not be called normally, but this operation is non-destructive.
315
+ # The migrations module handles this automatically.
316
+ def initialize_schema_migrations_table
317
+ sm_table = ActiveRecord::Migrator.schema_migrations_table_name
318
+
319
+ unless tables.detect { |t| t == sm_table }
320
+ create_table(sm_table, :id => false) do |schema_migrations_table|
321
+ schema_migrations_table.column :version, :string, :null => false
322
+ end
323
+ add_index sm_table, :version, :unique => true,
324
+ :name => 'unique_schema_migrations'
325
+
326
+ # Backwards-compatibility: if we find schema_info, assume we've
327
+ # migrated up to that point:
328
+ si_table = Base.table_name_prefix + 'schema_info' + Base.table_name_suffix
329
+
330
+ if tables.detect { |t| t == si_table }
331
+
332
+ old_version = select_value("SELECT version FROM #{quote_table_name(si_table)}").to_i
333
+ assume_migrated_upto_version(old_version)
334
+ drop_table(si_table)
335
+ end
336
+ end
337
+ end
338
+
339
+ def assume_migrated_upto_version(version)
340
+ version = version.to_i
341
+ sm_table = quote_table_name(ActiveRecord::Migrator.schema_migrations_table_name)
342
+
343
+ migrated = select_values("SELECT version FROM #{sm_table}").map(&:to_i)
344
+ versions = Dir['db/migrate/[0-9]*_*.rb'].map do |filename|
345
+ filename.split('/').last.split('_').first.to_i
346
+ end
347
+
348
+ unless migrated.include?(version)
349
+ execute "INSERT INTO #{sm_table} (version) VALUES ('#{version}')"
350
+ end
351
+
352
+ inserted = Set.new
353
+ (versions - migrated).each do |v|
354
+ if inserted.include?(v)
355
+ raise "Duplicate migration #{v}. Please renumber your migrations to resolve the conflict."
356
+ elsif v < version
357
+ execute "INSERT INTO #{sm_table} (version) VALUES ('#{v}')"
358
+ inserted << v
359
+ end
360
+ end
361
+ end
362
+
363
+ def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:
364
+ if native = native_database_types[type]
365
+ column_type_sql = (native.is_a?(Hash) ? native[:name] : native).dup
366
+
367
+ if type == :decimal # ignore limit, use precision and scale
368
+ scale ||= native[:scale]
369
+
370
+ if precision ||= native[:precision]
371
+ if scale
372
+ column_type_sql << "(#{precision},#{scale})"
373
+ else
374
+ column_type_sql << "(#{precision})"
375
+ end
376
+ elsif scale
377
+ raise ArgumentError, "Error adding decimal column: precision cannot be empty if scale if specified"
378
+ end
379
+
380
+ elsif (type != :primary_key) && (limit ||= native.is_a?(Hash) && native[:limit])
381
+ column_type_sql << "(#{limit})"
382
+ end
383
+
384
+ column_type_sql
385
+ else
386
+ type
387
+ end
388
+ end
389
+
390
+ def add_column_options!(sql, options) #:nodoc:
391
+ sql << " DEFAULT #{quote(options[:default], options[:column])}" if options_include_default?(options)
392
+ # must explicitly check for :null to allow change_column to work on migrations
393
+ if options[:null] == false
394
+ sql << " NOT NULL"
395
+ end
396
+ end
397
+
398
+ # SELECT DISTINCT clause for a given set of columns and a given ORDER BY clause.
399
+ # Both PostgreSQL and Oracle overrides this for custom DISTINCT syntax.
400
+ #
401
+ # distinct("posts.id", "posts.created_at desc")
402
+ def distinct(columns, order_by)
403
+ "DISTINCT #{columns}"
404
+ end
405
+
406
+ # ORDER BY clause for the passed order option.
407
+ # PostgreSQL overrides this due to its stricter standards compliance.
408
+ def add_order_by_for_association_limiting!(sql, options)
409
+ sql << " ORDER BY #{options[:order]}"
410
+ end
411
+
412
+ # Adds timestamps (created_at and updated_at) columns to the named table.
413
+ # ===== Examples
414
+ # add_timestamps(:suppliers)
415
+ def add_timestamps(table_name)
416
+ add_column table_name, :created_at, :datetime
417
+ add_column table_name, :updated_at, :datetime
418
+ end
419
+
420
+ # Removes the timestamp columns (created_at and updated_at) from the table definition.
421
+ # ===== Examples
422
+ # remove_timestamps(:suppliers)
423
+ def remove_timestamps(table_name)
424
+ remove_column table_name, :updated_at
425
+ remove_column table_name, :created_at
426
+ end
427
+
428
+ protected
429
+ def options_include_default?(options)
430
+ options.include?(:default) && !(options[:null] == false && options[:default].nil?)
431
+ end
432
+ end
433
+ end
434
+ end
@@ -0,0 +1,210 @@
1
+ require 'benchmark'
2
+ require 'date'
3
+ require 'bigdecimal'
4
+ require 'bigdecimal/util'
5
+
6
+ require 'active_record/connection_adapters/abstract/schema_definitions'
7
+ require 'active_record/connection_adapters/abstract/schema_statements'
8
+ require 'active_record/connection_adapters/abstract/database_statements'
9
+ require 'active_record/connection_adapters/abstract/quoting'
10
+ require 'active_record/connection_adapters/abstract/connection_pool'
11
+ require 'active_record/connection_adapters/abstract/connection_specification'
12
+ require 'active_record/connection_adapters/abstract/query_cache'
13
+
14
+ module ActiveRecord
15
+ module ConnectionAdapters # :nodoc:
16
+ # ActiveRecord supports multiple database systems. AbstractAdapter and
17
+ # related classes form the abstraction layer which makes this possible.
18
+ # An AbstractAdapter represents a connection to a database, and provides an
19
+ # abstract interface for database-specific functionality such as establishing
20
+ # a connection, escaping values, building the right SQL fragments for ':offset'
21
+ # and ':limit' options, etc.
22
+ #
23
+ # All the concrete database adapters follow the interface laid down in this class.
24
+ # ActiveRecord::Base.connection returns an AbstractAdapter object, which
25
+ # you can use.
26
+ #
27
+ # Most of the methods in the adapter are useful during migrations. Most
28
+ # notably, the instance methods provided by SchemaStatement are very useful.
29
+ class AbstractAdapter
30
+ include Quoting, DatabaseStatements, SchemaStatements
31
+ include QueryCache
32
+ include ActiveSupport::Callbacks
33
+ define_callbacks :checkout, :checkin
34
+
35
+ @@row_even = true
36
+
37
+ def initialize(connection, logger = nil) #:nodoc:
38
+ @connection, @logger = connection, logger
39
+ @runtime = 0
40
+ @last_verification = 0
41
+ @query_cache_enabled = false
42
+ end
43
+
44
+ # Returns the human-readable name of the adapter. Use mixed case - one
45
+ # can always use downcase if needed.
46
+ def adapter_name
47
+ 'Abstract'
48
+ end
49
+
50
+ # Does this adapter support migrations? Backend specific, as the
51
+ # abstract adapter always returns +false+.
52
+ def supports_migrations?
53
+ false
54
+ end
55
+
56
+ # Does this adapter support using DISTINCT within COUNT? This is +true+
57
+ # for all adapters except sqlite.
58
+ def supports_count_distinct?
59
+ true
60
+ end
61
+
62
+ # Does this adapter support DDL rollbacks in transactions? That is, would
63
+ # CREATE TABLE or ALTER TABLE get rolled back by a transaction? PostgreSQL,
64
+ # SQL Server, and others support this. MySQL and others do not.
65
+ def supports_ddl_transactions?
66
+ false
67
+ end
68
+
69
+ # Should primary key values be selected from their corresponding
70
+ # sequence before the insert statement? If true, next_sequence_value
71
+ # is called before each insert to set the record's primary key.
72
+ # This is false for all adapters but Firebird.
73
+ def prefetch_primary_key?(table_name = nil)
74
+ false
75
+ end
76
+
77
+ def reset_runtime #:nodoc:
78
+ rt, @runtime = @runtime, 0
79
+ rt
80
+ end
81
+
82
+ # QUOTING ==================================================
83
+
84
+ # Override to return the quoted table name. Defaults to column quoting.
85
+ def quote_table_name(name)
86
+ quote_column_name(name)
87
+ end
88
+
89
+ # REFERENTIAL INTEGRITY ====================================
90
+
91
+ # Override to turn off referential integrity while executing <tt>&block</tt>.
92
+ def disable_referential_integrity(&block)
93
+ yield
94
+ end
95
+
96
+ # CONNECTION MANAGEMENT ====================================
97
+
98
+ # Checks whether the connection to the database is still active. This includes
99
+ # checking whether the database is actually capable of responding, i.e. whether
100
+ # the connection isn't stale.
101
+ def active?
102
+ @active != false
103
+ end
104
+
105
+ # Disconnects from the database if already connected, and establishes a
106
+ # new connection with the database.
107
+ def reconnect!
108
+ @active = true
109
+ end
110
+
111
+ # Disconnects from the database if already connected. Otherwise, this
112
+ # method does nothing.
113
+ def disconnect!
114
+ @active = false
115
+ end
116
+
117
+ # Reset the state of this connection, directing the DBMS to clear
118
+ # transactions and other connection-related server-side state. Usually a
119
+ # database-dependent operation.
120
+ #
121
+ # The default implementation does nothing; the implementation should be
122
+ # overridden by concrete adapters.
123
+ def reset!
124
+ # this should be overridden by concrete adapters
125
+ end
126
+
127
+ # Returns true if its safe to reload the connection between requests for development mode.
128
+ def requires_reloading?
129
+ true
130
+ end
131
+
132
+ # Checks whether the connection to the database is still active (i.e. not stale).
133
+ # This is done under the hood by calling <tt>active?</tt>. If the connection
134
+ # is no longer active, then this method will reconnect to the database.
135
+ def verify!(*ignored)
136
+ reconnect! unless active?
137
+ end
138
+
139
+ # Provides access to the underlying database driver for this adapter. For
140
+ # example, this method returns a Mysql object in case of MysqlAdapter,
141
+ # and a PGconn object in case of PostgreSQLAdapter.
142
+ #
143
+ # This is useful for when you need to call a proprietary method such as
144
+ # PostgreSQL's lo_* methods.
145
+ def raw_connection
146
+ @connection
147
+ end
148
+
149
+ def open_transactions
150
+ @open_transactions ||= 0
151
+ end
152
+
153
+ def increment_open_transactions
154
+ @open_transactions ||= 0
155
+ @open_transactions += 1
156
+ end
157
+
158
+ def decrement_open_transactions
159
+ @open_transactions -= 1
160
+ end
161
+
162
+ def log_info(sql, name, seconds)
163
+ if @logger && @logger.debug?
164
+ name = "#{name.nil? ? "SQL" : name} (#{sprintf("%.1f", seconds * 1000)}ms)"
165
+ @logger.debug(format_log_entry(name, sql.squeeze(' ')))
166
+ end
167
+ end
168
+
169
+ protected
170
+ def log(sql, name)
171
+ if block_given?
172
+ result = nil
173
+ seconds = Benchmark.realtime { result = yield }
174
+ @runtime += seconds
175
+ log_info(sql, name, seconds)
176
+ result
177
+ else
178
+ log_info(sql, name, 0)
179
+ nil
180
+ end
181
+ rescue Exception => e
182
+ # Log message and raise exception.
183
+ # Set last_verification to 0, so that connection gets verified
184
+ # upon reentering the request loop
185
+ @last_verification = 0
186
+ message = "#{e.class.name}: #{e.message}: #{sql}"
187
+ log_info(message, name, 0)
188
+ raise ActiveRecord::StatementInvalid, message
189
+ end
190
+
191
+ def format_log_entry(message, dump = nil)
192
+ if ActiveRecord::Base.colorize_logging
193
+ if @@row_even
194
+ @@row_even = false
195
+ message_color, dump_color = "4;36;1", "0;1"
196
+ else
197
+ @@row_even = true
198
+ message_color, dump_color = "4;35;1", "0"
199
+ end
200
+
201
+ log_entry = " \e[#{message_color}m#{message}\e[0m "
202
+ log_entry << "\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\e[0m" % dump if dump
203
+ log_entry
204
+ else
205
+ "%s %s" % [message, dump]
206
+ end
207
+ end
208
+ end
209
+ end
210
+ end