benschwarz-smoke 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. data/Rakefile +6 -0
  2. data/VERSION.yml +1 -1
  3. metadata +65 -196
  4. data/Gemfile +0 -10
  5. data/bin/edit_json.rb +0 -3
  6. data/bin/restclient +0 -3
  7. data/vendor/gems/cache/crack-0.1.1.gem +0 -0
  8. data/vendor/gems/cache/fakeweb-1.2.5.gem +0 -0
  9. data/vendor/gems/cache/json-1.1.3.gem +0 -0
  10. data/vendor/gems/cache/rest-client-1.0.1.gem +0 -0
  11. data/vendor/gems/cache/simple-rss-1.2.gem +0 -0
  12. data/vendor/gems/cache/wycats-moneta-0.6.0.gem +0 -0
  13. data/vendor/gems/environment.rb +0 -83
  14. data/vendor/gems/gems/crack-0.1.1/LICENSE +0 -20
  15. data/vendor/gems/gems/crack-0.1.1/README.rdoc +0 -22
  16. data/vendor/gems/gems/crack-0.1.1/VERSION.yml +0 -4
  17. data/vendor/gems/gems/crack-0.1.1/lib/crack.rb +0 -7
  18. data/vendor/gems/gems/crack-0.1.1/lib/crack/core_extensions.rb +0 -126
  19. data/vendor/gems/gems/crack-0.1.1/lib/crack/json.rb +0 -66
  20. data/vendor/gems/gems/crack-0.1.1/lib/crack/xml.rb +0 -211
  21. data/vendor/gems/gems/crack-0.1.1/test/crack_test.rb +0 -4
  22. data/vendor/gems/gems/crack-0.1.1/test/json_test.rb +0 -42
  23. data/vendor/gems/gems/crack-0.1.1/test/test_helper.rb +0 -12
  24. data/vendor/gems/gems/crack-0.1.1/test/xml_test.rb +0 -451
  25. data/vendor/gems/gems/fakeweb-1.2.5/CHANGELOG +0 -163
  26. data/vendor/gems/gems/fakeweb-1.2.5/LICENSE.txt +0 -281
  27. data/vendor/gems/gems/fakeweb-1.2.5/README.rdoc +0 -193
  28. data/vendor/gems/gems/fakeweb-1.2.5/Rakefile +0 -76
  29. data/vendor/gems/gems/fakeweb-1.2.5/lib/fake_web.rb +0 -172
  30. data/vendor/gems/gems/fakeweb-1.2.5/lib/fake_web/ext/net_http.rb +0 -71
  31. data/vendor/gems/gems/fakeweb-1.2.5/lib/fake_web/registry.rb +0 -103
  32. data/vendor/gems/gems/fakeweb-1.2.5/lib/fake_web/responder.rb +0 -113
  33. data/vendor/gems/gems/fakeweb-1.2.5/lib/fake_web/response.rb +0 -10
  34. data/vendor/gems/gems/fakeweb-1.2.5/lib/fake_web/stub_socket.rb +0 -15
  35. data/vendor/gems/gems/fakeweb-1.2.5/lib/fake_web/utility.rb +0 -22
  36. data/vendor/gems/gems/fakeweb-1.2.5/lib/fakeweb.rb +0 -2
  37. data/vendor/gems/gems/fakeweb-1.2.5/test/fixtures/google_response_from_curl +0 -12
  38. data/vendor/gems/gems/fakeweb-1.2.5/test/fixtures/google_response_with_transfer_encoding +0 -17
  39. data/vendor/gems/gems/fakeweb-1.2.5/test/fixtures/google_response_without_transfer_encoding +0 -11
  40. data/vendor/gems/gems/fakeweb-1.2.5/test/fixtures/test_example.txt +0 -1
  41. data/vendor/gems/gems/fakeweb-1.2.5/test/fixtures/test_txt_file +0 -3
  42. data/vendor/gems/gems/fakeweb-1.2.5/test/test_allow_net_connect.rb +0 -85
  43. data/vendor/gems/gems/fakeweb-1.2.5/test/test_deprecations.rb +0 -54
  44. data/vendor/gems/gems/fakeweb-1.2.5/test/test_fake_authentication.rb +0 -92
  45. data/vendor/gems/gems/fakeweb-1.2.5/test/test_fake_web.rb +0 -518
  46. data/vendor/gems/gems/fakeweb-1.2.5/test/test_fake_web_open_uri.rb +0 -58
  47. data/vendor/gems/gems/fakeweb-1.2.5/test/test_helper.rb +0 -74
  48. data/vendor/gems/gems/fakeweb-1.2.5/test/test_missing_open_uri.rb +0 -25
  49. data/vendor/gems/gems/fakeweb-1.2.5/test/test_precedence.rb +0 -51
  50. data/vendor/gems/gems/fakeweb-1.2.5/test/test_query_string.rb +0 -45
  51. data/vendor/gems/gems/fakeweb-1.2.5/test/test_regexes.rb +0 -103
  52. data/vendor/gems/gems/fakeweb-1.2.5/test/test_response_headers.rb +0 -67
  53. data/vendor/gems/gems/fakeweb-1.2.5/test/test_trailing_slashes.rb +0 -53
  54. data/vendor/gems/gems/fakeweb-1.2.5/test/test_utility.rb +0 -70
  55. data/vendor/gems/gems/json-1.1.3/CHANGES +0 -93
  56. data/vendor/gems/gems/json-1.1.3/GPL +0 -340
  57. data/vendor/gems/gems/json-1.1.3/README +0 -78
  58. data/vendor/gems/gems/json-1.1.3/RUBY +0 -58
  59. data/vendor/gems/gems/json-1.1.3/Rakefile +0 -309
  60. data/vendor/gems/gems/json-1.1.3/TODO +0 -1
  61. data/vendor/gems/gems/json-1.1.3/VERSION +0 -1
  62. data/vendor/gems/gems/json-1.1.3/benchmarks/benchmark.txt +0 -133
  63. data/vendor/gems/gems/json-1.1.3/benchmarks/benchmark_generator.rb +0 -48
  64. data/vendor/gems/gems/json-1.1.3/benchmarks/benchmark_parser.rb +0 -26
  65. data/vendor/gems/gems/json-1.1.3/benchmarks/benchmark_rails.rb +0 -26
  66. data/vendor/gems/gems/json-1.1.3/bin/edit_json.rb +0 -10
  67. data/vendor/gems/gems/json-1.1.3/bin/prettify_json.rb +0 -76
  68. data/vendor/gems/gems/json-1.1.3/data/example.json +0 -1
  69. data/vendor/gems/gems/json-1.1.3/data/index.html +0 -38
  70. data/vendor/gems/gems/json-1.1.3/data/prototype.js +0 -4184
  71. data/vendor/gems/gems/json-1.1.3/ext/json/ext/generator.bundle +0 -0
  72. data/vendor/gems/gems/json-1.1.3/ext/json/ext/generator/Makefile +0 -150
  73. data/vendor/gems/gems/json-1.1.3/ext/json/ext/generator/extconf.rb +0 -9
  74. data/vendor/gems/gems/json-1.1.3/ext/json/ext/generator/generator.bundle +0 -0
  75. data/vendor/gems/gems/json-1.1.3/ext/json/ext/generator/generator.c +0 -875
  76. data/vendor/gems/gems/json-1.1.3/ext/json/ext/generator/generator.o +0 -0
  77. data/vendor/gems/gems/json-1.1.3/ext/json/ext/generator/unicode.c +0 -182
  78. data/vendor/gems/gems/json-1.1.3/ext/json/ext/generator/unicode.h +0 -53
  79. data/vendor/gems/gems/json-1.1.3/ext/json/ext/generator/unicode.o +0 -0
  80. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser.bundle +0 -0
  81. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser/Makefile +0 -150
  82. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser/extconf.rb +0 -9
  83. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser/parser.bundle +0 -0
  84. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser/parser.c +0 -1758
  85. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser/parser.o +0 -0
  86. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser/parser.rl +0 -638
  87. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser/unicode.c +0 -154
  88. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser/unicode.h +0 -58
  89. data/vendor/gems/gems/json-1.1.3/ext/json/ext/parser/unicode.o +0 -0
  90. data/vendor/gems/gems/json-1.1.3/install.rb +0 -26
  91. data/vendor/gems/gems/json-1.1.3/lib/json.rb +0 -235
  92. data/vendor/gems/gems/json-1.1.3/lib/json/Array.xpm +0 -21
  93. data/vendor/gems/gems/json-1.1.3/lib/json/FalseClass.xpm +0 -21
  94. data/vendor/gems/gems/json-1.1.3/lib/json/Hash.xpm +0 -21
  95. data/vendor/gems/gems/json-1.1.3/lib/json/Key.xpm +0 -73
  96. data/vendor/gems/gems/json-1.1.3/lib/json/NilClass.xpm +0 -21
  97. data/vendor/gems/gems/json-1.1.3/lib/json/Numeric.xpm +0 -28
  98. data/vendor/gems/gems/json-1.1.3/lib/json/String.xpm +0 -96
  99. data/vendor/gems/gems/json-1.1.3/lib/json/TrueClass.xpm +0 -21
  100. data/vendor/gems/gems/json-1.1.3/lib/json/add/core.rb +0 -135
  101. data/vendor/gems/gems/json-1.1.3/lib/json/add/rails.rb +0 -58
  102. data/vendor/gems/gems/json-1.1.3/lib/json/common.rb +0 -354
  103. data/vendor/gems/gems/json-1.1.3/lib/json/editor.rb +0 -1362
  104. data/vendor/gems/gems/json-1.1.3/lib/json/ext.rb +0 -13
  105. data/vendor/gems/gems/json-1.1.3/lib/json/json.xpm +0 -1499
  106. data/vendor/gems/gems/json-1.1.3/lib/json/pure.rb +0 -75
  107. data/vendor/gems/gems/json-1.1.3/lib/json/pure/generator.rb +0 -394
  108. data/vendor/gems/gems/json-1.1.3/lib/json/pure/parser.rb +0 -259
  109. data/vendor/gems/gems/json-1.1.3/lib/json/version.rb +0 -9
  110. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail1.json +0 -1
  111. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail10.json +0 -1
  112. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail11.json +0 -1
  113. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail12.json +0 -1
  114. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail13.json +0 -1
  115. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail14.json +0 -1
  116. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail18.json +0 -1
  117. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail19.json +0 -1
  118. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail2.json +0 -1
  119. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail20.json +0 -1
  120. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail21.json +0 -1
  121. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail22.json +0 -1
  122. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail23.json +0 -1
  123. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail24.json +0 -1
  124. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail25.json +0 -1
  125. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail27.json +0 -2
  126. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail28.json +0 -2
  127. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail3.json +0 -1
  128. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail4.json +0 -1
  129. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail5.json +0 -1
  130. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail6.json +0 -1
  131. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail7.json +0 -1
  132. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail8.json +0 -1
  133. data/vendor/gems/gems/json-1.1.3/tests/fixtures/fail9.json +0 -1
  134. data/vendor/gems/gems/json-1.1.3/tests/fixtures/pass1.json +0 -56
  135. data/vendor/gems/gems/json-1.1.3/tests/fixtures/pass15.json +0 -1
  136. data/vendor/gems/gems/json-1.1.3/tests/fixtures/pass16.json +0 -1
  137. data/vendor/gems/gems/json-1.1.3/tests/fixtures/pass17.json +0 -1
  138. data/vendor/gems/gems/json-1.1.3/tests/fixtures/pass2.json +0 -1
  139. data/vendor/gems/gems/json-1.1.3/tests/fixtures/pass26.json +0 -1
  140. data/vendor/gems/gems/json-1.1.3/tests/fixtures/pass3.json +0 -6
  141. data/vendor/gems/gems/json-1.1.3/tests/runner.rb +0 -25
  142. data/vendor/gems/gems/json-1.1.3/tests/test_json.rb +0 -293
  143. data/vendor/gems/gems/json-1.1.3/tests/test_json_addition.rb +0 -161
  144. data/vendor/gems/gems/json-1.1.3/tests/test_json_fixtures.rb +0 -30
  145. data/vendor/gems/gems/json-1.1.3/tests/test_json_generate.rb +0 -100
  146. data/vendor/gems/gems/json-1.1.3/tests/test_json_rails.rb +0 -118
  147. data/vendor/gems/gems/json-1.1.3/tests/test_json_unicode.rb +0 -61
  148. data/vendor/gems/gems/json-1.1.3/tools/fuzz.rb +0 -140
  149. data/vendor/gems/gems/json-1.1.3/tools/server.rb +0 -62
  150. data/vendor/gems/gems/rest-client-1.0.1/README.rdoc +0 -151
  151. data/vendor/gems/gems/rest-client-1.0.1/Rakefile +0 -85
  152. data/vendor/gems/gems/rest-client-1.0.1/bin/restclient +0 -87
  153. data/vendor/gems/gems/rest-client-1.0.1/lib/rest_client.rb +0 -2
  154. data/vendor/gems/gems/rest-client-1.0.1/lib/restclient.rb +0 -93
  155. data/vendor/gems/gems/rest-client-1.0.1/lib/restclient/exceptions.rb +0 -84
  156. data/vendor/gems/gems/rest-client-1.0.1/lib/restclient/mixin/response.rb +0 -43
  157. data/vendor/gems/gems/rest-client-1.0.1/lib/restclient/raw_response.rb +0 -30
  158. data/vendor/gems/gems/rest-client-1.0.1/lib/restclient/request.rb +0 -236
  159. data/vendor/gems/gems/rest-client-1.0.1/lib/restclient/resource.rb +0 -146
  160. data/vendor/gems/gems/rest-client-1.0.1/lib/restclient/response.rb +0 -20
  161. data/vendor/gems/gems/rest-client-1.0.1/spec/base.rb +0 -4
  162. data/vendor/gems/gems/rest-client-1.0.1/spec/exceptions_spec.rb +0 -54
  163. data/vendor/gems/gems/rest-client-1.0.1/spec/mixin/response_spec.rb +0 -46
  164. data/vendor/gems/gems/rest-client-1.0.1/spec/raw_response_spec.rb +0 -17
  165. data/vendor/gems/gems/rest-client-1.0.1/spec/request_spec.rb +0 -462
  166. data/vendor/gems/gems/rest-client-1.0.1/spec/resource_spec.rb +0 -75
  167. data/vendor/gems/gems/rest-client-1.0.1/spec/response_spec.rb +0 -16
  168. data/vendor/gems/gems/rest-client-1.0.1/spec/restclient_spec.rb +0 -53
  169. data/vendor/gems/gems/simple-rss-1.2/LICENSE +0 -429
  170. data/vendor/gems/gems/simple-rss-1.2/README +0 -43
  171. data/vendor/gems/gems/simple-rss-1.2/Rakefile +0 -212
  172. data/vendor/gems/gems/simple-rss-1.2/lib/simple-rss.rb +0 -149
  173. data/vendor/gems/gems/simple-rss-1.2/test/base/base_test.rb +0 -51
  174. data/vendor/gems/gems/simple-rss-1.2/test/data/atom.xml +0 -45
  175. data/vendor/gems/gems/simple-rss-1.2/test/data/not-rss.xml +0 -8
  176. data/vendor/gems/gems/simple-rss-1.2/test/data/rss09.rdf +0 -79
  177. data/vendor/gems/gems/simple-rss-1.2/test/data/rss20.xml +0 -818
  178. data/vendor/gems/gems/simple-rss-1.2/test/test_helper.rb +0 -4
  179. data/vendor/gems/gems/wycats-moneta-0.6.0/LICENSE +0 -20
  180. data/vendor/gems/gems/wycats-moneta-0.6.0/README +0 -50
  181. data/vendor/gems/gems/wycats-moneta-0.6.0/Rakefile +0 -60
  182. data/vendor/gems/gems/wycats-moneta-0.6.0/TODO +0 -4
  183. data/vendor/gems/gems/wycats-moneta-0.6.0/lib/moneta.rb +0 -76
  184. data/vendor/gems/gems/wycats-moneta-0.6.0/lib/moneta/datamapper.rb +0 -117
  185. data/vendor/gems/gems/wycats-moneta-0.6.0/lib/moneta/file.rb +0 -91
  186. data/vendor/gems/gems/wycats-moneta-0.6.0/lib/moneta/memcache.rb +0 -52
  187. data/vendor/gems/gems/wycats-moneta-0.6.0/lib/moneta/memory.rb +0 -11
  188. data/vendor/gems/gems/wycats-moneta-0.6.0/lib/moneta/xattr.rb +0 -58
  189. data/vendor/gems/specifications/crack-0.1.1.gemspec +0 -29
  190. data/vendor/gems/specifications/fakeweb-1.2.5.gemspec +0 -34
  191. data/vendor/gems/specifications/json-1.1.3.gemspec +0 -33
  192. data/vendor/gems/specifications/rest-client-1.0.1.gemspec +0 -30
  193. data/vendor/gems/specifications/simple-rss-1.2.gemspec +0 -27
  194. data/vendor/gems/specifications/wycats-moneta-0.6.0.gemspec +0 -29
@@ -1,4 +0,0 @@
1
- $:.unshift(File.dirname(__FILE__) + '/../lib')
2
-
3
- require 'test/unit'
4
- require 'simple-rss'
@@ -1,20 +0,0 @@
1
- Copyright (c) 2009 Yehuda Katz
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,50 +0,0 @@
1
- Moneta: A unified interface for key/value stores
2
- ================================================
3
-
4
- Moneta provides a standard interface for interacting with various kinds of key/value stores.
5
-
6
- Out of the box, it supports:
7
-
8
- * File store
9
- * Memcache store
10
- * In-memory store
11
- * The xattrs in a file system
12
- * DataMapper
13
- * S3
14
- * Berkeley DB
15
- * Redis
16
- * SDBM
17
- * Tokyo
18
- * CouchDB
19
-
20
- All stores support key expiration, but only memcache supports it natively. All other stores
21
- emulate expiration.
22
-
23
- The Moneta API is purposely extremely similar to the Hash API. In order so support an
24
- identical API across stores, it does not support iteration or partial matches, but that
25
- might come in a future release.
26
-
27
- The API:
28
-
29
- #initialize(options):: options differs per-store, and is used to set up the store
30
-
31
- #[](key):: retrieve a key. if the key is not available, return nil
32
-
33
- #[]=(key, value):: set a value for a key. if the key is already used, clobber it.
34
- keys set using []= will never expire
35
-
36
- #delete(key):: delete the key from the store and return the current value
37
-
38
- #key?(key):: true if the key exists, false if it does not
39
-
40
- #has_key?(key):: alias for key?
41
-
42
- #store(key, value, options):: same as []=, but you can supply an :expires_in option,
43
- which will specify a number of seconds before the key
44
- should expire. In order to support the same features
45
- across all stores, only full seconds are supported
46
-
47
- #update_key(key, options):: updates an existing key with a new :expires_in option.
48
- if the key has already expired, it will not be updated.
49
-
50
- #clear:: clear all keys in this store
@@ -1,60 +0,0 @@
1
- require 'rubygems'
2
- require 'rake/gempackagetask'
3
- require 'rubygems/specification'
4
- require 'spec/rake/spectask'
5
- require 'date'
6
-
7
- GEM = "moneta"
8
- GEM_VERSION = "0.5.0"
9
- AUTHOR = "Yehuda Katz"
10
- EMAIL = "wycats@gmail.com"
11
- HOMEPAGE = "http://www.yehudakatz.com"
12
- SUMMARY = "A unified interface to key/value stores"
13
-
14
- spec = Gem::Specification.new do |s|
15
- s.name = GEM
16
- s.version = GEM_VERSION
17
- s.platform = Gem::Platform::RUBY
18
- s.has_rdoc = true
19
- s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
20
- s.summary = SUMMARY
21
- s.description = s.summary
22
- s.author = AUTHOR
23
- s.email = EMAIL
24
- s.homepage = HOMEPAGE
25
-
26
- # Uncomment this to add a dependency
27
- # s.add_dependency "foo"
28
-
29
- s.require_path = 'lib'
30
- s.autorequire = GEM
31
- s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs}/**/*")
32
- end
33
-
34
- Rake::GemPackageTask.new(spec) do |pkg|
35
- pkg.gem_spec = spec
36
- end
37
-
38
- desc "install the gem locally"
39
- task :install => [:package] do
40
- sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
41
- end
42
-
43
- desc "create a gemspec file"
44
- task :make_spec do
45
- File.open("#{GEM}.gemspec", "w") do |file|
46
- file.puts spec.to_ruby
47
- end
48
- end
49
-
50
- desc "Run all examples (or a specific spec with TASK=xxxx)"
51
- Spec::Rake::SpecTask.new('spec') do |t|
52
- t.spec_opts = ["-cfs"]
53
- t.spec_files = begin
54
- if ENV["TASK"]
55
- ENV["TASK"].split(',').map { |task| "spec/**/#{task}_spec.rb" }
56
- else
57
- FileList['spec/**/*_spec.rb']
58
- end
59
- end
60
- end
@@ -1,4 +0,0 @@
1
- TODO:
2
- Fix LICENSE with your name
3
- Fix Rakefile with your name and contact info
4
- Add your code to lib/<%= name %>.rb
@@ -1,76 +0,0 @@
1
- module Moneta
2
- module Expires
3
- def check_expired(key)
4
- if @expiration[key] && Time.now > @expiration[key]
5
- @expiration.delete(key)
6
- self.delete(key)
7
- end
8
- end
9
-
10
- def key?(key)
11
- check_expired(key)
12
- super
13
- end
14
-
15
- def [](key)
16
- check_expired(key)
17
- super
18
- end
19
-
20
- def fetch(key, default = nil, &blk)
21
- check_expired(key)
22
- super
23
- end
24
-
25
- def delete(key)
26
- check_expired(key)
27
- super
28
- end
29
-
30
- def update_key(key, options)
31
- update_options(key, options)
32
- end
33
-
34
- def store(key, value, options = {})
35
- ret = super(key, value)
36
- update_options(key, options)
37
- ret
38
- end
39
-
40
- private
41
- def update_options(key, options)
42
- if options[:expires_in]
43
- @expiration[key] = (Time.now + options[:expires_in])
44
- end
45
- end
46
- end
47
-
48
- module StringExpires
49
- include Expires
50
-
51
- def check_expired(key)
52
- if @expiration[key] && Time.now > Time.at(@expiration[key].to_i)
53
- @expiration.delete(key)
54
- delete(key)
55
- end
56
- end
57
-
58
- private
59
- def update_options(key, options)
60
- if options[:expires_in]
61
- @expiration[key] = (Time.now + options[:expires_in]).to_i.to_s
62
- end
63
- end
64
- end
65
-
66
- module Defaults
67
- def fetch(key, value = nil)
68
- value ||= block_given? ? yield(key) : default
69
- self[key] || value
70
- end
71
-
72
- def store(key, value, options = {})
73
- self[key] = value
74
- end
75
- end
76
- end
@@ -1,117 +0,0 @@
1
- begin
2
- gem "dm-core", "0.9.10"
3
- require "dm-core"
4
- rescue LoadError
5
- puts "You need the dm-core gem in order to use the DataMapper moneta store"
6
- exit
7
- end
8
-
9
- class MonetaHash
10
- include DataMapper::Resource
11
-
12
- property :the_key, String, :key => true
13
- property :value, Object, :lazy => false
14
- property :expires, Time
15
-
16
- def self.value(key)
17
- obj = self.get(key)
18
- obj && obj.value
19
- end
20
- end
21
-
22
- module Moneta
23
- class DataMapper
24
- class Expiration
25
- def initialize(klass, repository)
26
- @klass = klass
27
- @repository = repository
28
- end
29
-
30
- def [](key)
31
- if obj = get(key)
32
- obj.expires
33
- end
34
- end
35
-
36
- def []=(key, value)
37
- obj = get(key)
38
- obj.expires = value
39
- obj.save(@repository)
40
- end
41
-
42
- def delete(key)
43
- obj = get(key)
44
- obj.expires = nil
45
- obj.save(@repository)
46
- end
47
-
48
- private
49
- def get(key)
50
- repository(@repository) { @klass.get(key) }
51
- end
52
- end
53
-
54
- def initialize(options = {})
55
- @repository = options.delete(:repository) || :moneta
56
- ::DataMapper.setup(@repository, options[:setup])
57
- repository_context { MonetaHash.auto_upgrade! }
58
- @hash = MonetaHash
59
- @expiration = Expiration.new(MonetaHash, @repository)
60
- end
61
-
62
- module Implementation
63
- def key?(key)
64
- repository_context { !!@hash.get(key) }
65
- end
66
-
67
- def has_key?(key)
68
- repository_context { !!@hash.get(key) }
69
- end
70
-
71
- def [](key)
72
- repository_context { @hash.value(key) }
73
- end
74
-
75
- def []=(key, value)
76
- repository_context {
77
- obj = @hash.get(key)
78
- if obj
79
- obj.update(key, value)
80
- else
81
- @hash.create(:the_key => key, :value => value)
82
- end
83
- }
84
- end
85
-
86
- def fetch(key, value = nil)
87
- repository_context {
88
- value ||= block_given? ? yield(key) : default
89
- self[key] || value
90
- }
91
- end
92
-
93
- def delete(key)
94
- repository_context {
95
- value = self[key]
96
- @hash.all(:the_key => key).destroy!
97
- value
98
- }
99
- end
100
-
101
- def store(key, value, options = {})
102
- repository_context { self[key] = value }
103
- end
104
-
105
- def clear
106
- repository_context { @hash.all.destroy! }
107
- end
108
-
109
- private
110
- def repository_context
111
- repository(@repository) { yield }
112
- end
113
- end
114
- include Implementation
115
- include Expires
116
- end
117
- end
@@ -1,91 +0,0 @@
1
- begin
2
- require "xattr"
3
- rescue LoadError
4
- puts "You need the xattr gem to use the File moneta store"
5
- exit
6
- end
7
- require "fileutils"
8
-
9
- module Moneta
10
- class File
11
- class Expiration
12
- def initialize(directory)
13
- @directory = directory
14
- end
15
-
16
- def [](key)
17
- attrs = xattr(key)
18
- ret = Marshal.load(attrs.get("moneta_expires"))
19
- rescue Errno::ENOENT, SystemCallError
20
- end
21
-
22
- def []=(key, value)
23
- attrs = xattr(key)
24
- attrs.set("moneta_expires", Marshal.dump(value))
25
- end
26
-
27
- def delete(key)
28
- attrs = xattr(key)
29
- attrs.remove("moneta_expires")
30
- end
31
-
32
- private
33
- def xattr(key)
34
- ::Xattr.new(::File.join(@directory, key))
35
- end
36
- end
37
-
38
- def initialize(options = {})
39
- @directory = options[:path]
40
- if ::File.file?(@directory)
41
- raise StandardError, "The path you supplied #{@directory} is a file"
42
- elsif !::File.exists?(@directory)
43
- FileUtils.mkdir_p(@directory)
44
- end
45
-
46
- @expiration = Expiration.new(@directory)
47
- end
48
-
49
- module Implementation
50
- def key?(key)
51
- ::File.exist?(path(key))
52
- end
53
-
54
- alias has_key? key?
55
-
56
- def [](key)
57
- if ::File.exist?(path(key))
58
- Marshal.load(::File.read(path(key)))
59
- end
60
- end
61
-
62
- def []=(key, value)
63
- ::File.open(path(key), "w") do |file|
64
- contents = Marshal.dump(value)
65
- file.puts(contents)
66
- end
67
- end
68
-
69
- def delete(key)
70
- value = self[key]
71
- FileUtils.rm(path(key))
72
- value
73
- rescue Errno::ENOENT
74
- end
75
-
76
- def clear
77
- FileUtils.rm_rf(@directory)
78
- FileUtils.mkdir(@directory)
79
- end
80
-
81
- private
82
- def path(key)
83
- ::File.join(@directory, key)
84
- end
85
- end
86
- include Implementation
87
- include Defaults
88
- include Expires
89
-
90
- end
91
- end
@@ -1,52 +0,0 @@
1
- begin
2
- require "memcached"
3
- rescue LoadError
4
- require "memcache"
5
- rescue LoadError
6
- puts "You need the memcache gem to use the Memcache moneta store"
7
- exit
8
- end
9
-
10
- module Moneta
11
- class Memcache
12
- include Defaults
13
-
14
- def initialize(options = {})
15
- @cache = MemCache.new(options.delete(:server), options)
16
- end
17
-
18
- def key?(key)
19
- !self[key].nil?
20
- end
21
-
22
- alias has_key? key?
23
-
24
- def [](key)
25
- @cache.get(key)
26
- end
27
-
28
- def []=(key, value)
29
- store(key, value)
30
- end
31
-
32
- def delete(key)
33
- value = self[key]
34
- @cache.delete(key) if value
35
- value
36
- end
37
-
38
- def store(key, value, options = {})
39
- args = [key, value, options[:expires_in]].compact
40
- @cache.set(*args)
41
- end
42
-
43
- def update_key(key, options = {})
44
- val = self[key]
45
- self.store(key, val, options)
46
- end
47
-
48
- def clear
49
- @cache.flush_all
50
- end
51
- end
52
- end