keytar 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{keytar}
8
- s.version = "1.4.0"
8
+ s.version = "1.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Schneems"]
12
- s.date = %q{2011-07-27}
11
+ s.authors = [%q{Schneems}]
12
+ s.date = %q{2011-08-08}
13
13
  s.description = %q{
14
14
  Keytar is a Ruby on Rails wrapper for KeyBuilder.
15
15
  Use KeyBuilder to automatically generate keys based on class name instead of cluttering model
@@ -38,9 +38,9 @@ Gem::Specification.new do |s|
38
38
  "spec/spec_helper.rb"
39
39
  ]
40
40
  s.homepage = %q{http://github.com/Schnems/keytar}
41
- s.licenses = ["MIT"]
42
- s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.6.2}
41
+ s.licenses = [%q{MIT}]
42
+ s.require_paths = [%q{lib}]
43
+ s.rubygems_version = %q{1.8.6}
44
44
  s.summary = %q{A crazy simple library for building keys (in _key_ value store, not house keys) for Ruby on Rails}
45
45
  s.test_files = [
46
46
  "spec/keytar/key_builder_spec.rb",
@@ -40,21 +40,20 @@ module KeyBuilder
40
40
  options.keys.each do |key|
41
41
  options["key_#{key}".to_sym] = options[key] if key.to_s !~ /^key_/
42
42
  end
43
-
44
43
  names.each do |name|
45
44
  # define (cache) class method
46
45
  (class << self;self ;end).instance_eval do
47
46
  define_method("#{name}_key") do |*args|
48
- options.merge!(:name => name, :base => self.to_s.downcase, :args => args)
49
- build_key(options)
47
+ build_options = options.merge(:name => name, :base => self.to_s.downcase, :args => args)
48
+ build_key(build_options)
50
49
  end
51
50
  end
52
51
 
53
52
  # define (cache) instance method
54
53
  class_eval do
55
54
  define_method("#{name}_key") do |*args|
56
- options.merge!(:name => name, :args => args)
57
- build_key(options)
55
+ build_options = options.merge(:name => name, :args => args)
56
+ build_key(build_options)
58
57
  end
59
58
  end
60
59
  end
@@ -14,6 +14,13 @@ describe KeyBuilder do
14
14
  @options = {:name => "foo", :args => nil}
15
15
  end
16
16
 
17
+ describe 'manually build key' do
18
+ it 'works' do
19
+ foo = Foo.new
20
+ foo.build_key(:name => "method", :args => "args").should eq("foos:method:args")
21
+ end
22
+ end
23
+
17
24
  describe 'build_key' do
18
25
  it 'calls other class methods' do
19
26
  Foo.should_receive(:build_key_hash)
@@ -33,6 +33,15 @@ class BarBaz < ActiveRecord::Base
33
33
  end
34
34
 
35
35
  describe Keytar do
36
+ describe 'class and instance interference' do
37
+ it 'should not happen' do
38
+ bar = Bar.create(:name => "whatever")
39
+ orig_key = Bar.awesome_key(bar.id)
40
+ bar.awesome_key(bar.id)
41
+ second_key = Bar.awesome_key(bar.id)
42
+ second_key.should eq(orig_key)
43
+ end
44
+ end
36
45
 
37
46
  describe 'cache_key' do
38
47
  it 'allows us to pre-define class methods' do
@@ -166,7 +175,7 @@ describe Keytar do
166
175
  end
167
176
 
168
177
  it 'should change key_unique' do
169
- Foo.class_eval { def timeish; (Time.now.to_i * 0.01).floor; end}
178
+ Foo.class_eval { def timeish; (Time.now.to_i * 0.01).floor.to_s; end}
170
179
  key_unique = :timeish
171
180
  Foo.key_unique key_unique
172
181
  Foo.key_unique.should == key_unique
@@ -257,4 +266,5 @@ describe Keytar do
257
266
  BarBaz.last.id.should == @id
258
267
  end
259
268
  end
269
+
260
270
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keytar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 0
10
- version: 1.4.0
9
+ - 1
10
+ version: 1.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Schneems
@@ -15,11 +15,9 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-27 00:00:00 -05:00
19
- default_executable:
18
+ date: 2011-08-08 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- type: :runtime
23
21
  requirement: &id001 !ruby/object:Gem::Requirement
24
22
  none: false
25
23
  requirements:
@@ -29,11 +27,11 @@ dependencies:
29
27
  segments:
30
28
  - 0
31
29
  version: "0"
32
- name: activesupport
33
30
  version_requirements: *id001
31
+ name: activesupport
34
32
  prerelease: false
33
+ type: :runtime
35
34
  - !ruby/object:Gem::Dependency
36
- type: :development
37
35
  requirement: &id002 !ruby/object:Gem::Requirement
38
36
  none: false
39
37
  requirements:
@@ -45,11 +43,11 @@ dependencies:
45
43
  - 0
46
44
  - 4
47
45
  version: 3.0.4
48
- name: activerecord
49
46
  version_requirements: *id002
47
+ name: activerecord
50
48
  prerelease: false
51
- - !ruby/object:Gem::Dependency
52
49
  type: :development
50
+ - !ruby/object:Gem::Dependency
53
51
  requirement: &id003 !ruby/object:Gem::Requirement
54
52
  none: false
55
53
  requirements:
@@ -61,11 +59,11 @@ dependencies:
61
59
  - 8
62
60
  - 7
63
61
  version: 0.8.7
64
- name: rake
65
62
  version_requirements: *id003
63
+ name: rake
66
64
  prerelease: false
67
- - !ruby/object:Gem::Dependency
68
65
  type: :development
66
+ - !ruby/object:Gem::Dependency
69
67
  requirement: &id004 !ruby/object:Gem::Requirement
70
68
  none: false
71
69
  requirements:
@@ -77,11 +75,11 @@ dependencies:
77
75
  - 5
78
76
  - 2
79
77
  version: 1.5.2
80
- name: jeweler
81
78
  version_requirements: *id004
79
+ name: jeweler
82
80
  prerelease: false
83
- - !ruby/object:Gem::Dependency
84
81
  type: :development
82
+ - !ruby/object:Gem::Dependency
85
83
  requirement: &id005 !ruby/object:Gem::Requirement
86
84
  none: false
87
85
  requirements:
@@ -91,11 +89,11 @@ dependencies:
91
89
  segments:
92
90
  - 0
93
91
  version: "0"
94
- name: autotest-standalone
95
92
  version_requirements: *id005
93
+ name: autotest-standalone
96
94
  prerelease: false
97
- - !ruby/object:Gem::Dependency
98
95
  type: :development
96
+ - !ruby/object:Gem::Dependency
99
97
  requirement: &id006 !ruby/object:Gem::Requirement
100
98
  none: false
101
99
  requirements:
@@ -105,11 +103,11 @@ dependencies:
105
103
  segments:
106
104
  - 0
107
105
  version: "0"
108
- name: autotest-growl
109
106
  version_requirements: *id006
107
+ name: autotest-growl
110
108
  prerelease: false
111
- - !ruby/object:Gem::Dependency
112
109
  type: :development
110
+ - !ruby/object:Gem::Dependency
113
111
  requirement: &id007 !ruby/object:Gem::Requirement
114
112
  none: false
115
113
  requirements:
@@ -119,9 +117,10 @@ dependencies:
119
117
  segments:
120
118
  - 0
121
119
  version: "0"
122
- name: rspec
123
120
  version_requirements: *id007
121
+ name: rspec
124
122
  prerelease: false
123
+ type: :development
125
124
  description: "\n Keytar is a Ruby on Rails wrapper for KeyBuilder.\n Use KeyBuilder to automatically generate keys based on class name instead of cluttering model\n definitions with tons of redundant key method declarations.\n "
126
125
  email: richard.schneeman@gmail.com
127
126
  executables: []
@@ -147,7 +146,6 @@ files:
147
146
  - spec/keytar/key_builder_spec.rb
148
147
  - spec/keytar/keytar_spec.rb
149
148
  - spec/spec_helper.rb
150
- has_rdoc: true
151
149
  homepage: http://github.com/Schnems/keytar
152
150
  licenses:
153
151
  - MIT
@@ -177,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
175
  requirements: []
178
176
 
179
177
  rubyforge_project:
180
- rubygems_version: 1.6.2
178
+ rubygems_version: 1.8.6
181
179
  signing_key:
182
180
  specification_version: 3
183
181
  summary: A crazy simple library for building keys (in _key_ value store, not house keys) for Ruby on Rails