keytar 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -1
- data/Gemfile.lock +16 -0
- data/README.md +15 -9
- data/VERSION +1 -1
- data/db/migrate/001_create_bars.rb +11 -0
- data/keytar.gemspec +76 -0
- data/lib/keytar/key_builder.rb +7 -2
- data/pkg/keytar-0.1.0.gem +0 -0
- data/pkg/keytar-0.1.1.gem +0 -0
- data/spec/keytar/keytar_spec.rb +18 -0
- data/spec/keytar/spec_helper.rb +2 -5
- metadata +25 -8
data/Gemfile
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem '
|
4
|
+
gem 'activerecord' ## not needed if you're just using KeyBuilder
|
5
|
+
gem 'activesupport' ## KeyBuilder relys on several helper methods, can be re-factored to not need this
|
5
6
|
gem 'rake'
|
6
7
|
gem 'jeweler'
|
7
8
|
end
|
8
9
|
|
9
10
|
group :test do
|
11
|
+
gem 'sqlite3'
|
10
12
|
gem 'rspec', '~> 2.5'
|
11
13
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,21 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
activemodel (3.0.6)
|
5
|
+
activesupport (= 3.0.6)
|
6
|
+
builder (~> 2.1.2)
|
7
|
+
i18n (~> 0.5.0)
|
8
|
+
activerecord (3.0.6)
|
9
|
+
activemodel (= 3.0.6)
|
10
|
+
activesupport (= 3.0.6)
|
11
|
+
arel (~> 2.0.2)
|
12
|
+
tzinfo (~> 0.3.23)
|
4
13
|
activesupport (3.0.6)
|
14
|
+
arel (2.0.9)
|
15
|
+
builder (2.1.2)
|
5
16
|
diff-lcs (1.1.2)
|
6
17
|
git (1.2.5)
|
18
|
+
i18n (0.5.0)
|
7
19
|
jeweler (1.5.2)
|
8
20
|
bundler (~> 1.0.0)
|
9
21
|
git (>= 1.2.5)
|
@@ -17,12 +29,16 @@ GEM
|
|
17
29
|
rspec-expectations (2.5.0)
|
18
30
|
diff-lcs (~> 1.1.2)
|
19
31
|
rspec-mocks (2.5.0)
|
32
|
+
sqlite3 (1.3.3)
|
33
|
+
tzinfo (0.3.26)
|
20
34
|
|
21
35
|
PLATFORMS
|
22
36
|
ruby
|
23
37
|
|
24
38
|
DEPENDENCIES
|
39
|
+
activerecord
|
25
40
|
activesupport
|
26
41
|
jeweler
|
27
42
|
rake
|
28
43
|
rspec (~> 2.5)
|
44
|
+
sqlite3
|
data/README.md
CHANGED
@@ -4,26 +4,32 @@ Keytar
|
|
4
4
|
**1.** A keyboard that is designed to be played standing up, like a guitar.
|
5
5
|
**2.** A crazy simple ruby-on-rails library for making re-usable keys
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
Installation
|
10
|
-
------------
|
11
|
-
Coming Soon
|
12
|
-
|
13
7
|
KeyBuilder
|
14
8
|
----------
|
15
9
|
|
16
|
-
Keytar is a Ruby on Rails
|
10
|
+
Keytar is a Ruby on Rails gem for KeyBuilder. Use KeyBuilder to automatically generate keys based on class name instead of cluttering model definitions with tons of redundant key method declarations.
|
17
11
|
|
18
12
|
quit littering your code with junk like this:
|
19
13
|
|
20
|
-
def
|
21
|
-
"
|
14
|
+
def some_distributed_no_sql_datastore_key
|
15
|
+
"foos:some_distributed_no_sql_datastore:#{self.id}"
|
22
16
|
end
|
23
17
|
|
24
18
|
Seriously, quit it
|
25
19
|
|
26
20
|
|
21
|
+
|
22
|
+
|
23
|
+
Installation
|
24
|
+
------------
|
25
|
+
gem install keytar
|
26
|
+
|
27
|
+
in your Gemfile add
|
28
|
+
|
29
|
+
gem 'keytar'
|
30
|
+
|
31
|
+
now, you're good to go. See below for examples and config documentation
|
32
|
+
|
27
33
|
Example:
|
28
34
|
--------
|
29
35
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/keytar.gemspec
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{keytar}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
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-04-20}
|
13
|
+
s.description = %q{
|
14
|
+
Keytar is a Ruby on Rails wrapper for KeyBuilder.
|
15
|
+
Use KeyBuilder to automatically generate keys based on class name instead of cluttering model
|
16
|
+
definitions with tons of redundant key method declarations.
|
17
|
+
}
|
18
|
+
s.email = %q{richard.schneeman@gmail.com}
|
19
|
+
s.extra_rdoc_files = [
|
20
|
+
"README.md"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".DS_Store",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"db/migrate/001_create_bars.rb",
|
30
|
+
"keytar.gemspec",
|
31
|
+
"lib/.DS_Store",
|
32
|
+
"lib/keytar.rb",
|
33
|
+
"lib/keytar/key_builder.rb",
|
34
|
+
"license.txt",
|
35
|
+
"pkg/keytar-0.1.0.gem",
|
36
|
+
"pkg/keytar-0.1.1.gem",
|
37
|
+
"spec/keytar/key_builder_spec.rb",
|
38
|
+
"spec/keytar/keytar_spec.rb",
|
39
|
+
"spec/keytar/spec_helper.rb"
|
40
|
+
]
|
41
|
+
s.homepage = %q{http://github.com/Schnems/keytar}
|
42
|
+
s.licenses = ["MIT"]
|
43
|
+
s.require_paths = ["lib"]
|
44
|
+
s.rubygems_version = %q{1.6.2}
|
45
|
+
s.summary = %q{A crazy simple library for building keys (in _key_ value store, not house keys) for Ruby on Rails}
|
46
|
+
s.test_files = [
|
47
|
+
"spec/keytar/key_builder_spec.rb",
|
48
|
+
"spec/keytar/keytar_spec.rb",
|
49
|
+
"spec/keytar/spec_helper.rb"
|
50
|
+
]
|
51
|
+
|
52
|
+
if s.respond_to? :specification_version then
|
53
|
+
s.specification_version = 3
|
54
|
+
|
55
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
+
s.add_development_dependency(%q<activerecord>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<activesupport>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<activerecord>, [">= 0"])
|
63
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
64
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
65
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
66
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
67
|
+
end
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<activerecord>, [">= 0"])
|
70
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
71
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
72
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
73
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
data/lib/keytar/key_builder.rb
CHANGED
@@ -20,13 +20,18 @@ module KeyBuilder
|
|
20
20
|
klass.class_eval %{
|
21
21
|
extend KeyBuilder::Ext
|
22
22
|
# if method_missing doesn't already exist, aliasing and calling it will create an infinite loop
|
23
|
-
@@key_builder_jump_to_superclass = true
|
23
|
+
@@key_builder_jump_to_superclass = true
|
24
|
+
if klass.respond_to?("method_missing")
|
25
|
+
@@key_builder_jump_to_superclass = false
|
26
|
+
alias :key_builder_alias_method_missing :method_missing
|
27
|
+
end
|
28
|
+
|
24
29
|
def self.method_missing(method_name, *args, &blk)
|
25
30
|
if method_name.to_s =~ /.*key$/
|
26
31
|
self.build_key(:base => self.to_s.downcase, :name => method_name, :args => args)
|
27
32
|
else
|
28
33
|
if @@key_builder_jump_to_superclass
|
29
|
-
|
34
|
+
super
|
30
35
|
else
|
31
36
|
key_builder_alias_method_missing(method_name, *args, &blk)
|
32
37
|
end
|
data/pkg/keytar-0.1.0.gem
CHANGED
Binary file
|
Binary file
|
data/spec/keytar/keytar_spec.rb
CHANGED
@@ -1,7 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
## Gives us ActiveRecord backed model Bar that we can test instances of
|
3
|
+
ActiveRecord::Base.establish_connection(
|
4
|
+
:adapter => "sqlite3",
|
5
|
+
:database => ":memory:",
|
6
|
+
:host => 'localhost')
|
7
|
+
ActiveRecord::Migrator.migrate('../../db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
|
8
|
+
## Gives us ActiveRecord backed model Bar that we can test instances of
|
9
|
+
|
10
|
+
|
2
11
|
class Bar < ActiveRecord::Base
|
12
|
+
|
3
13
|
end
|
4
14
|
|
15
|
+
|
5
16
|
describe Keytar do
|
6
17
|
describe 'requiring Keytar' do
|
7
18
|
it 'should load keybuilder into ActiveRecord::Base' do
|
@@ -9,5 +20,12 @@ describe Keytar do
|
|
9
20
|
it {should include( KeyBuilder)}
|
10
21
|
end
|
11
22
|
end
|
23
|
+
|
24
|
+
it 'should ' do
|
25
|
+
name = "notblank"
|
26
|
+
b = Bar.create(:name => name)
|
27
|
+
b.name.should == name
|
28
|
+
b.awesome_key.should == "bars:awesome:#{b.id}"
|
29
|
+
end
|
12
30
|
end
|
13
31
|
end
|
data/spec/keytar/spec_helper.rb
CHANGED
@@ -5,9 +5,6 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
5
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../..', 'lib'))
|
6
6
|
|
7
7
|
require 'keytar'
|
8
|
-
require '
|
9
|
-
require '
|
8
|
+
require 'rspec'
|
9
|
+
require 'rspec/autorun'
|
10
10
|
|
11
|
-
Spec::Runner.configure do |config|
|
12
|
-
|
13
|
-
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:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Schneems
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-20 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
segments:
|
30
30
|
- 0
|
31
31
|
version: "0"
|
32
|
-
name:
|
32
|
+
name: activerecord
|
33
33
|
version_requirements: *id001
|
34
34
|
prerelease: false
|
35
35
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
segments:
|
44
44
|
- 0
|
45
45
|
version: "0"
|
46
|
-
name:
|
46
|
+
name: activesupport
|
47
47
|
version_requirements: *id002
|
48
48
|
prerelease: false
|
49
49
|
- !ruby/object:Gem::Dependency
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
segments:
|
58
58
|
- 0
|
59
59
|
version: "0"
|
60
|
-
name:
|
60
|
+
name: rake
|
61
61
|
version_requirements: *id003
|
62
62
|
prerelease: false
|
63
63
|
- !ruby/object:Gem::Dependency
|
@@ -71,9 +71,23 @@ dependencies:
|
|
71
71
|
segments:
|
72
72
|
- 0
|
73
73
|
version: "0"
|
74
|
-
name:
|
74
|
+
name: jeweler
|
75
75
|
version_requirements: *id004
|
76
76
|
prerelease: false
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
type: :development
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
name: rspec
|
89
|
+
version_requirements: *id005
|
90
|
+
prerelease: false
|
77
91
|
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 "
|
78
92
|
email: richard.schneeman@gmail.com
|
79
93
|
executables: []
|
@@ -89,11 +103,14 @@ files:
|
|
89
103
|
- README.md
|
90
104
|
- Rakefile
|
91
105
|
- VERSION
|
106
|
+
- db/migrate/001_create_bars.rb
|
107
|
+
- keytar.gemspec
|
92
108
|
- lib/.DS_Store
|
93
109
|
- lib/keytar.rb
|
94
110
|
- lib/keytar/key_builder.rb
|
95
111
|
- license.txt
|
96
112
|
- pkg/keytar-0.1.0.gem
|
113
|
+
- pkg/keytar-0.1.1.gem
|
97
114
|
- spec/keytar/key_builder_spec.rb
|
98
115
|
- spec/keytar/keytar_spec.rb
|
99
116
|
- spec/keytar/spec_helper.rb
|