has_token 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/generators/has_token/has_token_generator.rb +10 -0
- data/generators/has_token/templates/initializer.rb +2 -0
- data/generators/{has_token_migration → has_token}/templates/migration.rb +0 -0
- data/has_token.gemspec +10 -7
- data/lib/has_token/configuration.rb +17 -0
- data/lib/{token.rb → has_token/token.rb} +0 -0
- data/lib/has_token.rb +10 -1
- metadata +7 -5
- data/generators/has_token_migration/has_token_migration_generator.rb +0 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class HasTokenGenerator < Rails::Generator::Base
|
2
|
+
def manifest
|
3
|
+
record do |m|
|
4
|
+
m.migration_template 'migration.rb', File.join('db', 'migrate'), :migration_file_name => 'create_tokens'
|
5
|
+
|
6
|
+
m.directory File.join('config', 'initializers')
|
7
|
+
m.template 'initializer.rb', File.join('config', 'initializers', 'has_token.rb')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
File without changes
|
data/has_token.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{has_token}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["laserlemon"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-26}
|
13
13
|
s.description = %q{Generate unique tokens on your ActiveRecord models}
|
14
14
|
s.email = %q{steve@laserlemon.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -22,12 +22,14 @@ Gem::Specification.new do |s|
|
|
22
22
|
"README.rdoc",
|
23
23
|
"Rakefile",
|
24
24
|
"VERSION",
|
25
|
-
"generators/
|
26
|
-
"generators/
|
25
|
+
"generators/has_token/has_token_generator.rb",
|
26
|
+
"generators/has_token/templates/initializer.rb",
|
27
|
+
"generators/has_token/templates/migration.rb",
|
27
28
|
"has_token.gemspec",
|
28
29
|
"init.rb",
|
29
30
|
"lib/has_token.rb",
|
30
|
-
"lib/
|
31
|
+
"lib/has_token/configuration.rb",
|
32
|
+
"lib/has_token/token.rb",
|
31
33
|
"test/has_token_test.rb",
|
32
34
|
"test/test_helper.rb"
|
33
35
|
]
|
@@ -52,3 +54,4 @@ Gem::Specification.new do |s|
|
|
52
54
|
else
|
53
55
|
end
|
54
56
|
end
|
57
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module HasToken
|
2
|
+
module Configuration
|
3
|
+
class << self
|
4
|
+
def options
|
5
|
+
@options ||= {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def method_missing(symbol, *args)
|
9
|
+
if (method = symbol.to_s).sub!(/\=$/, '')
|
10
|
+
options[method.to_sym] = args.first
|
11
|
+
else
|
12
|
+
options.fetch(method.to_sym, super)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
File without changes
|
data/lib/has_token.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
-
|
1
|
+
%w(configuration token).each do |f|
|
2
|
+
require File.join(File.dirname(__FILE__), 'has_token', f)
|
3
|
+
end
|
2
4
|
|
3
5
|
module HasToken
|
6
|
+
class << self
|
7
|
+
def configure
|
8
|
+
yield Configuration
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
4
12
|
def self.included(base)
|
5
13
|
base.extend ClassMethods
|
6
14
|
end
|
@@ -8,6 +16,7 @@ module HasToken
|
|
8
16
|
module ClassMethods
|
9
17
|
def has_token(*args)
|
10
18
|
options = args.extract_options!.symbolize_keys
|
19
|
+
options.reverse_merge!(HasToken::Configuration.options)
|
11
20
|
options.merge!(
|
12
21
|
:column => args.first || :token
|
13
22
|
).reverse_merge!(
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_token
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- laserlemon
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-26 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -28,12 +28,14 @@ files:
|
|
28
28
|
- README.rdoc
|
29
29
|
- Rakefile
|
30
30
|
- VERSION
|
31
|
-
- generators/
|
32
|
-
- generators/
|
31
|
+
- generators/has_token/has_token_generator.rb
|
32
|
+
- generators/has_token/templates/initializer.rb
|
33
|
+
- generators/has_token/templates/migration.rb
|
33
34
|
- has_token.gemspec
|
34
35
|
- init.rb
|
35
36
|
- lib/has_token.rb
|
36
|
-
- lib/
|
37
|
+
- lib/has_token/configuration.rb
|
38
|
+
- lib/has_token/token.rb
|
37
39
|
- test/has_token_test.rb
|
38
40
|
- test/test_helper.rb
|
39
41
|
has_rdoc: true
|