tmp_cache 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0be9c750fa54d423678ed0eefa77fe7b8e8c7683
4
+ data.tar.gz: c9d43fe8f216d1532191836cfd75b1d395c5c71b
5
+ SHA512:
6
+ metadata.gz: e03ac7b07ed1dc1cff1e3254ea4e44e6e5085c7200b6133d36bf2cfa22cedefa202c91f223f95a039ac1ec3ef81be62dec1ce2e5ca4d2160b38ffe184ec1894e
7
+ data.tar.gz: 91b4a3db5ed8a61d625eb943b1e38e7f1f813a03450844ea17647b705d18cbb060de63f0adbe03667c2bfe6e6ec83cd3d8f509147d399fc057aa4fef243ab70f
data/.gitignore CHANGED
@@ -1,5 +1,21 @@
1
- DS_Store
1
+ .DS_Store
2
2
  *~
3
- pkg/*
4
- .\#*
5
- *\#*
3
+ *#*
4
+ .ruby-version
5
+ *.gem
6
+ *.rbc
7
+ .bundle
8
+ .config
9
+ .yardoc
10
+ Gemfile.lock
11
+ InstalledFiles
12
+ _yardoc
13
+ coverage
14
+ doc/
15
+ lib/bundler/man
16
+ pkg
17
+ rdoc
18
+ spec/reports
19
+ test/tmp
20
+ test/version_tmp
21
+ tmp
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
- source :rubygems
2
- gem 'hoe'
3
- gem 'newgem'
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tmp_cache.gemspec
4
+ gemspec
@@ -1,3 +1,7 @@
1
+ === 0.1.1 2013-04-06
2
+
3
+ * use bundler gem template
4
+
1
5
  === 0.1.0 2012-11-17
2
6
 
3
7
  * support mix-in Cache::Prototype
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012-2013 Sho Hashimoto
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ tmp_cache
2
+ =========
3
+ on memory cache.
4
+
5
+ * https://github.com/shokai/tmp_cache
6
+
7
+
8
+ Installation
9
+ ------------
10
+
11
+ % gem install tmp_cache
12
+
13
+
14
+ Usage
15
+ -----
16
+
17
+ ```ruby
18
+ require 'tmp_cache'
19
+
20
+ TmpCache.set('name', 'shokai', 60) # expire 60 sec
21
+
22
+ puts TmpCache.get('name') # => 'shokai'
23
+ sleep 61
24
+ puts TmpCache.get('name') # => nil
25
+
26
+ TmpCache.set('name', 'shokai')
27
+ TmpCache.set('mail', 'hashimoto@shokai.org')
28
+ TmpCache.each do |k,v|
29
+ puts "#{k} => #{v}"
30
+ end
31
+ ```
32
+
33
+ create new cache
34
+
35
+ ```ruby
36
+ cache = TmpCache::Cache.new
37
+ cache.set('foo', 'bar')
38
+ puts cache.get('foo')
39
+ ```
40
+
41
+
42
+ Test
43
+ ----
44
+
45
+ % gem install bundler
46
+ % bundle install
47
+ % rake test
48
+
49
+
50
+ Contributing
51
+ ------------
52
+
53
+ 1. Fork it
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,25 +1,8 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/tmp_cache'
6
-
7
- Hoe.plugin :newgem
8
- # Hoe.plugin :website
9
- # Hoe.plugin :cucumberfeatures
10
-
11
- # Generate all the Rake tasks
12
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
- $hoe = Hoe.spec 'tmp_cache' do
14
- self.developer 'Sho Hashimoto', 'hashimoto@shokai.org'
15
- self.rubyforge_name = self.name # TODO this is default value
16
- # self.extra_deps = [['activesupport','>= 2.0.2']]
17
-
18
- end
19
-
20
- require 'newgem/tasks'
21
- Dir['tasks/**/*.rake'].each { |t| load t }
22
-
23
- # TODO - want other tests/tasks run by default? Add them to the list
24
- # remove_task :default
25
- # task :default => [:spec, :features]
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.pattern = "test/test_*.rb"
6
+ end
7
+
8
+ task :default => :test
@@ -1,10 +1,7 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
-
4
1
  require 'tmp_cache/cache'
2
+ require 'tmp_cache/version'
5
3
 
6
4
  module TmpCache
7
- VERSION = '0.1.0'
8
5
  include TmpCache::Prototype
9
6
 
10
7
  class Cache
@@ -0,0 +1,3 @@
1
+ module TmpCache
2
+ VERSION = '0.1.1'
3
+ end
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class TestAll < Test::Unit::TestCase
3
+ class TestAll < MiniTest::Unit::TestCase
4
4
 
5
5
  class MyCache
6
6
  include TmpCache::Prototype
@@ -16,6 +16,11 @@ class TestAll < Test::Unit::TestCase
16
16
  @my_cache.set('name', 'instance mix', 2)
17
17
  end
18
18
 
19
+ def teardown
20
+ TmpCache.reset
21
+ MyCache.reset
22
+ end
23
+
19
24
  def test_get
20
25
  assert TmpCache.get('name') == 'class'
21
26
  assert @cache.get('name') == 'instance'
@@ -1,3 +1,5 @@
1
- require 'stringio'
2
- require 'test/unit'
1
+ require 'rubygems'
2
+ require 'minitest/autorun'
3
+
4
+ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
3
5
  require 'tmp_cache'
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class TestMixinClass < Test::Unit::TestCase
3
+ class TestMixinClass < MiniTest::Unit::TestCase
4
4
 
5
5
  class MyCache
6
6
  include TmpCache::Prototype
@@ -14,6 +14,10 @@ class TestMixinClass < Test::Unit::TestCase
14
14
  MyCache.set('name', 'shokai', 2)
15
15
  end
16
16
 
17
+ def teardown
18
+ MyCache.reset
19
+ end
20
+
17
21
  def test_class_method
18
22
  assert MyCache.size == 1
19
23
  sleep 3
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class TestMixinInstance < Test::Unit::TestCase
3
+ class TestMixinInstance < MiniTest::Unit::TestCase
4
4
 
5
5
  class MyCache
6
6
  include TmpCache::Prototype
@@ -1,11 +1,15 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class TestTmpCache < Test::Unit::TestCase
3
+ class TestTmpCache < MiniTest::Unit::TestCase
4
4
 
5
5
  def setup
6
6
  TmpCache.set('name', 'shokai', 2)
7
7
  end
8
8
 
9
+ def teardown
10
+ TmpCache.reset
11
+ end
12
+
9
13
  def test_get
10
14
  assert TmpCache.get('name') == 'shokai'
11
15
  end
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
- class TestTmpCacheInstance < Test::Unit::TestCase
3
+ class TestTmpCacheInstance < MiniTest::Unit::TestCase
4
4
 
5
5
  def setup
6
6
  @tmp_cache = TmpCache::Cache.new
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tmp_cache/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tmp_cache"
8
+ spec.version = TmpCache::VERSION
9
+ spec.authors = ["Sho Hashimoto"]
10
+ spec.email = ["hashimoto@shokai.org"]
11
+ spec.description = %q{on memory cache}
12
+ spec.summary = spec.description
13
+ spec.homepage = "https://github.com/shokai/tmp_cache"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/).reject{|i| i=="Gemfile.lock" }
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "minitest"
24
+ end
metadata CHANGED
@@ -1,124 +1,106 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmp_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sho Hashimoto
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-16 00:00:00.000000000 Z
11
+ date: 2013-04-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rdoc
14
+ name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: '3.10'
19
+ version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: '3.10'
26
+ version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
- name: newgem
28
+ name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: 1.5.3
33
+ version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: 1.5.3
40
+ version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- name: hoe
42
+ name: minitest
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
- version: '3.1'
47
+ version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
- version: '3.1'
62
- description: on memory cache.
54
+ version: '0'
55
+ description: on memory cache
63
56
  email:
64
57
  - hashimoto@shokai.org
65
58
  executables: []
66
59
  extensions: []
67
- extra_rdoc_files:
68
- - History.txt
69
- - Manifest.txt
70
- - README.rdoc
60
+ extra_rdoc_files: []
71
61
  files:
72
62
  - .gitignore
73
63
  - Gemfile
74
- - Gemfile.lock
75
64
  - History.txt
76
- - Manifest.txt
77
- - README.rdoc
65
+ - LICENSE.txt
66
+ - README.md
78
67
  - Rakefile
79
68
  - lib/tmp_cache.rb
80
69
  - lib/tmp_cache/cache.rb
70
+ - lib/tmp_cache/version.rb
81
71
  - samples/sample.rb
82
72
  - samples/sample_instance.rb
83
- - script/console
84
- - script/destroy
85
- - script/generate
86
73
  - test/test_all.rb
87
74
  - test/test_helper.rb
88
75
  - test/test_mixin_class.rb
89
76
  - test/test_mixin_instance.rb
90
77
  - test/test_tmp_cache.rb
91
78
  - test/test_tmp_cache_instance.rb
92
- - .gemtest
93
- homepage: http://github.com/shokai/tmp_cache
94
- licenses: []
79
+ - tmp_cache.gemspec
80
+ homepage: https://github.com/shokai/tmp_cache
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
95
84
  post_install_message:
96
- rdoc_options:
97
- - --main
98
- - README.rdoc
85
+ rdoc_options: []
99
86
  require_paths:
100
87
  - lib
101
88
  required_ruby_version: !ruby/object:Gem::Requirement
102
- none: false
103
89
  requirements:
104
- - - ! '>='
90
+ - - '>='
105
91
  - !ruby/object:Gem::Version
106
92
  version: '0'
107
- segments:
108
- - 0
109
- hash: 4211903737220457078
110
93
  required_rubygems_version: !ruby/object:Gem::Requirement
111
- none: false
112
94
  requirements:
113
- - - ! '>='
95
+ - - '>='
114
96
  - !ruby/object:Gem::Version
115
97
  version: '0'
116
98
  requirements: []
117
- rubyforge_project: tmp_cache
118
- rubygems_version: 1.8.24
99
+ rubyforge_project:
100
+ rubygems_version: 2.0.3
119
101
  signing_key:
120
- specification_version: 3
121
- summary: on memory cache.
102
+ specification_version: 4
103
+ summary: on memory cache
122
104
  test_files:
123
105
  - test/test_all.rb
124
106
  - test/test_helper.rb
data/.gemtest DELETED
File without changes
@@ -1,24 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- RedCloth (4.2.9)
5
- activesupport (2.3.14)
6
- hoe (3.1.1)
7
- rake (~> 0.8)
8
- newgem (1.5.3)
9
- RedCloth (>= 4.1.1)
10
- activesupport (~> 2.3.4)
11
- hoe (>= 2.4.0)
12
- rubigen (>= 1.5.3)
13
- syntax (>= 1.0.0)
14
- rake (0.9.2.2)
15
- rubigen (1.5.8)
16
- activesupport (>= 2.3.5, < 3.2.0)
17
- syntax (1.0.0)
18
-
19
- PLATFORMS
20
- ruby
21
-
22
- DEPENDENCIES
23
- hoe
24
- newgem
@@ -1,20 +0,0 @@
1
- .gitignore
2
- Gemfile
3
- Gemfile.lock
4
- History.txt
5
- Manifest.txt
6
- README.rdoc
7
- Rakefile
8
- lib/tmp_cache.rb
9
- lib/tmp_cache/cache.rb
10
- samples/sample.rb
11
- samples/sample_instance.rb
12
- script/console
13
- script/destroy
14
- script/generate
15
- test/test_all.rb
16
- test/test_helper.rb
17
- test/test_mixin_class.rb
18
- test/test_mixin_instance.rb
19
- test/test_tmp_cache.rb
20
- test/test_tmp_cache_instance.rb
@@ -1,65 +0,0 @@
1
- = tmp_cache
2
-
3
- * http://github.com/shokai/tmp_cache
4
-
5
- == DESCRIPTION:
6
-
7
- on memory cache.
8
-
9
- == INSTALL:
10
-
11
- * gem install tmp_cache
12
-
13
- == SYNOPSIS:
14
-
15
- #!/usr/bin/env ruby
16
- require 'tmp_cache'
17
-
18
- TmpCache.set('name', 'shokai', 60) # expire 60 sec
19
-
20
- puts TmpCache.get('name') # => 'shokai'
21
- sleep 61
22
- puts TmpCache.get('name') # => nil
23
-
24
- TmpCache.set('name', 'shokai')
25
- TmpCache.set('mail', 'hashimoto@shokai.org')
26
- TmpCache.each do |k,v|
27
- puts "#{k} => #{v}"
28
- end
29
-
30
-
31
- create new cache
32
-
33
- cache = TmpCache::Cache.new
34
- cache.set('foo', 'bar')
35
- puts cache.get('foo')
36
-
37
- == REQUIREMENTS:
38
-
39
- * Ruby 1.8.7+
40
- * Ruby 1.9.3+
41
-
42
- == LICENSE:
43
-
44
- (The MIT License)
45
-
46
- Copyright (c) 2012 Sho Hashimoto
47
-
48
- Permission is hereby granted, free of charge, to any person obtaining
49
- a copy of this software and associated documentation files (the
50
- 'Software'), to deal in the Software without restriction, including
51
- without limitation the rights to use, copy, modify, merge, publish,
52
- distribute, sublicense, and/or sell copies of the Software, and to
53
- permit persons to whom the Software is furnished to do so, subject to
54
- the following conditions:
55
-
56
- The above copyright notice and this permission notice shall be
57
- included in all copies or substantial portions of the Software.
58
-
59
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
60
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
61
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
62
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
63
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
64
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
65
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/tmp_cache.rb'}"
9
- puts "Loading tmp_cache gem"
10
- exec "#{irb} #{libs} --simple-prompt"
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)