Skip to content
Browse files

Added updated gems for 1.9.2

  • Loading branch information...
1 parent d36104b commit 47134146632148ba93fdc73b3ccf8eb0e2edafef @kmees kmees committed
Showing with 9,629 additions and 0 deletions.
  1. BIN ...rePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/active_support-3.0.0.gem
  2. BIN ...arePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/activesupport-3.0.0.gem
  3. BIN src/IronSharePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/haml-4.0.0.gem
  4. BIN ...onSharePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/json_pure-1.7.7.gem
  5. BIN src/IronSharePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/log4r-1.1.10.gem
  6. BIN src/IronSharePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/slim-1.3.6.gem
  7. BIN src/IronSharePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/temple-0.5.5.gem
  8. BIN src/IronSharePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/tilt-1.3.5.gem
  9. 0 ...ePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/active_support-3.0.0/empty
  10. +79 −0 .../TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support.rb
  11. +3 −0 ...PLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/all.rb
  12. +94 −0 .../IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/backtrace_cleaner.rb
  13. +42 −0 ...TE/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/base64.rb
  14. +21 −0 ...tures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/basic_object.rb
  15. +60 −0 ...ures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/benchmarkable.rb
  16. +136 −0 ...es/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb
  17. +6 −0 ...E/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/builder.rb
  18. +638 −0 ...ATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache.rb
  19. +13 −0 ...y/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/compressed_mem_cache_store.rb
  20. +189 −0 ...s/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/file_store.rb
  21. +190 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/mem_cache_store.rb
  22. +159 −0 ...IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/memory_store.rb
  23. +164 −0 ...ronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/strategy/local_cache.rb
  24. +11 −0 ...by/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/synchronized_memory_store.rb
  25. +600 −0 ...Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/callbacks.rb
  26. +64 −0 ...E/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/concern.rb
  27. +36 −0 ...tures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/configurable.rb
  28. +3 −0 .../Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext.rb
  29. +7 −0 ...res/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/array.rb
  30. +46 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/array/access.rb
  31. +164 −0 ...ronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/array/conversions.rb
  32. +29 −0 ...uby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/array/extract_options.rb
  33. +100 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/array/grouping.rb
  34. +27 −0 ...nRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/array/random_access.rb
  35. +17 −0 ...SP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/array/uniq_by.rb
  36. +48 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/array/wrap.rb
  37. +7 −0 ...IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/benchmark.rb
  38. +1 −0 ...onSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/big_decimal.rb
  39. +27 −0 ...y/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/big_decimal/conversions.rb
  40. +1 −0 ...tures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/cgi.rb
  41. +19 −0 ...by/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb
  42. +5 −0 ...res/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/class.rb
  43. +90 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/class/attribute.rb
  44. +79 −0 ...ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/class/attribute_accessors.rb
  45. +44 −0 ...by/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/class/delegating_attributes.rb
  46. +254 −0 ...y/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/class/inheritable_attributes.rb
  47. +50 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/class/subclasses.rb
  48. +8 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date/acts_like.rb
  49. +241 −0 ...ronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date/calculations.rb
  50. +99 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date/conversions.rb
  51. +31 −0 ...onSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date/freeze.rb
  52. +14 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date/zones.rb
  53. +13 −0 ...nRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date_time/acts_like.rb
  54. +114 −0 ...by/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date_time/calculations.rb
  55. +103 −0 ...uby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date_time/conversions.rb
  56. +21 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date_time/zones.rb
  57. +120 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/enumerable.rb
  58. +3 −0 ...IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/exception.rb
  59. +2 −0 ...ures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/file.rb
  60. +41 −0 ...onSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/file/atomic.rb
  61. +5 −0 ...IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/file/path.rb
  62. +1 −0 ...res/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/float.rb
  63. +19 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/float/rounding.rb
  64. +8 −0 ...ures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/hash.rb
  65. +150 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/hash/conversions.rb
  66. +16 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/hash/deep_merge.rb
  67. +13 −0 ...IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/hash/diff.rb
  68. +23 −0 ...onSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/hash/except.rb
  69. +12 −0 ...y/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/hash/indifferent_access.rb
  70. +45 −0 ...IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/hash/keys.rb
  71. +28 −0 ...onRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/hash/reverse_merge.rb
  72. +38 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/hash/slice.rb
  73. +3 −0 ...s/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/integer.rb
  74. +14 −0 ...nRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/integer/inflections.rb
  75. +6 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/integer/multiple.rb
  76. +39 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/integer/time.rb
  77. +5 −0 ...es/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/kernel.rb
  78. +11 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/kernel/agnostics.rb
  79. +16 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/kernel/debugger.rb
  80. +62 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/kernel/reporting.rb
  81. +26 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/kernel/requires.rb
  82. +13 −0 ...by/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/kernel/singleton_class.rb
  83. +23 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/load_error.rb
  84. +108 −0 ...es/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/logger.rb
  85. +12 −0 ...es/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module.rb
  86. +70 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/aliasing.rb
  87. +24 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/anonymous.rb
  88. +31 −0 ...s/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/attr_accessor_with_default.rb
  89. +32 −0 ...Ruby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/attr_internal.rb
  90. +60 −0 ...uby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/attribute_accessors.rb
  91. +146 −0 ...ronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/delegation.rb
  92. +9 −0 ...onRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/deprecation.rb
  93. +88 −0 ...Ruby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/introspection.rb
  94. +14 −0 ...nRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/method_names.rb
  95. +10 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/reachable.rb
  96. +11 −0 ...Ruby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/remove_method.rb
  97. +42 −0 ...by/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/module/synchronization.rb
  98. +18 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/name_error.rb
  99. +2 −0 ...s/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/numeric.rb
  100. +44 −0 ...SP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/numeric/bytes.rb
  101. +77 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/numeric/time.rb
  102. +13 −0 ...es/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object.rb
  103. +10 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/acts_like.rb
  104. +76 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/blank.rb
  105. +4 −0 ...onRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/conversions.rb
  106. +65 −0 ...ronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/duplicable.rb
  107. +67 −0 ...ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/instance_variables.rb
  108. +43 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/returning.rb
  109. +19 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/to_json.rb
  110. +49 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/to_param.rb
  111. +27 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/to_query.rb
  112. +36 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/try.rb
  113. +26 −0 ...nRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/object/with_options.rb
  114. +14 −0 ...ures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/proc.rb
  115. +1 −0 ...s/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/process.rb
  116. +23 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/process/daemon.rb
  117. +4 −0 ...res/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/range.rb
  118. +29 −0 ...Ruby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/range/blockless_step.rb
  119. +21 −0 ...ronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/range/conversions.rb
  120. +21 −0 ...nRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/range/include_range.rb
  121. +8 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/range/overlaps.rb
  122. +5 −0 ...es/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/regexp.rb
  123. +46 −0 ...res/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/rexml.rb
  124. +13 −0 ...es/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string.rb
  125. +99 −0 ...SP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/access.rb
  126. +7 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/behavior.rb
  127. +53 −0 ...onRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/conversions.rb
  128. +11 −0 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/encoding.rb
  129. +6 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/exclude.rb
  130. +49 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/filters.rb
  131. +164 −0 ...onRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/inflections.rb
  132. +2 −0 ...Ruby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/interpolation.rb
  133. +72 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/multibyte.rb
  134. +109 −0 ...Ruby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/output_safety.rb
  135. +4 −0 ...y/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/starts_ends_with.rb
  136. +24 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/strip.rb
  137. +18 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/string/xchar.rb
  138. +8 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/time/acts_like.rb
  139. +287 −0 ...ronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/time/calculations.rb
  140. +85 −0 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/time/conversions.rb
  141. +56 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/time/marshal.rb
  142. +10 −0 ...s/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/time/publicize_conversion_methods.rb
  143. +75 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/time/zones.rb
  144. +22 −0 ...tures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/uri.rb
  145. +662 −0 ...tures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/dependencies.rb
  146. +50 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/dependencies/autoload.rb
  147. +18 −0 ...atures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/deprecation.rb
  148. +42 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/deprecation/behaviors.rb
  149. +29 −0 ...onRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/deprecation/method_wrappers.rb
  150. +81 −0 ...ronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/deprecation/proxy_wrappers.rb
  151. +61 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/deprecation/reporting.rb
  152. +43 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/descendants_tracker.rb
  153. +105 −0 .../Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/duration.rb
  154. +36 −0 ...ronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/file_update_checker.rb
  155. +25 −0 ...LATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/gzip.rb
  156. +151 −0 ...nRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/hash_with_indifferent_access.rb
  157. +9 −0 ...LATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/i18n.rb
  158. +81 −0 ...tures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/i18n_railtie.rb
  159. +56 −0 ...atures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/inflections.rb
  160. +7 −0 ...Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/inflector.rb
  161. +211 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/inflector/inflections.rb
  162. +151 −0 .../IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/inflector/methods.rb
  163. +97 −0 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/inflector/transliterate.rb
  164. +2 −0 ...LATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/json.rb
  165. +43 −0 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/json/backends/jsongem.rb
  166. +40 −0 ...IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/json/backends/yajl.rb
  167. +90 −0 ...IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/json/backends/yaml.rb
  168. +51 −0 ...ures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/json/decoding.rb
Sorry, we could not display the entire diff because too many files (435) changed.
View
BIN ...IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/active_support-3.0.0.gem
Binary file not shown.
View
BIN ....IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/activesupport-3.0.0.gem
Binary file not shown.
View
BIN ...harePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/haml-4.0.0.gem
Binary file not shown.
View
BIN ...oint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/json_pure-1.7.7.gem
Binary file not shown.
View
BIN ...rePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/log4r-1.1.10.gem
Binary file not shown.
View
BIN ...harePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/slim-1.3.6.gem
Binary file not shown.
View
BIN ...rePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/temple-0.5.5.gem
Binary file not shown.
View
BIN ...harePoint.IronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/cache/tilt-1.3.5.gem
Binary file not shown.
View
0 ...ronRuby/TEMPLATE/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/active_support-3.0.0/empty
No changes.
View
79 ...E/Features/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support.rb
@@ -0,0 +1,79 @@
+#--
+# Copyright (c) 2005 David Heinemeier Hansson
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#++
+
+module ActiveSupport
+ class << self
+ attr_accessor :load_all_hooks
+ def on_load_all(&hook) load_all_hooks << hook end
+ def load_all!; load_all_hooks.each { |hook| hook.call } end
+ end
+ self.load_all_hooks = []
+
+ on_load_all do
+ [Dependencies, Deprecation, Gzip, MessageVerifier, Multibyte, SecureRandom]
+ end
+end
+
+require "active_support/dependencies/autoload"
+
+module ActiveSupport
+ extend ActiveSupport::Autoload
+
+ autoload :DescendantsTracker
+ autoload :FileUpdateChecker
+ autoload :LogSubscriber
+ autoload :Notifications
+
+ # TODO: Narrow this list down
+ eager_autoload do
+ autoload :BacktraceCleaner
+ autoload :Base64
+ autoload :BasicObject
+ autoload :Benchmarkable
+ autoload :BufferedLogger
+ autoload :Cache
+ autoload :Callbacks
+ autoload :Concern
+ autoload :Configurable
+ autoload :Deprecation
+ autoload :Gzip
+ autoload :Inflector
+ autoload :JSON
+ autoload :Memoizable
+ autoload :MessageEncryptor
+ autoload :MessageVerifier
+ autoload :Multibyte
+ autoload :OptionMerger
+ autoload :OrderedHash
+ autoload :OrderedOptions
+ autoload :Rescuable
+ autoload :SecureRandom
+ autoload :StringInquirer
+ autoload :XmlMini
+ end
+
+ autoload :SafeBuffer, "active_support/core_ext/string/output_safety"
+ autoload :TestCase
+end
+
+autoload :I18n, "active_support/i18n"
View
3 ...atures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/all.rb
@@ -0,0 +1,3 @@
+require 'active_support'
+require 'active_support/time'
+require 'active_support/core_ext'
View
94 ...IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/backtrace_cleaner.rb
@@ -0,0 +1,94 @@
+module ActiveSupport
+ # Many backtraces include too much information that's not relevant for the context. This makes it hard to find the signal
+ # in the backtrace and adds debugging time. With a BacktraceCleaner, you can setup filters and silencers for your particular
+ # context, so only the relevant lines are included.
+ #
+ # If you need to reconfigure an existing BacktraceCleaner, like the one in Rails, to show as much as possible, you can always
+ # call BacktraceCleaner#remove_silencers! Also, if you need to reconfigure an existing BacktraceCleaner so that it does not
+ # filter or modify the paths of any lines of the backtrace, you can call BacktraceCleaner#remove_filters! These two methods
+ # will give you a completely untouched backtrace.
+ #
+ # Example:
+ #
+ # bc = BacktraceCleaner.new
+ # bc.add_filter { |line| line.gsub(Rails.root, '') }
+ # bc.add_silencer { |line| line =~ /mongrel|rubygems/ }
+ # bc.clean(exception.backtrace) # will strip the Rails.root prefix and skip any lines from mongrel or rubygems
+ #
+ # Inspired by the Quiet Backtrace gem by Thoughtbot.
+ class BacktraceCleaner
+ def initialize
+ @filters, @silencers = [], []
+ end
+
+ # Returns the backtrace after all filters and silencers has been run against it. Filters run first, then silencers.
+ def clean(backtrace, kind = :silent)
+ filtered = filter(backtrace)
+
+ case kind
+ when :silent
+ silence(filtered)
+ when :noise
+ noise(filtered)
+ else
+ filtered
+ end
+ end
+
+ # Adds a filter from the block provided. Each line in the backtrace will be mapped against this filter.
+ #
+ # Example:
+ #
+ # # Will turn "/my/rails/root/app/models/person.rb" into "/app/models/person.rb"
+ # backtrace_cleaner.add_filter { |line| line.gsub(Rails.root, '') }
+ def add_filter(&block)
+ @filters << block
+ end
+
+ # Adds a silencer from the block provided. If the silencer returns true for a given line, it'll be excluded from the
+ # clean backtrace.
+ #
+ # Example:
+ #
+ # # Will reject all lines that include the word "mongrel", like "/gems/mongrel/server.rb" or "/app/my_mongrel_server/rb"
+ # backtrace_cleaner.add_silencer { |line| line =~ /mongrel/ }
+ def add_silencer(&block)
+ @silencers << block
+ end
+
+ # Will remove all silencers, but leave in the filters. This is useful if your context of debugging suddenly expands as
+ # you suspect a bug in the libraries you use.
+ def remove_silencers!
+ @silencers = []
+ end
+
+ def remove_filters!
+ @filters = []
+ end
+
+ private
+ def filter(backtrace)
+ @filters.each do |f|
+ backtrace = backtrace.map { |line| f.call(line) }
+ end
+
+ backtrace
+ end
+
+ def silence(backtrace)
+ @silencers.each do |s|
+ backtrace = backtrace.reject { |line| s.call(line) }
+ end
+
+ backtrace
+ end
+
+ def noise(backtrace)
+ @silencers.each do |s|
+ backtrace = backtrace.select { |line| s.call(line) }
+ end
+
+ backtrace
+ end
+ end
+end
View
42 ...res/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/base64.rb
@@ -0,0 +1,42 @@
+begin
+ require 'base64'
+rescue LoadError
+end
+
+module ActiveSupport
+ if defined? ::Base64
+ Base64 = ::Base64
+ else
+ # Base64 provides utility methods for encoding and de-coding binary data
+ # using a base 64 representation. A base 64 representation of binary data
+ # consists entirely of printable US-ASCII characters. The Base64 module
+ # is included in Ruby 1.8, but has been removed in Ruby 1.9.
+ module Base64
+ # Encodes a string to its base 64 representation. Each 60 characters of
+ # output is separated by a newline character.
+ #
+ # ActiveSupport::Base64.encode64("Original unencoded string")
+ # # => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw==\n"
+ def self.encode64(data)
+ [data].pack("m")
+ end
+
+ # Decodes a base 64 encoded string to its original representation.
+ #
+ # ActiveSupport::Base64.decode64("T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw==")
+ # # => "Original unencoded string"
+ def self.decode64(data)
+ data.unpack("m").first
+ end
+ end
+ end
+
+ # Encodes the value as base64 without the newline breaks. This makes the base64 encoding readily usable as URL parameters
+ # or memcache keys without further processing.
+ #
+ # ActiveSupport::Base64.encode64s("Original unencoded string")
+ # # => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw=="
+ def Base64.encode64s(value)
+ encode64(value).gsub(/\n/, '')
+ end
+end
View
21 ...onSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/basic_object.rb
@@ -0,0 +1,21 @@
+module ActiveSupport
+ if defined? ::BasicObject
+ # A class with no predefined methods that behaves similarly to Builder's
+ # BlankSlate. Used for proxy classes.
+ class BasicObject < ::BasicObject
+ undef_method :==
+ undef_method :equal?
+
+ # Let ActiveSupport::BasicObject at least raise exceptions.
+ def raise(*args)
+ ::Object.send(:raise, *args)
+ end
+ end
+ else
+ class BasicObject #:nodoc:
+ instance_methods.each do |m|
+ undef_method(m) if m.to_s !~ /(?:^__|^nil\?$|^send$|^object_id$)/
+ end
+ end
+ end
+end
View
60 ...nSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/benchmarkable.rb
@@ -0,0 +1,60 @@
+require 'active_support/core_ext/benchmark'
+require 'active_support/core_ext/hash/keys'
+
+module ActiveSupport
+ module Benchmarkable
+ # Allows you to measure the execution time of a block
+ # in a template and records the result to the log. Wrap this block around
+ # expensive operations or possible bottlenecks to get a time reading
+ # for the operation. For example, let's say you thought your file
+ # processing method was taking too long; you could wrap it in a benchmark block.
+ #
+ # <% benchmark "Process data files" do %>
+ # <%= expensive_files_operation %>
+ # <% end %>
+ #
+ # That would add something like "Process data files (345.2ms)" to the log,
+ # which you can then use to compare timings when optimizing your code.
+ #
+ # You may give an optional logger level as the :level option.
+ # (:debug, :info, :warn, :error); the default value is :info.
+ #
+ # <% benchmark "Low-level files", :level => :debug do %>
+ # <%= lowlevel_files_operation %>
+ # <% end %>
+ #
+ # Finally, you can pass true as the third argument to silence all log activity
+ # inside the block. This is great for boiling down a noisy block to just a single statement:
+ #
+ # <% benchmark "Process data files", :level => :info, :silence => true do %>
+ # <%= expensive_and_chatty_files_operation %>
+ # <% end %>
+ def benchmark(message = "Benchmarking", options = {})
+ if logger
+ if options.is_a?(Symbol)
+ ActiveSupport::Deprecation.warn("use benchmark('#{message}', :level => :#{options}) instead", caller)
+ options = { :level => options, :silence => false }
+ else
+ options.assert_valid_keys(:level, :silence)
+ options[:level] ||= :info
+ end
+
+ result = nil
+ ms = Benchmark.ms { result = options[:silence] ? logger.silence { yield } : yield }
+ logger.send(options[:level], '%s (%.1fms)' % [ message, ms ])
+ result
+ else
+ yield
+ end
+ end
+
+ # Silence the logger during the execution of the block.
+ #
+ def silence
+ old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger
+ yield
+ ensure
+ logger.level = old_logger_level if logger
+ end
+ end
+end
View
136 ...P_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb
@@ -0,0 +1,136 @@
+require 'active_support/core_ext/class/attribute_accessors'
+
+module ActiveSupport
+ # Inspired by the buffered logger idea by Ezra
+ class BufferedLogger
+ module Severity
+ DEBUG = 0
+ INFO = 1
+ WARN = 2
+ ERROR = 3
+ FATAL = 4
+ UNKNOWN = 5
+ end
+ include Severity
+
+ MAX_BUFFER_SIZE = 1000
+
+ ##
+ # :singleton-method:
+ # Set to false to disable the silencer
+ cattr_accessor :silencer
+ self.silencer = true
+
+ # Silences the logger for the duration of the block.
+ def silence(temporary_level = ERROR)
+ if silencer
+ begin
+ old_logger_level, self.level = level, temporary_level
+ yield self
+ ensure
+ self.level = old_logger_level
+ end
+ else
+ yield self
+ end
+ end
+
+ attr_accessor :level
+ attr_reader :auto_flushing
+
+ def initialize(log, level = DEBUG)
+ @level = level
+ @buffer = {}
+ @auto_flushing = 1
+ @guard = Mutex.new
+
+ if log.respond_to?(:write)
+ @log = log
+ elsif File.exist?(log)
+ @log = open(log, (File::WRONLY | File::APPEND))
+ @log.sync = true
+ else
+ FileUtils.mkdir_p(File.dirname(log))
+ @log = open(log, (File::WRONLY | File::APPEND | File::CREAT))
+ @log.sync = true
+ end
+ end
+
+ def add(severity, message = nil, progname = nil, &block)
+ return if @level > severity
+ message = (message || (block && block.call) || progname).to_s
+ # If a newline is necessary then create a new message ending with a newline.
+ # Ensures that the original message is not mutated.
+ message = "#{message}\n" unless message[-1] == ?\n
+ buffer << message
+ auto_flush
+ message
+ end
+
+ # Dynamically add methods such as:
+ # def info
+ # def warn
+ # def debug
+ for severity in Severity.constants
+ class_eval <<-EOT, __FILE__, __LINE__ + 1
+ def #{severity.downcase}(message = nil, progname = nil, &block) # def debug(message = nil, progname = nil, &block)
+ add(#{severity}, message, progname, &block) # add(DEBUG, message, progname, &block)
+ end # end
+
+ def #{severity.downcase}? # def debug?
+ #{severity} >= @level # DEBUG >= @level
+ end # end
+ EOT
+ end
+
+ # Set the auto-flush period. Set to true to flush after every log message,
+ # to an integer to flush every N messages, or to false, nil, or zero to
+ # never auto-flush. If you turn auto-flushing off, be sure to regularly
+ # flush the log yourself -- it will eat up memory until you do.
+ def auto_flushing=(period)
+ @auto_flushing =
+ case period
+ when true; 1
+ when false, nil, 0; MAX_BUFFER_SIZE
+ when Integer; period
+ else raise ArgumentError, "Unrecognized auto_flushing period: #{period.inspect}"
+ end
+ end
+
+ def flush
+ @guard.synchronize do
+ unless buffer.empty?
+ old_buffer = buffer
+ all_content = StringIO.new
+ old_buffer.each do |content|
+ all_content << content
+ end
+ @log.write(all_content.string)
+ end
+
+ # Important to do this even if buffer was empty or else @buffer will
+ # accumulate empty arrays for each request where nothing was logged.
+ clear_buffer
+ end
+ end
+
+ def close
+ flush
+ @log.close if @log.respond_to?(:close)
+ @log = nil
+ end
+
+ protected
+ def auto_flush
+ flush if buffer.size >= @auto_flushing
+ end
+
+ def buffer
+ @buffer[Thread.current] ||= []
+ end
+
+ def clear_buffer
+ @buffer.delete(Thread.current)
+ end
+ end
+end
View
6 ...es/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/builder.rb
@@ -0,0 +1,6 @@
+begin
+ require 'builder'
+rescue LoadError => e
+ $stderr.puts "You don't have builder installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+end
View
638 ...ures/IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache.rb
@@ -0,0 +1,638 @@
+require 'benchmark'
+require 'zlib'
+require 'active_support/core_ext/array/extract_options'
+require 'active_support/core_ext/array/wrap'
+require 'active_support/core_ext/benchmark'
+require 'active_support/core_ext/exception'
+require 'active_support/core_ext/class/attribute_accessors'
+require 'active_support/core_ext/numeric/bytes'
+require 'active_support/core_ext/numeric/time'
+require 'active_support/core_ext/object/to_param'
+require 'active_support/core_ext/string/inflections'
+
+module ActiveSupport
+ # See ActiveSupport::Cache::Store for documentation.
+ module Cache
+ autoload :FileStore, 'active_support/cache/file_store'
+ autoload :MemoryStore, 'active_support/cache/memory_store'
+ autoload :MemCacheStore, 'active_support/cache/mem_cache_store'
+ autoload :SynchronizedMemoryStore, 'active_support/cache/synchronized_memory_store'
+ autoload :CompressedMemCacheStore, 'active_support/cache/compressed_mem_cache_store'
+
+ # These options mean something to all cache implementations. Individual cache
+ # implementations may support additional options.
+ UNIVERSAL_OPTIONS = [:namespace, :compress, :compress_threshold, :expires_in, :race_condition_ttl]
+
+ module Strategy
+ autoload :LocalCache, 'active_support/cache/strategy/local_cache'
+ end
+
+ # Creates a new CacheStore object according to the given options.
+ #
+ # If no arguments are passed to this method, then a new
+ # ActiveSupport::Cache::MemoryStore object will be returned.
+ #
+ # If you pass a Symbol as the first argument, then a corresponding cache
+ # store class under the ActiveSupport::Cache namespace will be created.
+ # For example:
+ #
+ # ActiveSupport::Cache.lookup_store(:memory_store)
+ # # => returns a new ActiveSupport::Cache::MemoryStore object
+ #
+ # ActiveSupport::Cache.lookup_store(:mem_cache_store)
+ # # => returns a new ActiveSupport::Cache::MemCacheStore object
+ #
+ # Any additional arguments will be passed to the corresponding cache store
+ # class's constructor:
+ #
+ # ActiveSupport::Cache.lookup_store(:file_store, "/tmp/cache")
+ # # => same as: ActiveSupport::Cache::FileStore.new("/tmp/cache")
+ #
+ # If the first argument is not a Symbol, then it will simply be returned:
+ #
+ # ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new)
+ # # => returns MyOwnCacheStore.new
+ def self.lookup_store(*store_option)
+ store, *parameters = *Array.wrap(store_option).flatten
+
+ case store
+ when Symbol
+ store_class_name = store.to_s.camelize
+ store_class =
+ begin
+ require "active_support/cache/#{store}"
+ rescue LoadError
+ raise "Could not find cache store adapter for #{store} (#{$!})"
+ else
+ ActiveSupport::Cache.const_get(store_class_name)
+ end
+ store_class.new(*parameters)
+ when nil
+ ActiveSupport::Cache::MemoryStore.new
+ else
+ store
+ end
+ end
+
+ def self.expand_cache_key(key, namespace = nil)
+ expanded_cache_key = namespace ? "#{namespace}/" : ""
+
+ prefix = ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"]
+ if prefix
+ expanded_cache_key << "#{prefix}/"
+ end
+
+ expanded_cache_key <<
+ if key.respond_to?(:cache_key)
+ key.cache_key
+ elsif key.is_a?(Array)
+ if key.size > 1
+ key.collect { |element| expand_cache_key(element) }.to_param
+ else
+ key.first.to_param
+ end
+ elsif key
+ key.to_param
+ end.to_s
+
+ expanded_cache_key
+ end
+
+ # An abstract cache store class. There are multiple cache store
+ # implementations, each having its own additional features. See the classes
+ # under the ActiveSupport::Cache module, e.g.
+ # ActiveSupport::Cache::MemCacheStore. MemCacheStore is currently the most
+ # popular cache store for large production websites.
+ #
+ # Some implementations may not support all methods beyond the basic cache
+ # methods of +fetch+, +write+, +read+, +exist?+, and +delete+.
+ #
+ # ActiveSupport::Cache::Store can store any serializable Ruby object.
+ #
+ # cache = ActiveSupport::Cache::MemoryStore.new
+ #
+ # cache.read("city") # => nil
+ # cache.write("city", "Duckburgh")
+ # cache.read("city") # => "Duckburgh"
+ #
+ # Keys are always translated into Strings and are case sensitive. When an
+ # object is specified as a key, its +cache_key+ method will be called if it
+ # is defined. Otherwise, the +to_param+ method will be called. Hashes and
+ # Arrays can be used as keys. The elements will be delimited by slashes
+ # and Hashes elements will be sorted by key so they are consistent.
+ #
+ # cache.read("city") == cache.read(:city) # => true
+ #
+ # Nil values can be cached.
+ #
+ # If your cache is on a shared infrastructure, you can define a namespace for
+ # your cache entries. If a namespace is defined, it will be prefixed on to every
+ # key. The namespace can be either a static value or a Proc. If it is a Proc, it
+ # will be invoked when each key is evaluated so that you can use application logic
+ # to invalidate keys.
+ #
+ # cache.namespace = lambda { @last_mod_time } # Set the namespace to a variable
+ # @last_mod_time = Time.now # Invalidate the entire cache by changing namespace
+ #
+ #
+ # Caches can also store values in a compressed format to save space and reduce
+ # time spent sending data. Since there is some overhead, values must be large
+ # enough to warrant compression. To turn on compression either pass
+ # <tt>:compress => true</tt> in the initializer or to +fetch+ or +write+.
+ # To specify the threshold at which to compress values, set
+ # <tt>:compress_threshold</tt>. The default threshold is 32K.
+ class Store
+
+ cattr_accessor :logger, :instance_writer => true
+
+ attr_reader :silence, :options
+ alias :silence? :silence
+
+ # Create a new cache. The options will be passed to any write method calls except
+ # for :namespace which can be used to set the global namespace for the cache.
+ def initialize (options = nil)
+ @options = options ? options.dup : {}
+ end
+
+ # Silence the logger.
+ def silence!
+ @silence = true
+ self
+ end
+
+ # Silence the logger within a block.
+ def mute
+ previous_silence, @silence = defined?(@silence) && @silence, true
+ yield
+ ensure
+ @silence = previous_silence
+ end
+
+ # Set to true if cache stores should be instrumented. Default is false.
+ def self.instrument=(boolean)
+ Thread.current[:instrument_cache_store] = boolean
+ end
+
+ def self.instrument
+ Thread.current[:instrument_cache_store] || false
+ end
+
+ # Fetches data from the cache, using the given key. If there is data in
+ # the cache with the given key, then that data is returned.
+ #
+ # If there is no such data in the cache (a cache miss occurred),
+ # then nil will be returned. However, if a block has been passed, then
+ # that block will be run in the event of a cache miss. The return value
+ # of the block will be written to the cache under the given cache key,
+ # and that return value will be returned.
+ #
+ # cache.write("today", "Monday")
+ # cache.fetch("today") # => "Monday"
+ #
+ # cache.fetch("city") # => nil
+ # cache.fetch("city") do
+ # "Duckburgh"
+ # end
+ # cache.fetch("city") # => "Duckburgh"
+ #
+ # You may also specify additional options via the +options+ argument.
+ # Setting <tt>:force => true</tt> will force a cache miss:
+ #
+ # cache.write("today", "Monday")
+ # cache.fetch("today", :force => true) # => nil
+ #
+ # Setting <tt>:compress</tt> will store a large cache entry set by the call
+ # in a compressed format.
+ #
+ #
+ # Setting <tt>:expires_in</tt> will set an expiration time on the cache. All caches
+ # support auto expiring content after a specified number of seconds. This value can
+ # be specified as an option to the construction in which call all entries will be
+ # affected. Or it can be supplied to the +fetch+ or +write+ method for just one entry.
+ #
+ # cache = ActiveSupport::Cache::MemoryStore.new(:expire_in => 5.minutes)
+ # cache.write(key, value, :expire_in => 1.minute) # Set a lower value for one entry
+ #
+ # Setting <tt>:race_condition_ttl</tt> is very useful in situations where a cache entry
+ # is used very frequently unver heavy load. If a cache expires and due to heavy load
+ # seven different processes will try to read data natively and then they all will try to
+ # write to cache. To avoid that case the first process to find an expired cache entry will
+ # bump the cache expiration time by the value set in <tt>:race_condition_ttl</tt>. Yes
+ # this process is extending the time for a stale value by another few seconds. Because
+ # of extended life of the previous cache, other processes will continue to use slightly
+ # stale data for a just a big longer. In the meantime that first process will go ahead
+ # and will write into cache the new value. After that all the processes will start
+ # getting new value. The key is to keep <tt>:race_condition_ttl</tt> small.
+ #
+ # If the process regenerating the entry errors out, the entry will be regenerated
+ # after the specified number of seconds. Also note that the life of stale cache is
+ # extended only if it expired recently. Otherwise a new value is generated and
+ # <tt>:race_condition_ttl</tt> does not play any role.
+ #
+ # # Set all values to expire after one minute.
+ # cache = ActiveSupport::Cache::MemoryCache.new(:expires_in => 1.minute)
+ #
+ # cache.write("foo", "original value")
+ # val_1 = nil
+ # val_2 = nil
+ # sleep 60
+ #
+ # Thread.new do
+ # val_1 = cache.fetch("foo", :race_condition_ttl => 10) do
+ # sleep 1
+ # "new value 1"
+ # end
+ # end
+ #
+ # Thread.new do
+ # val_2 = cache.fetch("foo", :race_condition_ttl => 10) do
+ # "new value 2"
+ # end
+ # end
+ #
+ # # val_1 => "new value 1"
+ # # val_2 => "original value"
+ # # sleep 10 # First thread extend the life of cache by another 10 seconds
+ # # cache.fetch("foo") => "new value 1"
+ #
+ # Other options will be handled by the specific cache store implementation.
+ # Internally, #fetch calls #read_entry, and calls #write_entry on a cache miss.
+ # +options+ will be passed to the #read and #write calls.
+ #
+ # For example, MemCacheStore's #write method supports the +:raw+
+ # option, which tells the memcached server to store all values as strings.
+ # We can use this option with #fetch too:
+ #
+ # cache = ActiveSupport::Cache::MemCacheStore.new
+ # cache.fetch("foo", :force => true, :raw => true) do
+ # :bar
+ # end
+ # cache.fetch("foo") # => "bar"
+ def fetch(name, options = nil)
+ if block_given?
+ options = merged_options(options)
+ key = namespaced_key(name, options)
+ unless options[:force]
+ entry = instrument(:read, name, options) do |payload|
+ payload[:super_operation] = :fetch if payload
+ read_entry(key, options)
+ end
+ end
+ if entry && entry.expired?
+ race_ttl = options[:race_condition_ttl].to_f
+ if race_ttl and Time.now.to_f - entry.expires_at <= race_ttl
+ entry.expires_at = Time.now + race_ttl
+ write_entry(key, entry, :expires_in => race_ttl * 2)
+ else
+ delete_entry(key, options)
+ end
+ entry = nil
+ end
+
+ if entry
+ instrument(:fetch_hit, name, options) { |payload| }
+ entry.value
+ else
+ result = instrument(:generate, name, options) do |payload|
+ yield
+ end
+ write(name, result, options)
+ result
+ end
+ else
+ read(name, options)
+ end
+ end
+
+ # Fetches data from the cache, using the given key. If there is data in
+ # the cache with the given key, then that data is returned. Otherwise,
+ # nil is returned.
+ #
+ # Options are passed to the underlying cache implementation.
+ def read(name, options = nil)
+ options = merged_options(options)
+ key = namespaced_key(name, options)
+ instrument(:read, name, options) do |payload|
+ entry = read_entry(key, options)
+ if entry
+ if entry.expired?
+ delete_entry(key, options)
+ payload[:hit] = false if payload
+ nil
+ else
+ payload[:hit] = true if payload
+ entry.value
+ end
+ else
+ payload[:hit] = false if payload
+ nil
+ end
+ end
+ end
+
+ # Read multiple values at once from the cache. Options can be passed
+ # in the last argument.
+ #
+ # Some cache implementation may optimize this method.
+ #
+ # Returns a hash mapping the names provided to the values found.
+ def read_multi(*names)
+ options = names.extract_options!
+ options = merged_options(options)
+ results = {}
+ names.each do |name|
+ key = namespaced_key(name, options)
+ entry = read_entry(key, options)
+ if entry
+ if entry.expired?
+ delete_entry(key)
+ else
+ results[name] = entry.value
+ end
+ end
+ end
+ results
+ end
+
+ # Writes the value to the cache, with the key.
+ #
+ # Options are passed to the underlying cache implementation.
+ def write(name, value, options = nil)
+ options = merged_options(options)
+ instrument(:write, name, options) do |payload|
+ entry = Entry.new(value, options)
+ write_entry(namespaced_key(name, options), entry, options)
+ end
+ end
+
+ # Deletes an entry in the cache. Returns +true+ if an entry is deleted.
+ #
+ # Options are passed to the underlying cache implementation.
+ def delete(name, options = nil)
+ options = merged_options(options)
+ instrument(:delete, name) do |payload|
+ delete_entry(namespaced_key(name, options), options)
+ end
+ end
+
+ # Return true if the cache contains an entry for the given key.
+ #
+ # Options are passed to the underlying cache implementation.
+ def exist?(name, options = nil)
+ options = merged_options(options)
+ instrument(:exist?, name) do |payload|
+ entry = read_entry(namespaced_key(name, options), options)
+ if entry && !entry.expired?
+ true
+ else
+ false
+ end
+ end
+ end
+
+ # Delete all entries with keys matching the pattern.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # All implementations may not support this method.
+ def delete_matched(matcher, options = nil)
+ raise NotImplementedError.new("#{self.class.name} does not support delete_matched")
+ end
+
+ # Increment an integer value in the cache.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # All implementations may not support this method.
+ def increment(name, amount = 1, options = nil)
+ raise NotImplementedError.new("#{self.class.name} does not support increment")
+ end
+
+ # Increment an integer value in the cache.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # All implementations may not support this method.
+ def decrement(name, amount = 1, options = nil)
+ raise NotImplementedError.new("#{self.class.name} does not support decrement")
+ end
+
+ # Cleanup the cache by removing expired entries.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # All implementations may not support this method.
+ def cleanup(options = nil)
+ raise NotImplementedError.new("#{self.class.name} does not support cleanup")
+ end
+
+ # Clear the entire cache. Be careful with this method since it could
+ # affect other processes if shared cache is being used.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # All implementations may not support this method.
+ def clear(options = nil)
+ raise NotImplementedError.new("#{self.class.name} does not support clear")
+ end
+
+ protected
+ # Add the namespace defined in the options to a pattern designed to match keys.
+ # Implementations that support delete_matched should call this method to translate
+ # a pattern that matches names into one that matches namespaced keys.
+ def key_matcher(pattern, options)
+ prefix = options[:namespace].is_a?(Proc) ? options[:namespace].call : options[:namespace]
+ if prefix
+ source = pattern.source
+ if source.start_with?('^')
+ source = source[1, source.length]
+ else
+ source = ".*#{source[0, source.length]}"
+ end
+ Regexp.new("^#{Regexp.escape(prefix)}:#{source}", pattern.options)
+ else
+ pattern
+ end
+ end
+
+ # Read an entry from the cache implementation. Subclasses must implement this method.
+ def read_entry(key, options) # :nodoc:
+ raise NotImplementedError.new
+ end
+
+ # Write an entry to the cache implementation. Subclasses must implement this method.
+ def write_entry(key, entry, options) # :nodoc:
+ raise NotImplementedError.new
+ end
+
+ # Delete an entry from the cache implementation. Subclasses must implement this method.
+ def delete_entry(key, options) # :nodoc:
+ raise NotImplementedError.new
+ end
+
+ private
+ # Merge the default options with ones specific to a method call.
+ def merged_options(call_options) # :nodoc:
+ if call_options
+ options.merge(call_options)
+ else
+ options.dup
+ end
+ end
+
+ # Expand key to be a consistent string value. Invoke +cache_key+ if
+ # object responds to +cache_key+. Otherwise, to_param method will be
+ # called. If the key is a Hash, then keys will be sorted alphabetically.
+ def expanded_key(key) # :nodoc:
+ if key.respond_to?(:cache_key)
+ key = key.cache_key.to_s
+ elsif key.is_a?(Array)
+ if key.size > 1
+ key.collect{|element| expanded_key(element)}.to_param
+ else
+ key.first.to_param
+ end
+ elsif key.is_a?(Hash)
+ key = key.to_a.sort{|a,b| a.first.to_s <=> b.first.to_s}.collect{|k,v| "#{k}=#{v}"}.to_param
+ else
+ key = key.to_param
+ end
+ end
+
+ # Prefix a key with the namespace. Namespace and key will be delimited with a colon.
+ def namespaced_key(key, options)
+ key = expanded_key(key)
+ namespace = options[:namespace] if options
+ prefix = namespace.is_a?(Proc) ? namespace.call : namespace
+ key = "#{prefix}:#{key}" if prefix
+ key
+ end
+
+ def instrument(operation, key, options = nil)
+ log(operation, key, options)
+
+ if self.class.instrument
+ payload = { :key => key }
+ payload.merge!(options) if options.is_a?(Hash)
+ ActiveSupport::Notifications.instrument("cache_#{operation}.active_support", payload){ yield(payload) }
+ else
+ yield(nil)
+ end
+ end
+
+ def log(operation, key, options = nil)
+ return unless logger && logger.debug? && !silence?
+ logger.debug("Cache #{operation}: #{key}#{options.blank? ? "" : " (#{options.inspect})"}")
+ end
+ end
+
+ # Entry that is put into caches. It supports expiration time on entries and can compress values
+ # to save space in the cache.
+ class Entry
+ attr_reader :created_at, :expires_in
+
+ DEFAULT_COMPRESS_LIMIT = 16.kilobytes
+
+ class << self
+ # Create an entry with internal attributes set. This method is intended to be
+ # used by implementations that store cache entries in a native format instead
+ # of as serialized Ruby objects.
+ def create (raw_value, created_at, options = {})
+ entry = new(nil)
+ entry.instance_variable_set(:@value, raw_value)
+ entry.instance_variable_set(:@created_at, created_at.to_f)
+ entry.instance_variable_set(:@compressed, !!options[:compressed])
+ entry.instance_variable_set(:@expires_in, options[:expires_in])
+ entry
+ end
+ end
+
+ # Create a new cache entry for the specified value. Options supported are
+ # +:compress+, +:compress_threshold+, and +:expires_in+.
+ def initialize(value, options = {})
+ @compressed = false
+ @expires_in = options[:expires_in]
+ @expires_in = @expires_in.to_f if @expires_in
+ @created_at = Time.now.to_f
+ if value
+ if should_compress?(value, options)
+ @value = Zlib::Deflate.deflate(Marshal.dump(value))
+ @compressed = true
+ else
+ @value = value
+ end
+ else
+ @value = nil
+ end
+ end
+
+ # Get the raw value. This value may be serialized and compressed.
+ def raw_value
+ @value
+ end
+
+ # Get the value stored in the cache.
+ def value
+ if @value
+ val = compressed? ? Marshal.load(Zlib::Inflate.inflate(@value)) : @value
+ unless val.frozen?
+ val.freeze rescue nil
+ end
+ val
+ end
+ end
+
+ def compressed?
+ @compressed
+ end
+
+ # Check if the entry is expired. The +expires_in+ parameter can override the
+ # value set when the entry was created.
+ def expired?
+ if @expires_in && @created_at + @expires_in <= Time.now.to_f
+ true
+ else
+ false
+ end
+ end
+
+ # Set a new time when the entry will expire.
+ def expires_at=(time)
+ if time
+ @expires_in = time.to_f - @created_at
+ else
+ @expires_in = nil
+ end
+ end
+
+ # Seconds since the epoch when the entry will expire.
+ def expires_at
+ @expires_in ? @created_at + @expires_in : nil
+ end
+
+ # Returns the size of the cached value. This could be less than value.size
+ # if the data is compressed.
+ def size
+ if @value.nil?
+ 0
+ elsif @value.respond_to?(:bytesize)
+ @value.bytesize
+ else
+ Marshal.dump(@value).bytesize
+ end
+ end
+
+ private
+ def should_compress?(value, options)
+ if options[:compress] && value
+ unless value.is_a?(Numeric)
+ compress_threshold = options[:compress_threshold] || DEFAULT_COMPRESS_LIMIT
+ serialized_value = value.is_a?(String) ? value : Marshal.dump(value)
+ return true if serialized_value.size >= compress_threshold
+ end
+ end
+ false
+ end
+ end
+ end
+end
View
13 ...ems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/compressed_mem_cache_store.rb
@@ -0,0 +1,13 @@
+module ActiveSupport
+ module Cache
+ class CompressedMemCacheStore < MemCacheStore
+ def initialize(*args)
+ ActiveSupport::Deprecation.warn('ActiveSupport::Cache::CompressedMemCacheStore has been deprecated in favor of ActiveSupport::Cache::MemCacheStore(:compress => true).', caller)
+ addresses = args.dup
+ options = addresses.extract_options!
+ args = addresses + [options.merge(:compress => true)]
+ super(*args)
+ end
+ end
+ end
+end
View
189 ..._IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/file_store.rb
@@ -0,0 +1,189 @@
+require 'active_support/core_ext/file/atomic'
+require 'active_support/core_ext/string/conversions'
+
+module ActiveSupport
+ module Cache
+ # A cache store implementation which stores everything on the filesystem.
+ #
+ # FileStore implements the Strategy::LocalCache strategy which implements
+ # an in memory cache inside of a block.
+ class FileStore < Store
+ attr_reader :cache_path
+
+ DIR_FORMATTER = "%03X"
+ ESCAPE_FILENAME_CHARS = /[^a-z0-9_.-]/i
+ UNESCAPE_FILENAME_CHARS = /%[0-9A-F]{2}/
+
+ def initialize(cache_path, options = nil)
+ super(options)
+ @cache_path = cache_path
+ extend Strategy::LocalCache
+ end
+
+ def clear(options = nil)
+ root_dirs = Dir.entries(cache_path).reject{|f| ['.', '..'].include?(f)}
+ FileUtils.rm_r(root_dirs.collect{|f| File.join(cache_path, f)})
+ end
+
+ def cleanup(options = nil)
+ options = merged_options(options)
+ each_key(options) do |key|
+ entry = read_entry(key, options)
+ delete_entry(key, options) if entry && entry.expired?
+ end
+ end
+
+ def increment(name, amount = 1, options = nil)
+ file_name = key_file_path(namespaced_key(name, options))
+ lock_file(file_name) do
+ options = merged_options(options)
+ if num = read(name, options)
+ num = num.to_i + amount
+ write(name, num, options)
+ num
+ else
+ nil
+ end
+ end
+ end
+
+ def decrement(name, amount = 1, options = nil)
+ file_name = key_file_path(namespaced_key(name, options))
+ lock_file(file_name) do
+ options = merged_options(options)
+ if num = read(name, options)
+ num = num.to_i - amount
+ write(name, num, options)
+ num
+ else
+ nil
+ end
+ end
+ end
+
+ def delete_matched(matcher, options = nil)
+ options = merged_options(options)
+ instrument(:delete_matched, matcher.inspect) do
+ matcher = key_matcher(matcher, options)
+ search_dir(cache_path) do |path|
+ key = file_path_key(path)
+ delete_entry(key, options) if key.match(matcher)
+ end
+ end
+ end
+
+ protected
+
+ def read_entry(key, options)
+ file_name = key_file_path(key)
+ if File.exist?(file_name)
+ entry = File.open(file_name) { |f| Marshal.load(f) }
+ if entry && !entry.expired? && !entry.expires_in && !self.options[:expires_in]
+ # Check for deprecated use of +:expires_in+ option from versions < 3.0
+ deprecated_expires_in = options[:expires_in]
+ if deprecated_expires_in
+ ActiveSupport::Deprecation.warn('Setting :expires_in on read has been deprecated in favor of setting it on write.', caller)
+ if entry.created_at + deprecated_expires_in.to_f <= Time.now.to_f
+ delete_entry(key, options)
+ entry = nil
+ end
+ end
+ end
+ entry
+ end
+ rescue
+ nil
+ end
+
+ def write_entry(key, entry, options)
+ file_name = key_file_path(key)
+ ensure_cache_path(File.dirname(file_name))
+ File.atomic_write(file_name, cache_path) {|f| Marshal.dump(entry, f)}
+ true
+ end
+
+ def delete_entry(key, options)
+ file_name = key_file_path(key)
+ if File.exist?(file_name)
+ begin
+ File.delete(file_name)
+ delete_empty_directories(File.dirname(file_name))
+ true
+ rescue => e
+ # Just in case the error was caused by another process deleting the file first.
+ raise e if File.exist?(file_name)
+ false
+ end
+ end
+ end
+
+ private
+ # Lock a file for a block so only one process can modify it at a time.
+ def lock_file(file_name, &block) # :nodoc:
+ if File.exist?(file_name)
+ File.open(file_name, 'r') do |f|
+ begin
+ f.flock File::LOCK_EX
+ yield
+ ensure
+ f.flock File::LOCK_UN
+ end
+ end
+ else
+ yield
+ end
+ end
+
+ # Translate a key into a file path.
+ def key_file_path(key)
+ fname = key.to_s.gsub(ESCAPE_FILENAME_CHARS){|match| "%#{match.ord.to_s(16).upcase}"}
+ hash = Zlib.adler32(fname)
+ hash, dir_1 = hash.divmod(0x1000)
+ dir_2 = hash.modulo(0x1000)
+ fname_paths = []
+ # Make sure file name is < 255 characters so it doesn't exceed file system limits.
+ if fname.size <= 255
+ fname_paths << fname
+ else
+ while fname.size <= 255
+ fname_path << fname[0, 255]
+ fname = fname[255, -1]
+ end
+ end
+ File.join(cache_path, DIR_FORMATTER % dir_1, DIR_FORMATTER % dir_2, *fname_paths)
+ end
+
+ # Translate a file path into a key.
+ def file_path_key(path)
+ fname = path[cache_path.size, path.size].split(File::SEPARATOR, 4).last
+ fname.gsub(UNESCAPE_FILENAME_CHARS){|match| $1.ord.to_s(16)}
+ end
+
+ # Delete empty directories in the cache.
+ def delete_empty_directories(dir)
+ return if dir == cache_path
+ if Dir.entries(dir).reject{|f| ['.', '..'].include?(f)}.empty?
+ File.delete(dir) rescue nil
+ delete_empty_directories(File.dirname(dir))
+ end
+ end
+
+ # Make sure a file path's directories exist.
+ def ensure_cache_path(path)
+ FileUtils.makedirs(path) unless File.exist?(path)
+ end
+
+ def search_dir(dir, &callback)
+ Dir.foreach(dir) do |d|
+ next if d == "." || d == ".."
+ name = File.join(dir, d)
+ if File.directory?(name)
+ search_dir(name, &callback)
+ else
+ callback.call name
+ end
+ end
+ end
+ end
+ end
+end
View
190 ...Ruby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/mem_cache_store.rb
@@ -0,0 +1,190 @@
+begin
+ require 'memcache'
+rescue LoadError => e
+ $stderr.puts "You don't have memcache installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+end
+require 'digest/md5'
+
+module ActiveSupport
+ module Cache
+ # A cache store implementation which stores data in Memcached:
+ # http://www.danga.com/memcached/
+ #
+ # This is currently the most popular cache store for production websites.
+ #
+ # Special features:
+ # - Clustering and load balancing. One can specify multiple memcached servers,
+ # and MemCacheStore will load balance between all available servers. If a
+ # server goes down, then MemCacheStore will ignore it until it comes back up.
+ #
+ # MemCacheStore implements the Strategy::LocalCache strategy which implements
+ # an in memory cache inside of a block.
+ class MemCacheStore < Store
+ module Response # :nodoc:
+ STORED = "STORED\r\n"
+ NOT_STORED = "NOT_STORED\r\n"
+ EXISTS = "EXISTS\r\n"
+ NOT_FOUND = "NOT_FOUND\r\n"
+ DELETED = "DELETED\r\n"
+ end
+
+ ESCAPE_KEY_CHARS = /[\x00-\x20%\x7F-\xFF]/
+
+ def self.build_mem_cache(*addresses)
+ addresses = addresses.flatten
+ options = addresses.extract_options!
+ addresses = ["localhost:11211"] if addresses.empty?
+ MemCache.new(addresses, options)
+ end
+
+ # Creates a new MemCacheStore object, with the given memcached server
+ # addresses. Each address is either a host name, or a host-with-port string
+ # in the form of "host_name:port". For example:
+ #
+ # ActiveSupport::Cache::MemCacheStore.new("localhost", "server-downstairs.localnetwork:8229")
+ #
+ # If no addresses are specified, then MemCacheStore will connect to
+ # localhost port 11211 (the default memcached port).
+ #
+ # Instead of addresses one can pass in a MemCache-like object. For example:
+ #
+ # require 'memcached' # gem install memcached; uses C bindings to libmemcached
+ # ActiveSupport::Cache::MemCacheStore.new(Memcached::Rails.new("localhost:11211"))
+ def initialize(*addresses)
+ addresses = addresses.flatten
+ options = addresses.extract_options!
+ super(options)
+
+ if addresses.first.respond_to?(:get)
+ @data = addresses.first
+ else
+ mem_cache_options = options.dup
+ UNIVERSAL_OPTIONS.each{|name| mem_cache_options.delete(name)}
+ @data = self.class.build_mem_cache(*(addresses + [mem_cache_options]))
+ end
+
+ extend Strategy::LocalCache
+ extend LocalCacheWithRaw
+ end
+
+ # Reads multiple values from the cache using a single call to the
+ # servers for all keys. Options can be passed in the last argument.
+ def read_multi(*names)
+ options = names.extract_options!
+ options = merged_options(options)
+ keys_to_names = names.inject({}){|map, name| map[escape_key(namespaced_key(name, options))] = name; map}
+ raw_values = @data.get_multi(keys_to_names.keys, :raw => true)
+ values = {}
+ raw_values.each do |key, value|
+ entry = deserialize_entry(value)
+ values[keys_to_names[key]] = entry.value unless entry.expired?
+ end
+ values
+ end
+
+ # Increment a cached value. This method uses the memcached incr atomic
+ # operator and can only be used on values written with the :raw option.
+ # Calling it on a value not stored with :raw will initialize that value
+ # to zero.
+ def increment(name, amount = 1, options = nil) # :nodoc:
+ options = merged_options(options)
+ response = instrument(:increment, name, :amount => amount) do
+ @data.incr(escape_key(namespaced_key(name, options)), amount)
+ end
+ response == Response::NOT_FOUND ? nil : response.to_i
+ rescue MemCache::MemCacheError
+ nil
+ end
+
+ # Decrement a cached value. This method uses the memcached decr atomic
+ # operator and can only be used on values written with the :raw option.
+ # Calling it on a value not stored with :raw will initialize that value
+ # to zero.
+ def decrement(name, amount = 1, options = nil) # :nodoc:
+ options = merged_options(options)
+ response = instrument(:decrement, name, :amount => amount) do
+ @data.decr(escape_key(namespaced_key(name, options)), amount)
+ end
+ response == Response::NOT_FOUND ? nil : response.to_i
+ rescue MemCache::MemCacheError
+ nil
+ end
+
+ # Clear the entire cache on all memcached servers. This method should
+ # be used with care when shared cache is being used.
+ def clear(options = nil)
+ @data.flush_all
+ end
+
+ # Get the statistics from the memcached servers.
+ def stats
+ @data.stats
+ end
+
+ protected
+ # Read an entry from the cache.
+ def read_entry(key, options) # :nodoc:
+ deserialize_entry(@data.get(escape_key(key), true))
+ rescue MemCache::MemCacheError => e
+ logger.error("MemCacheError (#{e}): #{e.message}") if logger
+ nil
+ end
+
+ # Write an entry to the cache.
+ def write_entry(key, entry, options) # :nodoc:
+ method = options && options[:unless_exist] ? :add : :set
+ value = options[:raw] ? entry.value.to_s : entry
+ expires_in = options[:expires_in].to_i
+ if expires_in > 0 && !options[:raw]
+ # Set the memcache expire a few minutes in the future to support race condition ttls on read
+ expires_in += 5.minutes
+ end
+ response = @data.send(method, escape_key(key), value, expires_in, options[:raw])
+ response == Response::STORED
+ rescue MemCache::MemCacheError => e
+ logger.error("MemCacheError (#{e}): #{e.message}") if logger
+ false
+ end
+
+ # Delete an entry from the cache.
+ def delete_entry(key, options) # :nodoc:
+ response = @data.delete(escape_key(key))
+ response == Response::DELETED
+ rescue MemCache::MemCacheError => e
+ logger.error("MemCacheError (#{e}): #{e.message}") if logger
+ false
+ end
+
+ private
+ def escape_key(key)
+ key = key.to_s.gsub(ESCAPE_KEY_CHARS){|match| "%#{match.getbyte(0).to_s(16).upcase}"}
+ key = "#{key[0, 213]}:md5:#{Digest::MD5.hexdigest(key)}" if key.size > 250
+ key
+ end
+
+ def deserialize_entry(raw_value)
+ if raw_value
+ entry = Marshal.load(raw_value) rescue raw_value
+ entry.is_a?(Entry) ? entry : Entry.new(entry)
+ else
+ nil
+ end
+ end
+
+ # Provide support for raw values in the local cache strategy.
+ module LocalCacheWithRaw # :nodoc:
+ protected
+ def write_entry(key, entry, options) # :nodoc:
+ retval = super
+ if options[:raw] && local_cache && retval
+ raw_entry = Entry.new(entry.value.to_s)
+ raw_entry.expires_at = entry.expires_at
+ local_cache.write_entry(key, raw_entry, options)
+ end
+ retval
+ end
+ end
+ end
+ end
+end
View
159 ...ronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/memory_store.rb
@@ -0,0 +1,159 @@
+require 'monitor'
+
+module ActiveSupport
+ module Cache
+ # A cache store implementation which stores everything into memory in the
+ # same process. If you're running multiple Ruby on Rails server processes
+ # (which is the case if you're using mongrel_cluster or Phusion Passenger),
+ # then this means that Rails server process instances won't be able
+ # to share cache data with each other and this may not be the most
+ # appropriate cache in that scenario.
+ #
+ # This cache has a bounded size specified by the :size options to the
+ # initializer (default is 32Mb). When the cache exceeds the allotted size,
+ # a cleanup will occur which tries to prune the cache down to three quarters
+ # of the maximum size by removing the least recently used entries.
+ #
+ # MemoryStore is thread-safe.
+ class MemoryStore < Store
+ def initialize(options = nil)
+ options ||= {}
+ super(options)
+ @data = {}
+ @key_access = {}
+ @max_size = options[:size] || 32.megabytes
+ @max_prune_time = options[:max_prune_time] || 2
+ @cache_size = 0
+ @monitor = Monitor.new
+ @pruning = false
+ end
+
+ def clear(options = nil)
+ synchronize do
+ @data.clear
+ @key_access.clear
+ @cache_size = 0
+ end
+ end
+
+ def cleanup(options = nil)
+ options = merged_options(options)
+ instrument(:cleanup, :size => @data.size) do
+ keys = synchronize{ @data.keys }
+ keys.each do |key|
+ entry = @data[key]
+ delete_entry(key, options) if entry && entry.expired?
+ end
+ end
+ end
+
+ # To ensure entries fit within the specified memory prune the cache by removing the least
+ # recently accessed entries.
+ def prune(target_size, max_time = nil)
+ return if pruning?
+ @pruning = true
+ begin
+ start_time = Time.now
+ cleanup
+ instrument(:prune, target_size, :from => @cache_size) do
+ keys = synchronize{ @key_access.keys.sort{|a,b| @key_access[a].to_f <=> @key_access[b].to_f} }
+ keys.each do |key|
+ delete_entry(key, options)
+ return if @cache_size <= target_size || (max_time && Time.now - start_time > max_time)
+ end
+ end
+ ensure
+ @pruning = false
+ end
+ end
+
+ # Returns true if the cache is currently being pruned.
+ def pruning?
+ @pruning
+ end
+
+ # Increment an integer value in the cache.
+ def increment(name, amount = 1, options = nil)
+ synchronize do
+ options = merged_options(options)
+ if num = read(name, options)
+ num = num.to_i + amount
+ write(name, num, options)
+ num
+ else
+ nil
+ end
+ end
+ end
+
+ # Decrement an integer value in the cache.
+ def decrement(name, amount = 1, options = nil)
+ synchronize do
+ options = merged_options(options)
+ if num = read(name, options)
+ num = num.to_i - amount
+ write(name, num, options)
+ num
+ else
+ nil
+ end
+ end
+ end
+
+ def delete_matched(matcher, options = nil)
+ options = merged_options(options)
+ instrument(:delete_matched, matcher.inspect) do
+ matcher = key_matcher(matcher, options)
+ keys = synchronize { @data.keys }
+ keys.each do |key|
+ delete_entry(key, options) if key.match(matcher)
+ end
+ end
+ end
+
+ def inspect # :nodoc:
+ "<##{self.class.name} entries=#{@data.size}, size=#{@cache_size}, options=#{@options.inspect}>"
+ end
+
+ # Synchronize calls to the cache. This should be called wherever the underlying cache implementation
+ # is not thread safe.
+ def synchronize(&block) # :nodoc:
+ @monitor.synchronize(&block)
+ end
+
+ protected
+ def read_entry(key, options) # :nodoc:
+ entry = @data[key]
+ synchronize do
+ if entry
+ @key_access[key] = Time.now.to_f
+ else
+ @key_access.delete(key)
+ end
+ end
+ entry
+ end
+
+ def write_entry(key, entry, options) # :nodoc:
+ synchronize do
+ old_entry = @data[key]
+ @cache_size -= old_entry.size if old_entry
+ @cache_size += entry.size
+ @key_access[key] = Time.now.to_f
+ @data[key] = entry
+ prune(@max_size * 0.75, @max_prune_time) if @cache_size > @max_size
+ true
+ end
+ end
+
+ def delete_entry(key, options) # :nodoc:
+ synchronize do
+ @key_access.delete(key)
+ entry = @data.delete(key)
+ @cache_size -= entry.size if entry
+ !!entry
+ end
+ end
+ end
+ end
+end
View
164 ...ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/strategy/local_cache.rb
@@ -0,0 +1,164 @@
+require 'active_support/core_ext/object/duplicable'
+require 'active_support/core_ext/string/inflections'
+
+module ActiveSupport
+ module Cache
+ module Strategy
+ # Caches that implement LocalCache will be backed by an in memory cache for the
+ # duration of a block. Repeated calls to the cache for the same key will hit the
+ # in memory cache for faster access.
+ module LocalCache
+ # Simple memory backed cache. This cache is not thread safe and is intended only
+ # for serving as a temporary memory cache for a single thread.
+ class LocalStore < Store
+ def initialize
+ super
+ @data = {}
+ end
+
+ # Don't allow synchronizing since it isn't thread safe,
+ def synchronize # :nodoc:
+ yield
+ end
+
+ def clear(options = nil)
+ @data.clear
+ end
+
+ def read_entry(key, options)
+ @data[key]
+ end
+
+ def write_entry(key, value, options)
+ @data[key] = value
+ true
+ end
+
+ def delete_entry(key, options)
+ !!@data.delete(key)
+ end
+ end
+
+ # Use a local cache for the duration of block.
+ def with_local_cache
+ save_val = Thread.current[thread_local_key]
+ begin
+ Thread.current[thread_local_key] = LocalStore.new
+ yield
+ ensure
+ Thread.current[thread_local_key] = save_val
+ end
+ end
+
+ # Middleware class can be inserted as a Rack handler to be local cache for the
+ # duration of request.
+ def middleware
+ @middleware ||= begin
+ klass = Class.new
+ klass.class_eval(<<-EOS, __FILE__, __LINE__ + 1)
+ class << self
+ def name
+ "ActiveSupport::Cache::Strategy::LocalCache"
+ end
+ alias :to_s :name
+ end
+
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ Thread.current[:#{thread_local_key}] = LocalStore.new
+ @app.call(env)
+ ensure
+ Thread.current[:#{thread_local_key}] = nil
+ end
+ EOS
+ klass
+ end
+ end
+
+ def clear(options = nil) # :nodoc:
+ local_cache.clear(options) if local_cache
+ super
+ end
+
+ def cleanup(options = nil) # :nodoc:
+ local_cache.clear(options) if local_cache
+ super
+ end
+
+ def increment(name, amount = 1, options = nil) # :nodoc:
+ value = bypass_local_cache{super}
+ if local_cache
+ local_cache.mute do
+ if value
+ local_cache.write(name, value, options)
+ else
+ local_cache.delete(name, options)
+ end
+ end
+ end
+ value
+ end
+
+ def decrement(name, amount = 1, options = nil) # :nodoc:
+ value = bypass_local_cache{super}
+ if local_cache
+ local_cache.mute do
+ if value
+ local_cache.write(name, value, options)
+ else
+ local_cache.delete(name, options)
+ end
+ end
+ end
+ value
+ end
+
+ protected
+ def read_entry(key, options) # :nodoc:
+ if local_cache
+ entry = local_cache.read_entry(key, options)
+ unless entry
+ entry = super
+ local_cache.write_entry(key, entry, options)
+ end
+ entry
+ else
+ super
+ end
+ end
+
+ def write_entry(key, entry, options) # :nodoc:
+ local_cache.write_entry(key, entry, options) if local_cache
+ super
+ end
+
+ def delete_entry(key, options) # :nodoc:
+ local_cache.delete_entry(key, options) if local_cache
+ super
+ end
+
+ private
+ def thread_local_key
+ @thread_local_key ||= "#{self.class.name.underscore}_local_cache_#{object_id}".gsub(/[\/-]/, '_').to_sym
+ end
+
+ def local_cache
+ Thread.current[thread_local_key]
+ end
+
+ def bypass_local_cache
+ save_cache = Thread.current[thread_local_key]
+ begin
+ Thread.current[thread_local_key] = nil
+ yield
+ ensure
+ Thread.current[thread_local_key] = save_cache
+ end
+ end
+ end
+ end
+ end
+end
View
11 ...gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/cache/synchronized_memory_store.rb
@@ -0,0 +1,11 @@
+module ActiveSupport
+ module Cache
+ # Like MemoryStore, but thread-safe.
+ class SynchronizedMemoryStore < MemoryStore
+ def initialize(*args)
+ ActiveSupport::Deprecation.warn('ActiveSupport::Cache::SynchronizedMemoryStore has been deprecated in favor of ActiveSupport::Cache::MemoryStore.', caller)
+ super
+ end
+ end
+ end
+end
View
600 .../IronSP_IronRuby/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/callbacks.rb
@@ -0,0 +1,600 @@
+require 'active_support/descendants_tracker'
+require 'active_support/core_ext/array/wrap'
+require 'active_support/core_ext/class/inheritable_attributes'
+require 'active_support/core_ext/kernel/reporting'
+require 'active_support/core_ext/kernel/singleton_class'
+
+module ActiveSupport
+ # Callbacks are hooks into the life cycle of an object that allow you to trigger logic
+ # before or after an alteration of the object state.
+ #
+ # Mixing in this module allows you to define callbacks in your class.
+ #
+ # Example:
+ # class Storage
+ # include ActiveSupport::Callbacks
+ #
+ # define_callbacks :save
+ # end
+ #
+ # class ConfigStorage < Storage
+ # set_callback :save, :before, :saving_message
+ # def saving_message
+ # puts "saving..."
+ # end
+ #
+ # set_callback :save, :after do |object|
+ # puts "saved"
+ # end
+ #
+ # def save
+ # run_callbacks :save do
+ # puts "- save"
+ # end
+ # end
+ # end
+ #
+ # config = ConfigStorage.new
+ # config.save
+ #
+ # Output:
+ # saving...
+ # - save
+ # saved
+ #
+ # Callbacks from parent classes are inherited.
+ #
+ # Example:
+ # class Storage
+ # include ActiveSupport::Callbacks
+ #
+ # define_callbacks :save
+ #
+ # set_callback :save, :before, :prepare
+ # def prepare
+ # puts "preparing save"
+ # end
+ # end
+ #
+ # class ConfigStorage < Storage
+ # set_callback :save, :before, :saving_message
+ # def saving_message
+ # puts "saving..."
+ # end
+ #
+ # set_callback :save, :after do |object|
+ # puts "saved"
+ # end
+ #
+ # def save
+ # run_callbacks :save do
+ # puts "- save"
+ # end
+ # end
+ # end
+ #
+ # config = ConfigStorage.new
+ # config.save
+ #
+ # Output:
+ # preparing save
+ # saving...
+ # - save
+ # saved
+ #
+ module Callbacks
+ extend Concern
+
+ included do
+ extend ActiveSupport::DescendantsTracker
+ end
+
+ def run_callbacks(kind, *args, &block)
+ send("_run_#{kind}_callbacks", *args, &block)
+ end
+
+ def callback(kind)
+ ActiveSupport::Deprecation.warn("callback is deprecated. Please use run_callbacks")
+ send("_run_#{kind}_callbacks")
+ end
+
+ class Callback
+ @@_callback_sequence = 0
+
+ attr_accessor :chain, :filter, :kind, :options, :per_key, :klass, :raw_filter
+
+ def initialize(chain, filter, kind, options, klass)
+ @chain, @kind, @klass = chain, kind, klass
+ normalize_options!(options)
+
+ @per_key = options.delete(:per_key)
+ @raw_filter, @options = filter, options
+ @filter = _compile_filter(filter)
+ @compiled_options = _compile_options(options)
+ @callback_id = next_id
+
+ _compile_per_key_options
+ end
+
+ def clone(chain, klass)
+ obj = super()
+ obj.chain = chain
+ obj.klass = klass
+ obj.per_key = @per_key.dup
+ obj.options = @options.dup
+ obj.per_key[:if] = @per_key[:if].dup
+ obj.per_key[:unless] = @per_key[:unless].dup
+ obj.options[:if] = @options[:if].dup
+ obj.options[:unless] = @options[:unless].dup
+ obj
+ end
+
+ def normalize_options!(options)
+ options[:if] = Array.wrap(options[:if])
+ options[:unless] = Array.wrap(options[:unless])
+
+ options[:per_key] ||= {}
+ options[:per_key][:if] = Array.wrap(options[:per_key][:if])
+ options[:per_key][:unless] = Array.wrap(options[:per_key][:unless])
+ end
+
+ def name
+ chain.name
+ end
+
+ def next_id
+ @@_callback_sequence += 1
+ end
+
+ def matches?(_kind, _filter)
+ @kind == _kind && @filter == _filter
+ end
+
+ def _update_filter(filter_options, new_options)
+ filter_options[:if].push(new_options[:unless]) if new_options.key?(:unless)
+ filter_options[:unless].push(new_options[:if]) if new_options.key?(:if)
+ end