block_cache 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,3 +1,9 @@
1
- pkg/*
2
1
  *.gem
3
2
  .bundle
3
+
4
+ log/*
5
+ tmp
6
+ *.DS_Store
7
+ doc
8
+ pkg
9
+ *.gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ block_cache (0.0.1)
5
+ mongo_mapper
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ activesupport (3.0.3)
11
+ bson (1.1.5)
12
+ diff-lcs (1.1.2)
13
+ jnunemaker-validatable (1.8.4)
14
+ activesupport (>= 2.3.4)
15
+ mongo (1.1.5)
16
+ bson (>= 1.1.5)
17
+ mongo_mapper (0.8.6)
18
+ activesupport (>= 2.3.4)
19
+ jnunemaker-validatable (~> 1.8.4)
20
+ plucky (~> 0.3.6)
21
+ plucky (0.3.6)
22
+ mongo (~> 1.1)
23
+ rspec (2.4.0)
24
+ rspec-core (~> 2.4.0)
25
+ rspec-expectations (~> 2.4.0)
26
+ rspec-mocks (~> 2.4.0)
27
+ rspec-core (2.4.0)
28
+ rspec-expectations (2.4.0)
29
+ diff-lcs (~> 1.1.2)
30
+ rspec-mocks (2.4.0)
31
+
32
+ PLATFORMS
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ block_cache!
37
+ mongo_mapper
38
+ rspec
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ BlockCache
2
+ ==========
3
+
4
+ Simply, cache ruby block data in mongo.
5
+
6
+ usage:
7
+ ------
8
+
9
+ class TwitterPoller
10
+ include BlockCache
11
+
12
+ def twitter_latest
13
+ results = cache_overwrite_by request.path do
14
+ # your unreliable twitter call goes here...
15
+ end
16
+
17
+ render :json => results.to_json
18
+ end
19
+ end
20
+
21
+ To use wrap your flimsy external service call with this block and conditionally
22
+ raise an error if failure occurs. Most gems will handle this for you but if the block
23
+ raises, then previous value will be returned and no errors raised.
data/block_cache.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{uses mongo_mapper to cache block response strings.}
13
13
  s.description = %q{uses mongo_mapper to cache block response strings. Use case: wrap your twitter api call with a block, if twitter bugs out, raise an error and the last value will be returned}
14
14
 
15
- s.add_dependency('mongo_mapper')
15
+ s.add_dependency 'mongo_mapper'
16
16
  s.add_development_dependency "rspec"
17
17
  # s.rubyforge_project = "block_cache"
18
18
 
data/lib/block_cache.rb CHANGED
@@ -42,7 +42,7 @@ module BlockCache
42
42
  rescue => exception
43
43
  logger.info "block cache error(#{exception.to_s}) returned, rendering from mongo."
44
44
  logger.debug "Backtrace:\n\n#{exception.backtrace}\n\n"
45
- HoptoadNotifier.notify_hoptoad(exception) if RAILS_ENV["production"] and HOPTOAD_SUPPORTED
45
+ HoptoadNotifier.notify(exception) if RAILS_ENV["production"] and HOPTOAD_SUPPORTED
46
46
 
47
47
  return BlockCache::Record.find_by_block_key(key).try(:block_response)
48
48
  end
@@ -1,3 +1,3 @@
1
1
  module BlockCache
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
File without changes
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: block_cache
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Blake Chambers
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-05 00:00:00 -05:00
18
+ date: 2011-01-17 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -58,10 +58,13 @@ extra_rdoc_files: []
58
58
  files:
59
59
  - .gitignore
60
60
  - Gemfile
61
+ - Gemfile.lock
62
+ - README.md
61
63
  - Rakefile
62
64
  - block_cache.gemspec
63
65
  - lib/block_cache.rb
64
66
  - lib/block_cache/version.rb
67
+ - spec/block_cache_spec.rb
65
68
  has_rdoc: true
66
69
  homepage: http://rubygems.org/gems/block_cache
67
70
  licenses: []
@@ -96,5 +99,5 @@ rubygems_version: 1.3.7
96
99
  signing_key:
97
100
  specification_version: 3
98
101
  summary: uses mongo_mapper to cache block response strings.
99
- test_files: []
100
-
102
+ test_files:
103
+ - spec/block_cache_spec.rb