backbone-deep-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/lib/backbone/deep/rails/version.rb +1 -1
  4. metadata +18 -245
  5. data/vendor/bundle/cache/activemodel-3.2.11.gem +0 -0
  6. data/vendor/bundle/cache/activesupport-3.2.11.gem +0 -0
  7. data/vendor/bundle/gems/activesupport-3.2.11/CHANGELOG.md +0 -157
  8. data/vendor/bundle/gems/activesupport-3.2.11/MIT-LICENSE +0 -20
  9. data/vendor/bundle/gems/activesupport-3.2.11/README.rdoc +0 -33
  10. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support.rb +0 -82
  11. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/all.rb +0 -3
  12. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/backtrace_cleaner.rb +0 -99
  13. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/base64.rb +0 -54
  14. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/basic_object.rb +0 -21
  15. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/benchmarkable.rb +0 -55
  16. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/buffered_logger.rb +0 -125
  17. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/builder.rb +0 -6
  18. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache.rb +0 -638
  19. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/file_store.rb +0 -178
  20. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/mem_cache_store.rb +0 -206
  21. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/memory_store.rb +0 -159
  22. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/null_store.rb +0 -44
  23. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb +0 -169
  24. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/callbacks.rb +0 -626
  25. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/concern.rb +0 -131
  26. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/configurable.rb +0 -90
  27. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext.rb +0 -3
  28. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array.rb +0 -8
  29. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/access.rb +0 -46
  30. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/conversions.rb +0 -164
  31. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/extract_options.rb +0 -29
  32. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/grouping.rb +0 -100
  33. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
  34. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/random_access.rb +0 -30
  35. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/uniq_by.rb +0 -16
  36. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/wrap.rb +0 -48
  37. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/benchmark.rb +0 -7
  38. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/big_decimal.rb +0 -1
  39. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/big_decimal/conversions.rb +0 -45
  40. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class.rb +0 -4
  41. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/attribute.rb +0 -115
  42. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/attribute_accessors.rb +0 -168
  43. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/delegating_attributes.rb +0 -44
  44. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/subclasses.rb +0 -36
  45. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/acts_like.rb +0 -8
  46. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/calculations.rb +0 -276
  47. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/conversions.rb +0 -106
  48. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/freeze.rb +0 -33
  49. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/zones.rb +0 -14
  50. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/acts_like.rb +0 -13
  51. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/calculations.rb +0 -143
  52. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/conversions.rb +0 -103
  53. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/zones.rb +0 -21
  54. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/enumerable.rb +0 -127
  55. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/exception.rb +0 -3
  56. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file.rb +0 -2
  57. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file/atomic.rb +0 -42
  58. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file/path.rb +0 -5
  59. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/float.rb +0 -1
  60. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/float/rounding.rb +0 -19
  61. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash.rb +0 -9
  62. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/conversions.rb +0 -175
  63. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/deep_dup.rb +0 -18
  64. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/deep_merge.rb +0 -21
  65. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/diff.rb +0 -13
  66. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/except.rb +0 -23
  67. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/indifferent_access.rb +0 -24
  68. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/keys.rb +0 -54
  69. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/reverse_merge.rb +0 -23
  70. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/slice.rb +0 -40
  71. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer.rb +0 -3
  72. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/inflections.rb +0 -17
  73. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/multiple.rb +0 -10
  74. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/time.rb +0 -39
  75. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/io.rb +0 -15
  76. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel.rb +0 -4
  77. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
  78. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/debugger.rb +0 -10
  79. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/reporting.rb +0 -93
  80. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/singleton_class.rb +0 -13
  81. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/load_error.rb +0 -23
  82. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/logger.rb +0 -83
  83. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module.rb +0 -12
  84. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/aliasing.rb +0 -70
  85. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/anonymous.rb +0 -24
  86. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/attr_internal.rb +0 -39
  87. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/attribute_accessors.rb +0 -64
  88. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/delegation.rb +0 -153
  89. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/deprecation.rb +0 -9
  90. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/introspection.rb +0 -88
  91. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/method_names.rb +0 -14
  92. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/qualified_const.rb +0 -64
  93. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/reachable.rb +0 -8
  94. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/remove_method.rb +0 -16
  95. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/synchronization.rb +0 -45
  96. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/name_error.rb +0 -18
  97. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric.rb +0 -2
  98. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/bytes.rb +0 -44
  99. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/time.rb +0 -79
  100. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object.rb +0 -13
  101. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/acts_like.rb +0 -10
  102. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/blank.rb +0 -121
  103. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/conversions.rb +0 -4
  104. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/duplicable.rb +0 -119
  105. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/inclusion.rb +0 -25
  106. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/instance_variables.rb +0 -33
  107. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_json.rb +0 -19
  108. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_param.rb +0 -55
  109. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_query.rb +0 -27
  110. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/try.rb +0 -57
  111. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/with_options.rb +0 -43
  112. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/proc.rb +0 -14
  113. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/process.rb +0 -1
  114. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/process/daemon.rb +0 -23
  115. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range.rb +0 -5
  116. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/blockless_step.rb +0 -29
  117. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/conversions.rb +0 -21
  118. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/cover.rb +0 -3
  119. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/include_range.rb +0 -21
  120. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/overlaps.rb +0 -8
  121. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/regexp.rb +0 -5
  122. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/rexml.rb +0 -46
  123. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string.rb +0 -14
  124. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/access.rb +0 -99
  125. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/behavior.rb +0 -6
  126. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/conversions.rb +0 -66
  127. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/encoding.rb +0 -11
  128. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/exclude.rb +0 -11
  129. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/filters.rb +0 -49
  130. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inflections.rb +0 -202
  131. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inquiry.rb +0 -13
  132. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/interpolation.rb +0 -2
  133. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/multibyte.rb +0 -72
  134. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/output_safety.rb +0 -186
  135. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/starts_ends_with.rb +0 -4
  136. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/strip.rb +0 -26
  137. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/xchar.rb +0 -18
  138. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/acts_like.rb +0 -8
  139. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/calculations.rb +0 -360
  140. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/conversions.rb +0 -85
  141. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/marshal.rb +0 -57
  142. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/publicize_conversion_methods.rb +0 -10
  143. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/zones.rb +0 -86
  144. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/uri.rb +0 -30
  145. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/dependencies.rb +0 -703
  146. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/dependencies/autoload.rb +0 -50
  147. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation.rb +0 -18
  148. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/behaviors.rb +0 -49
  149. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/method_wrappers.rb +0 -29
  150. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/proxy_wrappers.rb +0 -81
  151. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/reporting.rb +0 -65
  152. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/descendants_tracker.rb +0 -45
  153. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/duration.rb +0 -110
  154. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb +0 -121
  155. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/file_watcher.rb +0 -36
  156. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/gzip.rb +0 -30
  157. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/hash_with_indifferent_access.rb +0 -178
  158. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/i18n.rb +0 -9
  159. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/i18n_railtie.rb +0 -102
  160. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflections.rb +0 -63
  161. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector.rb +0 -7
  162. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/inflections.rb +0 -174
  163. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb +0 -321
  164. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/transliterate.rb +0 -98
  165. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json.rb +0 -2
  166. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/decoding.rb +0 -79
  167. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/encoding.rb +0 -284
  168. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/variable.rb +0 -9
  169. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb +0 -46
  170. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/locale/en.yml +0 -36
  171. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/log_subscriber.rb +0 -122
  172. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/log_subscriber/test_helper.rb +0 -101
  173. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/memoizable.rb +0 -116
  174. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/message_encryptor.rb +0 -103
  175. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/message_verifier.rb +0 -74
  176. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte.rb +0 -44
  177. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/chars.rb +0 -476
  178. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/exceptions.rb +0 -8
  179. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/unicode.rb +0 -393
  180. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/utils.rb +0 -60
  181. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications.rb +0 -154
  182. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications/fanout.rb +0 -61
  183. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb +0 -53
  184. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/option_merger.rb +0 -25
  185. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ordered_hash.rb +0 -222
  186. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ordered_options.rb +0 -61
  187. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/railtie.rb +0 -59
  188. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/rescuable.rb +0 -115
  189. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ruby/shim.rb +0 -22
  190. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/string_inquirer.rb +0 -21
  191. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/tagged_logging.rb +0 -80
  192. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/test_case.rb +0 -34
  193. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/assertions.rb +0 -97
  194. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/declarative.rb +0 -40
  195. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/deprecation.rb +0 -55
  196. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/isolation.rb +0 -157
  197. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/mochaing.rb +0 -7
  198. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/pending.rb +0 -52
  199. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance.rb +0 -317
  200. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/jruby.rb +0 -115
  201. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/rubinius.rb +0 -113
  202. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby.rb +0 -152
  203. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby/mri.rb +0 -57
  204. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby/yarv.rb +0 -57
  205. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb +0 -118
  206. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time.rb +0 -35
  207. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time/autoload.rb +0 -5
  208. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time_with_zone.rb +0 -358
  209. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/values/time_zone.rb +0 -397
  210. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/values/unicode_tables.dat +0 -0
  211. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/version.rb +0 -10
  212. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/whiny_nil.rb +0 -24
  213. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini.rb +0 -168
  214. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/jdom.rb +0 -175
  215. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/libxml.rb +0 -80
  216. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/libxmlsax.rb +0 -86
  217. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/nokogiri.rb +0 -84
  218. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/nokogirisax.rb +0 -88
  219. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/rexml.rb +0 -130
  220. data/vendor/bundle/specifications/activesupport-3.2.11.gemspec +0 -33
@@ -1,85 +0,0 @@
1
- require 'active_support/inflector/methods'
2
- require 'active_support/core_ext/time/publicize_conversion_methods'
3
- require 'active_support/values/time_zone'
4
-
5
- class Time
6
- DATE_FORMATS = {
7
- :db => "%Y-%m-%d %H:%M:%S",
8
- :number => "%Y%m%d%H%M%S",
9
- :time => "%H:%M",
10
- :short => "%d %b %H:%M",
11
- :long => "%B %d, %Y %H:%M",
12
- :long_ordinal => lambda { |time| time.strftime("%B #{ActiveSupport::Inflector.ordinalize(time.day)}, %Y %H:%M") },
13
- :rfc822 => lambda { |time| time.strftime("%a, %d %b %Y %H:%M:%S #{time.formatted_offset(false)}") }
14
- }
15
-
16
- # Converts to a formatted string. See DATE_FORMATS for builtin formats.
17
- #
18
- # This method is aliased to <tt>to_s</tt>.
19
- #
20
- # time = Time.now # => Thu Jan 18 06:10:17 CST 2007
21
- #
22
- # time.to_formatted_s(:time) # => "06:10"
23
- # time.to_s(:time) # => "06:10"
24
- #
25
- # time.to_formatted_s(:db) # => "2007-01-18 06:10:17"
26
- # time.to_formatted_s(:number) # => "20070118061017"
27
- # time.to_formatted_s(:short) # => "18 Jan 06:10"
28
- # time.to_formatted_s(:long) # => "January 18, 2007 06:10"
29
- # time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10"
30
- # time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
31
- #
32
- # == Adding your own time formats to +to_formatted_s+
33
- # You can add your own formats to the Time::DATE_FORMATS hash.
34
- # Use the format name as the hash key and either a strftime string
35
- # or Proc instance that takes a time argument as the value.
36
- #
37
- # # config/initializers/time_formats.rb
38
- # Time::DATE_FORMATS[:month_and_year] = "%B %Y"
39
- # Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
40
- def to_formatted_s(format = :default)
41
- if formatter = DATE_FORMATS[format]
42
- formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
43
- else
44
- to_default_s
45
- end
46
- end
47
- alias_method :to_default_s, :to_s
48
- alias_method :to_s, :to_formatted_s
49
-
50
- # Returns the UTC offset as an +HH:MM formatted string.
51
- #
52
- # Time.local(2000).formatted_offset # => "-06:00"
53
- # Time.local(2000).formatted_offset(false) # => "-0600"
54
- def formatted_offset(colon = true, alternate_utc_string = nil)
55
- utc? && alternate_utc_string || ActiveSupport::TimeZone.seconds_to_utc_offset(utc_offset, colon)
56
- end
57
-
58
- # Converts a Time object to a Date, dropping hour, minute, and second precision.
59
- #
60
- # my_time = Time.now # => Mon Nov 12 22:59:51 -0500 2007
61
- # my_time.to_date # => Mon, 12 Nov 2007
62
- #
63
- # your_time = Time.parse("1/13/2009 1:13:03 P.M.") # => Tue Jan 13 13:13:03 -0500 2009
64
- # your_time.to_date # => Tue, 13 Jan 2009
65
- def to_date
66
- ::Date.new(year, month, day)
67
- end unless method_defined?(:to_date)
68
-
69
- # A method to keep Time, Date and DateTime instances interchangeable on conversions.
70
- # In this case, it simply returns +self+.
71
- def to_time
72
- self
73
- end unless method_defined?(:to_time)
74
-
75
- # Converts a Time instance to a Ruby DateTime instance, preserving UTC offset.
76
- #
77
- # my_time = Time.now # => Mon Nov 12 23:04:21 -0500 2007
78
- # my_time.to_datetime # => Mon, 12 Nov 2007 23:04:21 -0500
79
- #
80
- # your_time = Time.parse("1/13/2009 1:13:03 P.M.") # => Tue Jan 13 13:13:03 -0500 2009
81
- # your_time.to_datetime # => Tue, 13 Jan 2009 13:13:03 -0500
82
- def to_datetime
83
- ::DateTime.civil(year, month, day, hour, min, sec, Rational(utc_offset, 86400))
84
- end unless method_defined?(:to_datetime)
85
- end
@@ -1,57 +0,0 @@
1
- # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2
- # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3
- # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4
- if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5
- class Time
6
- class << self
7
- alias_method :_load_without_utc_flag, :_load
8
- def _load(marshaled_time)
9
- time = _load_without_utc_flag(marshaled_time)
10
- time.instance_eval do
11
- if defined?(@marshal_with_utc_coercion)
12
- val = remove_instance_variable("@marshal_with_utc_coercion")
13
- end
14
- val ? utc : self
15
- end
16
- end
17
- end
18
-
19
- alias_method :_dump_without_utc_flag, :_dump
20
- def _dump(*args)
21
- obj = dup
22
- obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23
- obj._dump_without_utc_flag(*args)
24
- end
25
- end
26
- end
27
-
28
- # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29
- # preserves utc_offset. Preserve zone also, even though it may not
30
- # work in some edge cases.
31
- if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32
- class Time
33
- class << self
34
- alias_method :_load_without_zone, :_load
35
- def _load(marshaled_time)
36
- time = _load_without_zone(marshaled_time)
37
- time.instance_eval do
38
- if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39
- ary = to_a
40
- ary[0] += subsec if ary[0] == sec
41
- ary[-1] = zone
42
- utc? ? Time.utc(*ary) : Time.local(*ary)
43
- else
44
- self
45
- end
46
- end
47
- end
48
- end
49
-
50
- alias_method :_dump_without_zone, :_dump
51
- def _dump(*args)
52
- obj = dup
53
- obj.instance_variable_set('@_zone', zone)
54
- obj._dump_without_zone(*args)
55
- end
56
- end
57
- end
@@ -1,10 +0,0 @@
1
- require 'date'
2
-
3
- class Time
4
- # Ruby 1.8-cvs and early 1.9 series define private Time#to_date
5
- %w(to_date to_datetime).each do |method|
6
- if private_instance_methods.include?(method) || private_instance_methods.include?(method.to_sym)
7
- public method
8
- end
9
- end
10
- end
@@ -1,86 +0,0 @@
1
- require 'active_support/time_with_zone'
2
-
3
- class Time
4
- class << self
5
- attr_accessor :zone_default
6
-
7
- # Returns the TimeZone for the current request, if this has been set (via Time.zone=).
8
- # If <tt>Time.zone</tt> has not been set for the current request, returns the TimeZone specified in <tt>config.time_zone</tt>.
9
- def zone
10
- Thread.current[:time_zone] || zone_default
11
- end
12
-
13
- # Sets <tt>Time.zone</tt> to a TimeZone object for the current request/thread.
14
- #
15
- # This method accepts any of the following:
16
- #
17
- # * A Rails TimeZone object.
18
- # * An identifier for a Rails TimeZone object (e.g., "Eastern Time (US & Canada)", <tt>-5.hours</tt>).
19
- # * A TZInfo::Timezone object.
20
- # * An identifier for a TZInfo::Timezone object (e.g., "America/New_York").
21
- #
22
- # Here's an example of how you might set <tt>Time.zone</tt> on a per request basis and reset it when the request is done.
23
- # <tt>current_user.time_zone</tt> just needs to return a string identifying the user's preferred time zone:
24
- #
25
- # class ApplicationController < ActionController::Base
26
- # around_filter :set_time_zone
27
- #
28
- # def set_time_zone
29
- # old_time_zone = Time.zone
30
- # Time.zone = current_user.time_zone if logged_in?
31
- # yield
32
- # ensure
33
- # Time.zone = old_time_zone
34
- # end
35
- # end
36
- def zone=(time_zone)
37
- Thread.current[:time_zone] = find_zone!(time_zone)
38
- end
39
-
40
- # Allows override of <tt>Time.zone</tt> locally inside supplied block; resets <tt>Time.zone</tt> to existing value when done.
41
- def use_zone(time_zone)
42
- new_zone = find_zone!(time_zone)
43
- begin
44
- old_zone, ::Time.zone = ::Time.zone, new_zone
45
- yield
46
- ensure
47
- ::Time.zone = old_zone
48
- end
49
- end
50
-
51
- # Returns a TimeZone instance or nil, or raises an ArgumentError for invalid timezones.
52
- def find_zone!(time_zone)
53
- return time_zone if time_zone.nil? || time_zone.is_a?(ActiveSupport::TimeZone)
54
- # lookup timezone based on identifier (unless we've been passed a TZInfo::Timezone)
55
- unless time_zone.respond_to?(:period_for_local)
56
- time_zone = ActiveSupport::TimeZone[time_zone] || TZInfo::Timezone.get(time_zone)
57
- end
58
- # Return if a TimeZone instance, or wrap in a TimeZone instance if a TZInfo::Timezone
59
- time_zone.is_a?(ActiveSupport::TimeZone) ? time_zone : ActiveSupport::TimeZone.create(time_zone.name, nil, time_zone)
60
- rescue TZInfo::InvalidTimezoneIdentifier
61
- raise ArgumentError, "Invalid Timezone: #{time_zone}"
62
- end
63
-
64
- def find_zone(time_zone)
65
- find_zone!(time_zone) rescue nil
66
- end
67
- end
68
-
69
- # Returns the simultaneous time in <tt>Time.zone</tt>.
70
- #
71
- # Time.zone = 'Hawaii' # => 'Hawaii'
72
- # Time.utc(2000).in_time_zone # => Fri, 31 Dec 1999 14:00:00 HST -10:00
73
- #
74
- # This method is similar to Time#localtime, except that it uses <tt>Time.zone</tt> as the local zone
75
- # instead of the operating system's time zone.
76
- #
77
- # You can also pass in a TimeZone instance or string that identifies a TimeZone as an argument,
78
- # and the conversion will be based on that zone instead of <tt>Time.zone</tt>.
79
- #
80
- # Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
81
- def in_time_zone(zone = ::Time.zone)
82
- return self unless zone
83
-
84
- ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.find_zone!(zone))
85
- end
86
- end
@@ -1,30 +0,0 @@
1
- # encoding: utf-8
2
-
3
- if RUBY_VERSION >= '1.9'
4
- require 'uri'
5
-
6
- str = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E" # Ni-ho-nn-go in UTF-8, means Japanese.
7
-
8
- parser = URI::Parser.new
9
-
10
- unless str == parser.unescape(parser.escape(str))
11
- URI::Parser.class_eval do
12
- remove_method :unescape
13
- def unescape(str, escaped = /%[a-fA-F\d]{2}/)
14
- # TODO: Are we actually sure that ASCII == UTF-8?
15
- # YK: My initial experiments say yes, but let's be sure please
16
- enc = str.encoding
17
- enc = Encoding::UTF_8 if enc == Encoding::US_ASCII
18
- str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(enc)
19
- end
20
- end
21
- end
22
- end
23
-
24
- module URI
25
- class << self
26
- def parser
27
- @parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
28
- end
29
- end
30
- end
@@ -1,703 +0,0 @@
1
- require 'set'
2
- require 'thread'
3
- require 'pathname'
4
- require 'active_support/core_ext/module/aliasing'
5
- require 'active_support/core_ext/module/attribute_accessors'
6
- require 'active_support/core_ext/module/introspection'
7
- require 'active_support/core_ext/module/anonymous'
8
- require 'active_support/core_ext/module/qualified_const'
9
- require 'active_support/core_ext/object/blank'
10
- require 'active_support/core_ext/load_error'
11
- require 'active_support/core_ext/name_error'
12
- require 'active_support/core_ext/string/starts_ends_with'
13
- require 'active_support/inflector'
14
-
15
- module ActiveSupport #:nodoc:
16
- module Dependencies #:nodoc:
17
- extend self
18
-
19
- # Should we turn on Ruby warnings on the first load of dependent files?
20
- mattr_accessor :warnings_on_first_load
21
- self.warnings_on_first_load = false
22
-
23
- # All files ever loaded.
24
- mattr_accessor :history
25
- self.history = Set.new
26
-
27
- # All files currently loaded.
28
- mattr_accessor :loaded
29
- self.loaded = Set.new
30
-
31
- # Should we load files or require them?
32
- mattr_accessor :mechanism
33
- self.mechanism = ENV['NO_RELOAD'] ? :require : :load
34
-
35
- # The set of directories from which we may automatically load files. Files
36
- # under these directories will be reloaded on each request in development mode,
37
- # unless the directory also appears in autoload_once_paths.
38
- mattr_accessor :autoload_paths
39
- self.autoload_paths = []
40
-
41
- # The set of directories from which automatically loaded constants are loaded
42
- # only once. All directories in this set must also be present in +autoload_paths+.
43
- mattr_accessor :autoload_once_paths
44
- self.autoload_once_paths = []
45
-
46
- # An array of qualified constant names that have been loaded. Adding a name to
47
- # this array will cause it to be unloaded the next time Dependencies are cleared.
48
- mattr_accessor :autoloaded_constants
49
- self.autoloaded_constants = []
50
-
51
- # An array of constant names that need to be unloaded on every request. Used
52
- # to allow arbitrary constants to be marked for unloading.
53
- mattr_accessor :explicitly_unloadable_constants
54
- self.explicitly_unloadable_constants = []
55
-
56
- # The logger is used for generating information on the action run-time (including benchmarking) if available.
57
- # Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers.
58
- mattr_accessor :logger
59
-
60
- # Set to true to enable logging of const_missing and file loads
61
- mattr_accessor :log_activity
62
- self.log_activity = false
63
-
64
- # The WatchStack keeps a stack of the modules being watched as files are loaded.
65
- # If a file in the process of being loaded (parent.rb) triggers the load of
66
- # another file (child.rb) the stack will ensure that child.rb handles the new
67
- # constants.
68
- #
69
- # If child.rb is being autoloaded, its constants will be added to
70
- # autoloaded_constants. If it was being `require`d, they will be discarded.
71
- #
72
- # This is handled by walking back up the watch stack and adding the constants
73
- # found by child.rb to the list of original constants in parent.rb
74
- class WatchStack
75
- include Enumerable
76
-
77
- # @watching is a stack of lists of constants being watched. For instance,
78
- # if parent.rb is autoloaded, the stack will look like [[Object]]. If parent.rb
79
- # then requires namespace/child.rb, the stack will look like [[Object], [Namespace]].
80
-
81
- def initialize
82
- @watching = []
83
- @stack = Hash.new { |h,k| h[k] = [] }
84
- end
85
-
86
- def each(&block)
87
- @stack.each(&block)
88
- end
89
-
90
- def watching?
91
- !@watching.empty?
92
- end
93
-
94
- # return a list of new constants found since the last call to watch_namespaces
95
- def new_constants
96
- constants = []
97
-
98
- # Grab the list of namespaces that we're looking for new constants under
99
- @watching.last.each do |namespace|
100
- # Retrieve the constants that were present under the namespace when watch_namespaces
101
- # was originally called
102
- original_constants = @stack[namespace].last
103
-
104
- mod = Inflector.constantize(namespace) if Dependencies.qualified_const_defined?(namespace)
105
- next unless mod.is_a?(Module)
106
-
107
- # Get a list of the constants that were added
108
- new_constants = mod.local_constant_names - original_constants
109
-
110
- # self[namespace] returns an Array of the constants that are being evaluated
111
- # for that namespace. For instance, if parent.rb requires child.rb, the first
112
- # element of self[Object] will be an Array of the constants that were present
113
- # before parent.rb was required. The second element will be an Array of the
114
- # constants that were present before child.rb was required.
115
- @stack[namespace].each do |namespace_constants|
116
- namespace_constants.concat(new_constants)
117
- end
118
-
119
- # Normalize the list of new constants, and add them to the list we will return
120
- new_constants.each do |suffix|
121
- constants << ([namespace, suffix] - ["Object"]).join("::")
122
- end
123
- end
124
- constants
125
- ensure
126
- # A call to new_constants is always called after a call to watch_namespaces
127
- pop_modules(@watching.pop)
128
- end
129
-
130
- # Add a set of modules to the watch stack, remembering the initial constants
131
- def watch_namespaces(namespaces)
132
- watching = []
133
- namespaces.map do |namespace|
134
- module_name = Dependencies.to_constant_name(namespace)
135
- original_constants = Dependencies.qualified_const_defined?(module_name) ?
136
- Inflector.constantize(module_name).local_constant_names : []
137
-
138
- watching << module_name
139
- @stack[module_name] << original_constants
140
- end
141
- @watching << watching
142
- end
143
-
144
- private
145
- def pop_modules(modules)
146
- modules.each { |mod| @stack[mod].pop }
147
- end
148
- end
149
-
150
- # An internal stack used to record which constants are loaded by any block.
151
- mattr_accessor :constant_watch_stack
152
- self.constant_watch_stack = WatchStack.new
153
-
154
- # Module includes this module
155
- module ModuleConstMissing #:nodoc:
156
- def self.append_features(base)
157
- base.class_eval do
158
- # Emulate #exclude via an ivar
159
- return if defined?(@_const_missing) && @_const_missing
160
- @_const_missing = instance_method(:const_missing)
161
- remove_method(:const_missing)
162
- end
163
- super
164
- end
165
-
166
- def self.exclude_from(base)
167
- base.class_eval do
168
- define_method :const_missing, @_const_missing
169
- @_const_missing = nil
170
- end
171
- end
172
-
173
- # Use const_missing to autoload associations so we don't have to
174
- # require_association when using single-table inheritance.
175
- def const_missing(const_name, nesting = nil)
176
- klass_name = name.presence || "Object"
177
-
178
- unless nesting
179
- # We'll assume that the nesting of Foo::Bar is ["Foo::Bar", "Foo"]
180
- # even though it might not be, such as in the case of
181
- # class Foo::Bar; Baz; end
182
- nesting = []
183
- klass_name.to_s.scan(/::|$/) { nesting.unshift $` }
184
- end
185
-
186
- # If there are multiple levels of nesting to search under, the top
187
- # level is the one we want to report as the lookup fail.
188
- error = nil
189
-
190
- nesting.each do |namespace|
191
- begin
192
- return Dependencies.load_missing_constant Inflector.constantize(namespace), const_name
193
- rescue NoMethodError then raise
194
- rescue NameError => e
195
- error ||= e
196
- end
197
- end
198
-
199
- # Raise the first error for this set. If this const_missing came from an
200
- # earlier const_missing, this will result in the real error bubbling
201
- # all the way up
202
- raise error
203
- end
204
-
205
- def unloadable(const_desc = self)
206
- super(const_desc)
207
- end
208
- end
209
-
210
- # Object includes this module
211
- module Loadable #:nodoc:
212
- def self.exclude_from(base)
213
- base.class_eval { define_method(:load, Kernel.instance_method(:load)) }
214
- end
215
-
216
- def require_or_load(file_name)
217
- Dependencies.require_or_load(file_name)
218
- end
219
-
220
- def require_dependency(file_name, message = "No such file to load -- %s")
221
- unless file_name.is_a?(String)
222
- raise ArgumentError, "the file name must be a String -- you passed #{file_name.inspect}"
223
- end
224
-
225
- Dependencies.depend_on(file_name, false, message)
226
- end
227
-
228
- def require_association(file_name)
229
- Dependencies.associate_with(file_name)
230
- end
231
-
232
- def load_dependency(file)
233
- if Dependencies.load? && ActiveSupport::Dependencies.constant_watch_stack.watching?
234
- Dependencies.new_constants_in(Object) { yield }
235
- else
236
- yield
237
- end
238
- rescue Exception => exception # errors from loading file
239
- exception.blame_file! file
240
- raise
241
- end
242
-
243
- def load(file, wrap = false)
244
- result = false
245
- load_dependency(file) { result = super }
246
- result
247
- end
248
-
249
- def require(file)
250
- result = false
251
- load_dependency(file) { result = super }
252
- result
253
- end
254
-
255
- # Mark the given constant as unloadable. Unloadable constants are removed each
256
- # time dependencies are cleared.
257
- #
258
- # Note that marking a constant for unloading need only be done once. Setup
259
- # or init scripts may list each unloadable constant that may need unloading;
260
- # each constant will be removed for every subsequent clear, as opposed to for
261
- # the first clear.
262
- #
263
- # The provided constant descriptor may be a (non-anonymous) module or class,
264
- # or a qualified constant name as a string or symbol.
265
- #
266
- # Returns true if the constant was not previously marked for unloading, false
267
- # otherwise.
268
- def unloadable(const_desc)
269
- Dependencies.mark_for_unload const_desc
270
- end
271
- end
272
-
273
- # Exception file-blaming
274
- module Blamable #:nodoc:
275
- def blame_file!(file)
276
- (@blamed_files ||= []).unshift file
277
- end
278
-
279
- def blamed_files
280
- @blamed_files ||= []
281
- end
282
-
283
- def describe_blame
284
- return nil if blamed_files.empty?
285
- "This error occurred while loading the following files:\n #{blamed_files.join "\n "}"
286
- end
287
-
288
- def copy_blame!(exc)
289
- @blamed_files = exc.blamed_files.clone
290
- self
291
- end
292
- end
293
-
294
- def hook!
295
- Object.class_eval { include Loadable }
296
- Module.class_eval { include ModuleConstMissing }
297
- Exception.class_eval { include Blamable }
298
- true
299
- end
300
-
301
- def unhook!
302
- ModuleConstMissing.exclude_from(Module)
303
- Loadable.exclude_from(Object)
304
- true
305
- end
306
-
307
- def load?
308
- mechanism == :load
309
- end
310
-
311
- def depend_on(file_name, swallow_load_errors = false, message = "No such file to load -- %s.rb")
312
- path = search_for_file(file_name)
313
- require_or_load(path || file_name)
314
- rescue LoadError => load_error
315
- unless swallow_load_errors
316
- if file_name = load_error.message[/ -- (.*?)(\.rb)?$/, 1]
317
- raise LoadError.new(message % file_name).copy_blame!(load_error)
318
- end
319
- raise
320
- end
321
- end
322
-
323
- def associate_with(file_name)
324
- depend_on(file_name, true)
325
- end
326
-
327
- def clear
328
- log_call
329
- loaded.clear
330
- remove_unloadable_constants!
331
- end
332
-
333
- def require_or_load(file_name, const_path = nil)
334
- log_call file_name, const_path
335
- file_name = $1 if file_name =~ /^(.*)\.rb$/
336
- expanded = File.expand_path(file_name)
337
- return if loaded.include?(expanded)
338
-
339
- # Record that we've seen this file *before* loading it to avoid an
340
- # infinite loop with mutual dependencies.
341
- loaded << expanded
342
-
343
- begin
344
- if load?
345
- log "loading #{file_name}"
346
-
347
- # Enable warnings if this file has not been loaded before and
348
- # warnings_on_first_load is set.
349
- load_args = ["#{file_name}.rb"]
350
- load_args << const_path unless const_path.nil?
351
-
352
- if !warnings_on_first_load or history.include?(expanded)
353
- result = load_file(*load_args)
354
- else
355
- enable_warnings { result = load_file(*load_args) }
356
- end
357
- else
358
- log "requiring #{file_name}"
359
- result = require file_name
360
- end
361
- rescue Exception
362
- loaded.delete expanded
363
- raise
364
- end
365
-
366
- # Record history *after* loading so first load gets warnings.
367
- history << expanded
368
- return result
369
- end
370
-
371
- # Is the provided constant path defined?
372
- if Module.method(:const_defined?).arity == 1
373
- def qualified_const_defined?(path)
374
- Object.qualified_const_defined?(path.sub(/^::/, ''))
375
- end
376
- else
377
- def qualified_const_defined?(path)
378
- Object.qualified_const_defined?(path.sub(/^::/, ''), false)
379
- end
380
- end
381
-
382
- if Module.method(:const_defined?).arity == 1
383
- # Does this module define this constant?
384
- # Wrapper to accommodate changing Module#const_defined? in Ruby 1.9
385
- def local_const_defined?(mod, const)
386
- mod.const_defined?(const)
387
- end
388
- else
389
- def local_const_defined?(mod, const) #:nodoc:
390
- mod.const_defined?(const, false)
391
- end
392
- end
393
-
394
- # Given +path+, a filesystem path to a ruby file, return an array of constant
395
- # paths which would cause Dependencies to attempt to load this file.
396
- def loadable_constants_for_path(path, bases = autoload_paths)
397
- path = $1 if path =~ /\A(.*)\.rb\Z/
398
- expanded_path = File.expand_path(path)
399
- paths = []
400
-
401
- bases.each do |root|
402
- expanded_root = File.expand_path(root)
403
- next unless %r{\A#{Regexp.escape(expanded_root)}(/|\\)} =~ expanded_path
404
-
405
- nesting = expanded_path[(expanded_root.size)..-1]
406
- nesting = nesting[1..-1] if nesting && nesting[0] == ?/
407
- next if nesting.blank?
408
-
409
- paths << nesting.camelize
410
- end
411
-
412
- paths.uniq!
413
- paths
414
- end
415
-
416
- # Search for a file in autoload_paths matching the provided suffix.
417
- def search_for_file(path_suffix)
418
- path_suffix = path_suffix.sub(/(\.rb)?$/, ".rb")
419
-
420
- autoload_paths.each do |root|
421
- path = File.join(root, path_suffix)
422
- return path if File.file? path
423
- end
424
- nil # Gee, I sure wish we had first_match ;-)
425
- end
426
-
427
- # Does the provided path_suffix correspond to an autoloadable module?
428
- # Instead of returning a boolean, the autoload base for this module is returned.
429
- def autoloadable_module?(path_suffix)
430
- autoload_paths.each do |load_path|
431
- return load_path if File.directory? File.join(load_path, path_suffix)
432
- end
433
- nil
434
- end
435
-
436
- def load_once_path?(path)
437
- # to_s works around a ruby1.9 issue where #starts_with?(Pathname) will always return false
438
- autoload_once_paths.any? { |base| path.starts_with? base.to_s }
439
- end
440
-
441
- # Attempt to autoload the provided module name by searching for a directory
442
- # matching the expected path suffix. If found, the module is created and assigned
443
- # to +into+'s constants with the name +const_name+. Provided that the directory
444
- # was loaded from a reloadable base path, it is added to the set of constants
445
- # that are to be unloaded.
446
- def autoload_module!(into, const_name, qualified_name, path_suffix)
447
- return nil unless base_path = autoloadable_module?(path_suffix)
448
- mod = Module.new
449
- into.const_set const_name, mod
450
- autoloaded_constants << qualified_name unless autoload_once_paths.include?(base_path)
451
- return mod
452
- end
453
-
454
- # Load the file at the provided path. +const_paths+ is a set of qualified
455
- # constant names. When loading the file, Dependencies will watch for the
456
- # addition of these constants. Each that is defined will be marked as
457
- # autoloaded, and will be removed when Dependencies.clear is next called.
458
- #
459
- # If the second parameter is left off, then Dependencies will construct a set
460
- # of names that the file at +path+ may define. See
461
- # +loadable_constants_for_path+ for more details.
462
- def load_file(path, const_paths = loadable_constants_for_path(path))
463
- log_call path, const_paths
464
- const_paths = [const_paths].compact unless const_paths.is_a? Array
465
- parent_paths = const_paths.collect { |const_path| /(.*)::[^:]+\Z/ =~ const_path ? $1 : :Object }
466
-
467
- result = nil
468
- newly_defined_paths = new_constants_in(*parent_paths) do
469
- result = Kernel.load path
470
- end
471
-
472
- autoloaded_constants.concat newly_defined_paths unless load_once_path?(path)
473
- autoloaded_constants.uniq!
474
- log "loading #{path} defined #{newly_defined_paths * ', '}" unless newly_defined_paths.empty?
475
- return result
476
- end
477
-
478
- # Return the constant path for the provided parent and constant name.
479
- def qualified_name_for(mod, name)
480
- mod_name = to_constant_name mod
481
- mod_name == "Object" ? name.to_s : "#{mod_name}::#{name}"
482
- end
483
-
484
- # Load the constant named +const_name+ which is missing from +from_mod+. If
485
- # it is not possible to load the constant into from_mod, try its parent module
486
- # using const_missing.
487
- def load_missing_constant(from_mod, const_name)
488
- log_call from_mod, const_name
489
-
490
- unless qualified_const_defined?(from_mod.name) && Inflector.constantize(from_mod.name).equal?(from_mod)
491
- raise ArgumentError, "A copy of #{from_mod} has been removed from the module tree but is still active!"
492
- end
493
-
494
- raise NameError, "#{from_mod} is not missing constant #{const_name}!" if local_const_defined?(from_mod, const_name)
495
-
496
- qualified_name = qualified_name_for from_mod, const_name
497
- path_suffix = qualified_name.underscore
498
-
499
- file_path = search_for_file(path_suffix)
500
-
501
- if file_path && ! loaded.include?(File.expand_path(file_path).sub(/\.rb\z/, '')) # We found a matching file to load
502
- require_or_load file_path
503
- raise LoadError, "Expected #{file_path} to define #{qualified_name}" unless local_const_defined?(from_mod, const_name)
504
- return from_mod.const_get(const_name)
505
- elsif mod = autoload_module!(from_mod, const_name, qualified_name, path_suffix)
506
- return mod
507
- elsif (parent = from_mod.parent) && parent != from_mod &&
508
- ! from_mod.parents.any? { |p| local_const_defined?(p, const_name) }
509
- # If our parents do not have a constant named +const_name+ then we are free
510
- # to attempt to load upwards. If they do have such a constant, then this
511
- # const_missing must be due to from_mod::const_name, which should not
512
- # return constants from from_mod's parents.
513
- begin
514
- return parent.const_missing(const_name)
515
- rescue NameError => e
516
- raise unless e.missing_name? qualified_name_for(parent, const_name)
517
- end
518
- end
519
-
520
- raise NameError,
521
- "uninitialized constant #{qualified_name}",
522
- caller.reject {|l| l.starts_with? __FILE__ }
523
- end
524
-
525
- # Remove the constants that have been autoloaded, and those that have been
526
- # marked for unloading. Before each constant is removed a callback is sent
527
- # to its class/module if it implements +before_remove_const+.
528
- #
529
- # The callback implementation should be restricted to cleaning up caches, etc.
530
- # as the environment will be in an inconsistent state, e.g. other constants
531
- # may have already been unloaded and not accessible.
532
- def remove_unloadable_constants!
533
- autoloaded_constants.each { |const| remove_constant const }
534
- autoloaded_constants.clear
535
- Reference.clear!
536
- explicitly_unloadable_constants.each { |const| remove_constant const }
537
- end
538
-
539
- class ClassCache
540
- def initialize
541
- @store = Hash.new
542
- end
543
-
544
- def empty?
545
- @store.empty?
546
- end
547
-
548
- def key?(key)
549
- @store.key?(key)
550
- end
551
-
552
- def get(key)
553
- key = key.name if key.respond_to?(:name)
554
- @store[key] ||= Inflector.constantize(key)
555
- end
556
- alias :[] :get
557
-
558
- def safe_get(key)
559
- key = key.name if key.respond_to?(:name)
560
- @store[key] || begin
561
- klass = Inflector.safe_constantize(key)
562
- @store[key] = klass
563
- end
564
- end
565
-
566
- def store(klass)
567
- return self unless klass.respond_to?(:name)
568
- raise(ArgumentError, 'anonymous classes cannot be cached') if klass.name.empty?
569
- @store[klass.name] = klass
570
- self
571
- end
572
-
573
- def clear!
574
- @store.clear
575
- end
576
- end
577
-
578
- Reference = ClassCache.new
579
-
580
- # Store a reference to a class +klass+.
581
- def reference(klass)
582
- Reference.store klass
583
- end
584
-
585
- # Get the reference for class named +name+.
586
- # Raises an exception if referenced class does not exist.
587
- def constantize(name)
588
- Reference.get(name)
589
- end
590
-
591
- # Get the reference for class named +name+ if one exists.
592
- # Otherwise returns nil.
593
- def safe_constantize(name)
594
- Reference.safe_get(name)
595
- end
596
-
597
- # Determine if the given constant has been automatically loaded.
598
- def autoloaded?(desc)
599
- # No name => anonymous module.
600
- return false if desc.is_a?(Module) && desc.anonymous?
601
- name = to_constant_name desc
602
- return false unless qualified_const_defined? name
603
- return autoloaded_constants.include?(name)
604
- end
605
-
606
- # Will the provided constant descriptor be unloaded?
607
- def will_unload?(const_desc)
608
- autoloaded?(const_desc) ||
609
- explicitly_unloadable_constants.include?(to_constant_name(const_desc))
610
- end
611
-
612
- # Mark the provided constant name for unloading. This constant will be
613
- # unloaded on each request, not just the next one.
614
- def mark_for_unload(const_desc)
615
- name = to_constant_name const_desc
616
- if explicitly_unloadable_constants.include? name
617
- return false
618
- else
619
- explicitly_unloadable_constants << name
620
- return true
621
- end
622
- end
623
-
624
- # Run the provided block and detect the new constants that were loaded during
625
- # its execution. Constants may only be regarded as 'new' once -- so if the
626
- # block calls +new_constants_in+ again, then the constants defined within the
627
- # inner call will not be reported in this one.
628
- #
629
- # If the provided block does not run to completion, and instead raises an
630
- # exception, any new constants are regarded as being only partially defined
631
- # and will be removed immediately.
632
- def new_constants_in(*descs)
633
- log_call(*descs)
634
-
635
- constant_watch_stack.watch_namespaces(descs)
636
- aborting = true
637
-
638
- begin
639
- yield # Now yield to the code that is to define new constants.
640
- aborting = false
641
- ensure
642
- new_constants = constant_watch_stack.new_constants
643
-
644
- log "New constants: #{new_constants * ', '}"
645
- return new_constants unless aborting
646
-
647
- log "Error during loading, removing partially loaded constants "
648
- new_constants.each {|c| remove_constant(c) }.clear
649
- end
650
-
651
- return []
652
- end
653
-
654
- # Convert the provided const desc to a qualified constant name (as a string).
655
- # A module, class, symbol, or string may be provided.
656
- def to_constant_name(desc) #:nodoc:
657
- case desc
658
- when String then desc.sub(/^::/, '')
659
- when Symbol then desc.to_s
660
- when Module
661
- desc.name.presence ||
662
- raise(ArgumentError, "Anonymous modules have no name to be referenced by")
663
- else raise TypeError, "Not a valid constant descriptor: #{desc.inspect}"
664
- end
665
- end
666
-
667
- def remove_constant(const) #:nodoc:
668
- return false unless qualified_const_defined? const
669
-
670
- # Normalize ::Foo, Foo, Object::Foo, and ::Object::Foo to Object::Foo
671
- names = const.to_s.sub(/^::(Object)?/, 'Object::').split("::")
672
- to_remove = names.pop
673
- parent = Inflector.constantize(names * '::')
674
-
675
- log "removing constant #{const}"
676
- constantized = constantize(const)
677
- constantized.before_remove_const if constantized.respond_to?(:before_remove_const)
678
- parent.instance_eval { remove_const to_remove }
679
-
680
- return true
681
- end
682
-
683
- protected
684
- def log_call(*args)
685
- if log_activity?
686
- arg_str = args.collect { |arg| arg.inspect } * ', '
687
- /in `([a-z_\?\!]+)'/ =~ caller(1).first
688
- selector = $1 || '<unknown>'
689
- log "called #{selector}(#{arg_str})"
690
- end
691
- end
692
-
693
- def log(msg)
694
- logger.debug "Dependencies: #{msg}" if log_activity?
695
- end
696
-
697
- def log_activity?
698
- logger && log_activity
699
- end
700
- end
701
- end
702
-
703
- ActiveSupport::Dependencies.hook!