basiccache 0.0.25 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0f3a4de7f2c0ad75eca02cafac0fef3cac192ef
4
- data.tar.gz: 8d8817784a4f884df4ab9ea0f3f874bd5cf5ac50
3
+ metadata.gz: a810da737dd6cc8cf4019fc39d17ba359073a447
4
+ data.tar.gz: 313e818b1a3afcc03d68715ffd40a1ae00df5462
5
5
  SHA512:
6
- metadata.gz: d9a2895f54ea2488f6b37b5dbe2f24e5d0c52e4df3cd332abf6161a0c91c98baf7811c64a3b5d1ba6c53c07f99b9a312fd1d669f3a59c2c1cf162ddc8570bf9a
7
- data.tar.gz: 7565878ab0031d1afa91d40421e8aee40b847f7063db972fae36ba43de15b4c530e24716f0b418599a110a96c9b7bb86a0c72086fd1e1b732626d7dc00b59f00
6
+ metadata.gz: 8cda0382bb25719157c8d3fefff6015db5af7e3631a6fff6a940e2853ccf13aea75d7a5ae5498f0de6d3ebc6b99a2a97d2e6dbc3f65228110fa69fd642ccba57
7
+ data.tar.gz: 6d337ffe7e861b60b6375e6a9167154dde614a7a06d170b83ed84648f21f2f6bff740ef53031a3722b30ef1e5bc0f46de0fc2302525375f94aedd1a90d1edae4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- basiccache (0.0.25)
4
+ basiccache (0.0.27)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -14,20 +14,19 @@ GEM
14
14
  term-ansicolor
15
15
  thor
16
16
  diff-lcs (1.2.5)
17
- docile (1.1.0)
18
- fuubar (1.2.1)
19
- rspec (~> 2.0)
20
- rspec-instafail (~> 0.2.0)
21
- ruby-progressbar (~> 1.0)
17
+ docile (1.1.1)
18
+ fuubar (1.3.2)
19
+ rspec (>= 2.14.0, < 3.1.0)
20
+ ruby-progressbar (~> 1.3)
22
21
  hashr (0.0.22)
23
22
  mime-types (2.0)
24
23
  multi_json (1.8.2)
25
- parser (2.1.0.pre1)
24
+ parser (2.1.1)
26
25
  ast (~> 1.1)
27
26
  slop (~> 3.4, >= 3.4.5)
28
27
  powerpack (0.0.9)
29
28
  rainbow (1.1.4)
30
- rake (10.1.0)
29
+ rake (10.1.1)
31
30
  rest-client (1.6.7)
32
31
  mime-types (>= 1.16)
33
32
  rspec (2.14.1)
@@ -37,13 +36,12 @@ GEM
37
36
  rspec-core (2.14.7)
38
37
  rspec-expectations (2.14.4)
39
38
  diff-lcs (>= 1.1.3, < 2.0)
40
- rspec-instafail (0.2.4)
41
39
  rspec-mocks (2.14.4)
42
- rubocop (0.15.0)
43
- parser (~> 2.0)
40
+ rubocop (0.16.0)
41
+ parser (~> 2.1)
44
42
  powerpack (~> 0.0.6)
45
43
  rainbow (>= 1.1.4)
46
- ruby-progressbar (1.2.0)
44
+ ruby-progressbar (1.3.2)
47
45
  simplecov (0.8.2)
48
46
  docile (~> 1.1.0)
49
47
  multi_json
@@ -64,7 +62,7 @@ DEPENDENCIES
64
62
  basiccache!
65
63
  coveralls
66
64
  fuubar
67
- parser (~> 2.1.0.pre1)
65
+ parser
68
66
  rake
69
67
  rspec
70
68
  rubocop
data/Rakefile CHANGED
@@ -2,6 +2,11 @@ require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
  require 'rubocop/rake_task'
4
4
 
5
+ desc 'Update bundle'
6
+ task :bundle do
7
+ `bundle update`
8
+ end
9
+
5
10
  desc 'Run tests'
6
11
  RSpec::Core::RakeTask.new(:spec)
7
12
 
@@ -17,3 +22,4 @@ task :travislint do
17
22
  end
18
23
 
19
24
  task default: [:spec, :travislint, :rubocop, :build, :install]
25
+ task release: [:bundle]
data/basiccache.gemspec CHANGED
@@ -1,22 +1,23 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'basiccache'
3
- s.version = '0.0.25'
3
+ s.version = '0.0.27'
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
  s.summary = 'Provides a minimal key/value caching layer'
6
6
  s.description = "Allows an application to dynamically cache values and retrieve them later"
7
7
  s.authors = ['Les Aker']
8
8
  s.email = 'me@lesaker.org'
9
- s.files = `git ls-files`.split
10
- s.test_files = `git ls-files spec/*`.split
11
9
  s.homepage = 'https://github.com/akerl/basiccache'
12
10
  s.license = 'MIT'
13
11
 
12
+ s.files = `git ls-files`.split
13
+ s.test_files = `git ls-files spec/*`.split
14
+
14
15
  s.add_development_dependency 'rubocop'
15
16
  s.add_development_dependency 'travis-lint'
16
17
  s.add_development_dependency 'rake'
17
18
  s.add_development_dependency 'coveralls'
18
19
  s.add_development_dependency 'rspec'
19
20
  s.add_development_dependency 'fuubar'
20
- s.add_development_dependency 'parser', '~> 2.1.0.pre1'
21
+ s.add_development_dependency 'parser'
21
22
  end
22
23
 
data/lib/basiccache.rb CHANGED
@@ -20,7 +20,7 @@ module BasicCache
20
20
  # These methods return the name of the calling function 2 levels up
21
21
  # This allows them to return the name of whatever called Cache.cache()
22
22
 
23
- def get_caller
23
+ def caller_name
24
24
  NEW_CALL ? caller_locations(2, 1).first.label : caller[1][/`([^']*)'/, 1]
25
25
  end
26
26
  end
data/lib/caches/cache.rb CHANGED
@@ -24,7 +24,7 @@ module BasicCache
24
24
  # If not, run the code, cache the result, and return it
25
25
 
26
26
  def cache(key = nil, &code)
27
- key ||= BasicCache.get_caller
27
+ key ||= BasicCache.caller_name
28
28
  @store[key.to_sym] ||= code.call
29
29
  end
30
30
 
@@ -40,7 +40,7 @@ module BasicCache
40
40
  # (just a wrapper, designed to be redefined by subclasses)
41
41
 
42
42
  def include?(key = nil)
43
- key ||= BasicCache.get_caller
43
+ key ||= BasicCache.caller_name
44
44
  @store.include? key.to_sym
45
45
  end
46
46
 
@@ -48,7 +48,7 @@ module BasicCache
48
48
  # Retrieve cached value
49
49
 
50
50
  def [](key = nil)
51
- key ||= BasicCache.get_caller
51
+ key ||= BasicCache.caller_name
52
52
  fail KeyError, 'Key not cached' unless include? key.to_sym
53
53
  @store[key.to_sym]
54
54
  end
@@ -18,7 +18,7 @@ module BasicCache
18
18
  # If the key is cached but expired, clear it
19
19
 
20
20
  def cache(key = nil, &code)
21
- key ||= BasicCache.get_caller
21
+ key ||= BasicCache.caller_name
22
22
  key = key.to_sym
23
23
  # rubocop:disable AndOr
24
24
  unless @store.include? key and Time.now - @store[key].stamp < @lifetime
@@ -32,7 +32,7 @@ module BasicCache
32
32
  # Check if a value is cached and not expired
33
33
 
34
34
  def include?(key = nil)
35
- key ||= BasicCache.get_caller
35
+ key ||= BasicCache.caller_name
36
36
  key = key.to_sym
37
37
  # rubocop:disable AndOr
38
38
  @store.include? key and Time.now - @store[key].stamp < @lifetime
@@ -7,9 +7,9 @@ describe BasicCache do
7
7
  end
8
8
  end
9
9
 
10
- describe '.get_caller' do
10
+ describe '.caller_name' do
11
11
  it "returns the calling function's name" do
12
- expect(BasicCache.get_caller).to eql 'instance_eval'
12
+ expect(BasicCache.caller_name).to eql 'instance_eval'
13
13
  end
14
14
  it 'uses caller_locations on Ruby 2.0.0+' do
15
15
  expect(BasicCache::NEW_CALL).to be_true if RUBY_VERSION.to_i >= 2
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basiccache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-01 00:00:00.000000000 Z
11
+ date: 2013-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: parser
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 2.1.0.pre1
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 2.1.0.pre1
110
+ version: '0'
111
111
  description: Allows an application to dynamically cache values and retrieve them later
112
112
  email: me@lesaker.org
113
113
  executables: []
@@ -136,23 +136,22 @@ files:
136
136
  - vendor/cache/ast-1.1.0.gem
137
137
  - vendor/cache/coveralls-0.7.0.gem
138
138
  - vendor/cache/diff-lcs-1.2.5.gem
139
- - vendor/cache/docile-1.1.0.gem
140
- - vendor/cache/fuubar-1.2.1.gem
139
+ - vendor/cache/docile-1.1.1.gem
140
+ - vendor/cache/fuubar-1.3.2.gem
141
141
  - vendor/cache/hashr-0.0.22.gem
142
142
  - vendor/cache/mime-types-2.0.gem
143
143
  - vendor/cache/multi_json-1.8.2.gem
144
- - vendor/cache/parser-2.1.0.pre1.gem
144
+ - vendor/cache/parser-2.1.1.gem
145
145
  - vendor/cache/powerpack-0.0.9.gem
146
146
  - vendor/cache/rainbow-1.1.4.gem
147
- - vendor/cache/rake-10.1.0.gem
147
+ - vendor/cache/rake-10.1.1.gem
148
148
  - vendor/cache/rest-client-1.6.7.gem
149
149
  - vendor/cache/rspec-2.14.1.gem
150
150
  - vendor/cache/rspec-core-2.14.7.gem
151
151
  - vendor/cache/rspec-expectations-2.14.4.gem
152
- - vendor/cache/rspec-instafail-0.2.4.gem
153
152
  - vendor/cache/rspec-mocks-2.14.4.gem
154
- - vendor/cache/rubocop-0.15.0.gem
155
- - vendor/cache/ruby-progressbar-1.2.0.gem
153
+ - vendor/cache/rubocop-0.16.0.gem
154
+ - vendor/cache/ruby-progressbar-1.3.2.gem
156
155
  - vendor/cache/simplecov-0.8.2.gem
157
156
  - vendor/cache/simplecov-html-0.8.0.gem
158
157
  - vendor/cache/slop-3.4.7.gem
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file