meta_manager 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/meta_manager/taggable.rb +29 -23
- data/lib/meta_manager/version.rb +1 -1
- metadata +68 -61
- data/test/dummy/config/database.yml +0 -11
- data/test/dummy/db/test.sqlite.db +0 -0
- data/test/dummy/log/development.log +0 -1
- data/test/dummy/log/test.log +0 -13444
@@ -11,8 +11,14 @@ module MetaManager
|
|
11
11
|
# Save meta tags records into one hash
|
12
12
|
def meta_tag(attr_name, options={})
|
13
13
|
key = normalize_meta_tag_name(attr_name)
|
14
|
-
|
15
|
-
|
14
|
+
|
15
|
+
cached_meta_tags[key] ||= self.meta_tags.detect {|t| t.name == key}
|
16
|
+
cached_meta_tags[key] ||= self.meta_tags.build(:name => key) if options[:build]
|
17
|
+
cached_meta_tags[key]
|
18
|
+
end
|
19
|
+
|
20
|
+
def cached_meta_tags
|
21
|
+
@cached_meta_tags ||= {}
|
16
22
|
end
|
17
23
|
|
18
24
|
def respond_to?(method_sym, include_private = false)
|
@@ -24,30 +30,30 @@ module MetaManager
|
|
24
30
|
end
|
25
31
|
|
26
32
|
protected
|
27
|
-
|
28
|
-
def normalize_meta_tag_name(value)
|
29
|
-
value.to_s.downcase.strip
|
30
|
-
end
|
31
|
-
|
32
|
-
def method_missing(method, *args, &block)
|
33
|
-
key = method.to_s
|
34
33
|
|
35
|
-
|
36
|
-
|
34
|
+
def normalize_meta_tag_name(value)
|
35
|
+
value.to_s.downcase.strip.gsub("_before_type_cast", '').gsub(/=$/, '')
|
36
|
+
end
|
37
|
+
|
38
|
+
def method_missing(method, *args, &block)
|
39
|
+
key = method.to_s
|
37
40
|
|
38
|
-
if key =~
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
if key =~ meta_match_case
|
42
|
+
attr_name = key.gsub(meta_match_case, '')
|
43
|
+
|
44
|
+
if key =~ /=$/ && !args.first.blank?
|
45
|
+
record = meta_tag(attr_name, :build => true)
|
46
|
+
record.content = args.first
|
47
|
+
else
|
48
|
+
meta_tag(attr_name).try(:content)
|
49
|
+
end
|
50
|
+
else
|
51
|
+
super
|
43
52
|
end
|
44
|
-
else
|
45
|
-
super
|
46
53
|
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
54
|
+
|
55
|
+
def meta_match_case
|
56
|
+
/^tag_/
|
57
|
+
end
|
52
58
|
end
|
53
59
|
end
|
data/lib/meta_manager/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 3.1.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.1.3
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: sqlite3
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rails
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: 3.1.3
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.1.3
|
47
62
|
description: Aimbulance CMS
|
48
63
|
email:
|
49
64
|
- superp1987@gmail.com
|
@@ -53,58 +68,54 @@ extra_rdoc_files: []
|
|
53
68
|
files:
|
54
69
|
- app/models/meta_tag.rb
|
55
70
|
- db/migrate/20120105114018_create_meta_tags.rb
|
56
|
-
- lib/meta_manager.rb
|
57
|
-
- lib/tasks/meta_manager_tasks.rake
|
71
|
+
- lib/meta_manager/version.rb
|
58
72
|
- lib/meta_manager/engine.rb
|
59
|
-
- lib/meta_manager/taggable.rb
|
60
73
|
- lib/meta_manager/helper.rb
|
61
|
-
- lib/meta_manager/
|
74
|
+
- lib/meta_manager/taggable.rb
|
75
|
+
- lib/meta_manager.rb
|
76
|
+
- lib/tasks/meta_manager_tasks.rake
|
62
77
|
- MIT-LICENSE
|
63
78
|
- Rakefile
|
64
79
|
- README.rdoc
|
65
|
-
- test/
|
66
|
-
- test/dummy/public/422.html
|
67
|
-
- test/dummy/public/404.html
|
68
|
-
- test/dummy/public/favicon.ico
|
69
|
-
- test/dummy/script/rails
|
70
|
-
- test/dummy/log/development.log
|
71
|
-
- test/dummy/log/test.log
|
72
|
-
- test/dummy/Rakefile
|
80
|
+
- test/meta_manager_test.rb
|
73
81
|
- test/dummy/db/migrate/20111226131910_create_categories.rb
|
74
82
|
- test/dummy/db/migrate/20111226131911_create_posts.rb
|
75
|
-
- test/dummy/
|
83
|
+
- test/dummy/config.ru
|
84
|
+
- test/dummy/app/assets/stylesheets/application.css
|
85
|
+
- test/dummy/app/assets/javascripts/application.js
|
86
|
+
- test/dummy/app/helpers/application_helper.rb
|
76
87
|
- test/dummy/app/views/welcome/index.html.erb
|
77
88
|
- test/dummy/app/views/layouts/application.html.erb
|
78
89
|
- test/dummy/app/views/posts/show.html.erb
|
79
90
|
- test/dummy/app/views/posts/index.html.erb
|
80
|
-
- test/dummy/app/helpers/application_helper.rb
|
81
|
-
- test/dummy/app/models/post.rb
|
82
91
|
- test/dummy/app/models/category.rb
|
83
|
-
- test/dummy/app/
|
84
|
-
- test/dummy/app/assets/javascripts/application.js
|
85
|
-
- test/dummy/app/controllers/welcome_controller.rb
|
92
|
+
- test/dummy/app/models/post.rb
|
86
93
|
- test/dummy/app/controllers/posts_controller.rb
|
94
|
+
- test/dummy/app/controllers/welcome_controller.rb
|
87
95
|
- test/dummy/app/controllers/application_controller.rb
|
88
|
-
- test/dummy/
|
89
|
-
- test/dummy/
|
90
|
-
- test/dummy/
|
91
|
-
- test/dummy/
|
96
|
+
- test/dummy/public/404.html
|
97
|
+
- test/dummy/public/favicon.ico
|
98
|
+
- test/dummy/public/500.html
|
99
|
+
- test/dummy/public/422.html
|
100
|
+
- test/dummy/Rakefile
|
92
101
|
- test/dummy/config/environments/development.rb
|
93
102
|
- test/dummy/config/environments/production.rb
|
94
103
|
- test/dummy/config/environments/test.rb
|
95
104
|
- test/dummy/config/initializers/inflections.rb
|
96
105
|
- test/dummy/config/initializers/secret_token.rb
|
106
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
97
107
|
- test/dummy/config/initializers/mime_types.rb
|
98
108
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
99
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
100
109
|
- test/dummy/config/initializers/session_store.rb
|
101
|
-
- test/dummy/config/
|
102
|
-
- test/dummy/config/
|
110
|
+
- test/dummy/config/locales/en.yml
|
111
|
+
- test/dummy/config/application.rb
|
103
112
|
- test/dummy/config/routes.rb
|
104
|
-
- test/
|
105
|
-
- test/
|
106
|
-
- test/
|
113
|
+
- test/dummy/config/boot.rb
|
114
|
+
- test/dummy/config/environment.rb
|
115
|
+
- test/dummy/script/rails
|
107
116
|
- test/test_helper.rb
|
117
|
+
- test/models/category_test.rb
|
118
|
+
- test/models/meta_tag_test.rb
|
108
119
|
- test/controllers/welcome_controller_test.rb
|
109
120
|
- test/controllers/posts_controller_test.rb
|
110
121
|
homepage: https://github.com/superp/meta_manager
|
@@ -127,53 +138,49 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
138
|
version: '0'
|
128
139
|
requirements: []
|
129
140
|
rubyforge_project:
|
130
|
-
rubygems_version: 1.8.
|
141
|
+
rubygems_version: 1.8.24
|
131
142
|
signing_key:
|
132
143
|
specification_version: 3
|
133
144
|
summary: Head meta tags manager for models.
|
134
145
|
test_files:
|
135
|
-
- test/
|
136
|
-
- test/dummy/public/422.html
|
137
|
-
- test/dummy/public/404.html
|
138
|
-
- test/dummy/public/favicon.ico
|
139
|
-
- test/dummy/script/rails
|
140
|
-
- test/dummy/log/development.log
|
141
|
-
- test/dummy/log/test.log
|
142
|
-
- test/dummy/Rakefile
|
146
|
+
- test/meta_manager_test.rb
|
143
147
|
- test/dummy/db/migrate/20111226131910_create_categories.rb
|
144
148
|
- test/dummy/db/migrate/20111226131911_create_posts.rb
|
145
|
-
- test/dummy/
|
149
|
+
- test/dummy/config.ru
|
150
|
+
- test/dummy/app/assets/stylesheets/application.css
|
151
|
+
- test/dummy/app/assets/javascripts/application.js
|
152
|
+
- test/dummy/app/helpers/application_helper.rb
|
146
153
|
- test/dummy/app/views/welcome/index.html.erb
|
147
154
|
- test/dummy/app/views/layouts/application.html.erb
|
148
155
|
- test/dummy/app/views/posts/show.html.erb
|
149
156
|
- test/dummy/app/views/posts/index.html.erb
|
150
|
-
- test/dummy/app/helpers/application_helper.rb
|
151
|
-
- test/dummy/app/models/post.rb
|
152
157
|
- test/dummy/app/models/category.rb
|
153
|
-
- test/dummy/app/
|
154
|
-
- test/dummy/app/assets/javascripts/application.js
|
155
|
-
- test/dummy/app/controllers/welcome_controller.rb
|
158
|
+
- test/dummy/app/models/post.rb
|
156
159
|
- test/dummy/app/controllers/posts_controller.rb
|
160
|
+
- test/dummy/app/controllers/welcome_controller.rb
|
157
161
|
- test/dummy/app/controllers/application_controller.rb
|
158
|
-
- test/dummy/
|
159
|
-
- test/dummy/
|
160
|
-
- test/dummy/
|
161
|
-
- test/dummy/
|
162
|
+
- test/dummy/public/404.html
|
163
|
+
- test/dummy/public/favicon.ico
|
164
|
+
- test/dummy/public/500.html
|
165
|
+
- test/dummy/public/422.html
|
166
|
+
- test/dummy/Rakefile
|
162
167
|
- test/dummy/config/environments/development.rb
|
163
168
|
- test/dummy/config/environments/production.rb
|
164
169
|
- test/dummy/config/environments/test.rb
|
165
170
|
- test/dummy/config/initializers/inflections.rb
|
166
171
|
- test/dummy/config/initializers/secret_token.rb
|
172
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
167
173
|
- test/dummy/config/initializers/mime_types.rb
|
168
174
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
169
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
170
175
|
- test/dummy/config/initializers/session_store.rb
|
171
|
-
- test/dummy/config/
|
172
|
-
- test/dummy/config/
|
176
|
+
- test/dummy/config/locales/en.yml
|
177
|
+
- test/dummy/config/application.rb
|
173
178
|
- test/dummy/config/routes.rb
|
174
|
-
- test/
|
175
|
-
- test/
|
176
|
-
- test/
|
179
|
+
- test/dummy/config/boot.rb
|
180
|
+
- test/dummy/config/environment.rb
|
181
|
+
- test/dummy/script/rails
|
177
182
|
- test/test_helper.rb
|
183
|
+
- test/models/category_test.rb
|
184
|
+
- test/models/meta_tag_test.rb
|
178
185
|
- test/controllers/welcome_controller_test.rb
|
179
186
|
- test/controllers/posts_controller_test.rb
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|