meta_manager 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +93 -0
  3. data/Rakefile +34 -0
  4. data/app/models/meta_tag.rb +23 -0
  5. data/db/migrate/20111228124815_create_meta_tags.rb +21 -0
  6. data/lib/meta_manager.rb +7 -0
  7. data/lib/meta_manager/engine.rb +12 -0
  8. data/lib/meta_manager/helper.rb +62 -0
  9. data/lib/meta_manager/taggable.rb +52 -0
  10. data/lib/meta_manager/version.rb +3 -0
  11. data/lib/tasks/meta_manager_tasks.rake +4 -0
  12. data/test/controllers/posts_controller_test.rb +72 -0
  13. data/test/dummy/Rakefile +7 -0
  14. data/test/dummy/app/assets/javascripts/application.js +9 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  16. data/test/dummy/app/controllers/application_controller.rb +5 -0
  17. data/test/dummy/app/controllers/posts_controller.rb +25 -0
  18. data/test/dummy/app/helpers/application_helper.rb +2 -0
  19. data/test/dummy/app/models/category.rb +7 -0
  20. data/test/dummy/app/models/post.rb +5 -0
  21. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  22. data/test/dummy/app/views/posts/index.html.erb +0 -0
  23. data/test/dummy/app/views/posts/show.html.erb +0 -0
  24. data/test/dummy/config.ru +4 -0
  25. data/test/dummy/config/application.rb +45 -0
  26. data/test/dummy/config/boot.rb +10 -0
  27. data/test/dummy/config/database.yml +11 -0
  28. data/test/dummy/config/environment.rb +5 -0
  29. data/test/dummy/config/environments/development.rb +30 -0
  30. data/test/dummy/config/environments/production.rb +60 -0
  31. data/test/dummy/config/environments/test.rb +39 -0
  32. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/test/dummy/config/initializers/inflections.rb +10 -0
  34. data/test/dummy/config/initializers/mime_types.rb +5 -0
  35. data/test/dummy/config/initializers/secret_token.rb +7 -0
  36. data/test/dummy/config/initializers/session_store.rb +8 -0
  37. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  38. data/test/dummy/config/locales/en.yml +5 -0
  39. data/test/dummy/config/routes.rb +60 -0
  40. data/test/dummy/db/migrate/20111226131910_create_categories.rb +9 -0
  41. data/test/dummy/db/migrate/20111226131911_create_posts.rb +11 -0
  42. data/test/dummy/db/test.sqlite.db +0 -0
  43. data/test/dummy/log/development.log +1 -0
  44. data/test/dummy/log/test.log +8598 -0
  45. data/test/dummy/public/404.html +26 -0
  46. data/test/dummy/public/422.html +26 -0
  47. data/test/dummy/public/500.html +26 -0
  48. data/test/dummy/public/favicon.ico +0 -0
  49. data/test/dummy/script/rails +6 -0
  50. data/test/meta_manager_test.rb +11 -0
  51. data/test/models/category_test.rb +41 -0
  52. data/test/models/meta_tag_test.rb +67 -0
  53. data/test/test_helper.rb +14 -0
  54. metadata +162 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ class MetaManagerTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, MetaManager
6
+ end
7
+
8
+ test 'shound be included by Category instance' do
9
+ assert Category.new.respond_to?(:meta_tags)
10
+ end
11
+ end
@@ -0,0 +1,41 @@
1
+ require 'test_helper'
2
+
3
+ class CategoryTest < ActiveSupport::TestCase
4
+
5
+ setup do
6
+ @category = Category.new :title => 'Test category'
7
+ end
8
+
9
+ test "truth" do
10
+ assert_kind_of Class, Category
11
+ end
12
+
13
+ test "should save meta tags with new_record" do
14
+ value = "title content"
15
+ @category.tag_title = value
16
+
17
+ assert_equal @category.meta_tag(:title).content, value
18
+ assert_equal @category.meta_tag(:keywords).content, nil
19
+
20
+ assert_difference('MetaTag.count', 2) do
21
+ @category.save
22
+ end
23
+ end
24
+
25
+ test "should load meta tags into record" do
26
+ @category.tag_title = "title content"
27
+ @category.tag_keywords = "keywords content"
28
+ @category.save
29
+
30
+ @category.reload
31
+
32
+ assert_equal @category.tag_title, "title content"
33
+ assert_equal @category.tag_keywords, "keywords content"
34
+ end
35
+
36
+ test "should raise error on not valid meta tag method" do
37
+ assert_raise(NoMethodError) do
38
+ @category.tagg_method
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,67 @@
1
+ require 'test_helper'
2
+
3
+ class MetaTagTest < ActiveSupport::TestCase
4
+ # called before every single test
5
+ def setup
6
+ @tag = MetaTag.new(:name => 'somename')
7
+ @tag.taggable_type = 'Category'
8
+ @tag.taggable_id = 1
9
+ end
10
+
11
+ test "truth" do
12
+ assert_kind_of Class, MetaTag
13
+ end
14
+
15
+ test 'should create new record with valid attributes' do
16
+ @tag.save!
17
+ end
18
+
19
+ test 'should not be valid with empty name' do
20
+ @tag.name = nil
21
+ assert !@tag.valid?
22
+ end
23
+
24
+ test 'should not be valid with not uniq name' do
25
+ @tag.update_attribute(:name, 'test')
26
+
27
+ @next_tag = MetaTag.new(:name => 'test')
28
+ @next_tag.taggable_type = 'Category'
29
+ @next_tag.taggable_id = 1
30
+
31
+ assert !@next_tag.valid?
32
+ end
33
+
34
+ test 'should be valid with not uniq name but dynamic' do
35
+ @tag.update_attribute(:name, 'test')
36
+
37
+ @next_tag = MetaTag.new(:name => 'test', :is_dynamic => true)
38
+ @next_tag.taggable_type = 'Category'
39
+ @next_tag.taggable_id = 1
40
+
41
+ assert @next_tag.valid?
42
+ end
43
+
44
+ test 'should not be valid with not uniq name both dynamic' do
45
+ @tag.update_attribute(:is_dynamic, true)
46
+
47
+ @next_tag = MetaTag.new(:name => 'somename', :is_dynamic => true)
48
+ @next_tag.taggable_type = 'Category'
49
+ @next_tag.taggable_id = 1
50
+
51
+ assert !@next_tag.valid?
52
+ end
53
+
54
+ test 'should be valid with not uniq name in other parent record' do
55
+ @tag.update_attribute(:name, 'test')
56
+
57
+ @next_tag = MetaTag.new(:name => 'test')
58
+ @next_tag.taggable_type = 'Category'
59
+ @next_tag.taggable_id = 2
60
+
61
+ assert @next_tag.valid?
62
+ end
63
+
64
+ test 'should return valid dynamic content' do
65
+ assert true
66
+ end
67
+ end
@@ -0,0 +1,14 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Run any available migration
10
+ ActiveRecord::Migrator.migrate File.expand_path("../../db/migrate/", __FILE__)
11
+ ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
12
+
13
+ # Load support files
14
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
metadata ADDED
@@ -0,0 +1,162 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meta_manager
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Pavel Galeta
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &75440600 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *75440600
25
+ - !ruby/object:Gem::Dependency
26
+ name: sqlite3
27
+ requirement: &75440390 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *75440390
36
+ description: Aimbulance CMS
37
+ email:
38
+ - superp1987@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - app/models/meta_tag.rb
44
+ - db/migrate/20111228124815_create_meta_tags.rb
45
+ - lib/meta_manager.rb
46
+ - lib/tasks/meta_manager_tasks.rake
47
+ - lib/meta_manager/engine.rb
48
+ - lib/meta_manager/taggable.rb
49
+ - lib/meta_manager/helper.rb
50
+ - lib/meta_manager/version.rb
51
+ - MIT-LICENSE
52
+ - Rakefile
53
+ - README.rdoc
54
+ - test/dummy/public/500.html
55
+ - test/dummy/public/422.html
56
+ - test/dummy/public/404.html
57
+ - test/dummy/public/favicon.ico
58
+ - test/dummy/script/rails
59
+ - test/dummy/log/development.log
60
+ - test/dummy/log/test.log
61
+ - test/dummy/Rakefile
62
+ - test/dummy/db/migrate/20111226131910_create_categories.rb
63
+ - test/dummy/db/migrate/20111226131911_create_posts.rb
64
+ - test/dummy/db/test.sqlite.db
65
+ - test/dummy/app/views/layouts/application.html.erb
66
+ - test/dummy/app/views/posts/show.html.erb
67
+ - test/dummy/app/views/posts/index.html.erb
68
+ - test/dummy/app/helpers/application_helper.rb
69
+ - test/dummy/app/models/post.rb
70
+ - test/dummy/app/models/category.rb
71
+ - test/dummy/app/assets/stylesheets/application.css
72
+ - test/dummy/app/assets/javascripts/application.js
73
+ - test/dummy/app/controllers/posts_controller.rb
74
+ - test/dummy/app/controllers/application_controller.rb
75
+ - test/dummy/config.ru
76
+ - test/dummy/config/locales/en.yml
77
+ - test/dummy/config/application.rb
78
+ - test/dummy/config/database.yml
79
+ - test/dummy/config/environments/development.rb
80
+ - test/dummy/config/environments/production.rb
81
+ - test/dummy/config/environments/test.rb
82
+ - test/dummy/config/initializers/inflections.rb
83
+ - test/dummy/config/initializers/secret_token.rb
84
+ - test/dummy/config/initializers/mime_types.rb
85
+ - test/dummy/config/initializers/backtrace_silencers.rb
86
+ - test/dummy/config/initializers/wrap_parameters.rb
87
+ - test/dummy/config/initializers/session_store.rb
88
+ - test/dummy/config/environment.rb
89
+ - test/dummy/config/boot.rb
90
+ - test/dummy/config/routes.rb
91
+ - test/meta_manager_test.rb
92
+ - test/models/meta_tag_test.rb
93
+ - test/models/category_test.rb
94
+ - test/test_helper.rb
95
+ - test/controllers/posts_controller_test.rb
96
+ homepage: https://github.com/superp/meta_manager
97
+ licenses: []
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 1.8.11
117
+ signing_key:
118
+ specification_version: 3
119
+ summary: Head meta tags manager for models.
120
+ test_files:
121
+ - test/dummy/public/500.html
122
+ - test/dummy/public/422.html
123
+ - test/dummy/public/404.html
124
+ - test/dummy/public/favicon.ico
125
+ - test/dummy/script/rails
126
+ - test/dummy/log/development.log
127
+ - test/dummy/log/test.log
128
+ - test/dummy/Rakefile
129
+ - test/dummy/db/migrate/20111226131910_create_categories.rb
130
+ - test/dummy/db/migrate/20111226131911_create_posts.rb
131
+ - test/dummy/db/test.sqlite.db
132
+ - test/dummy/app/views/layouts/application.html.erb
133
+ - test/dummy/app/views/posts/show.html.erb
134
+ - test/dummy/app/views/posts/index.html.erb
135
+ - test/dummy/app/helpers/application_helper.rb
136
+ - test/dummy/app/models/post.rb
137
+ - test/dummy/app/models/category.rb
138
+ - test/dummy/app/assets/stylesheets/application.css
139
+ - test/dummy/app/assets/javascripts/application.js
140
+ - test/dummy/app/controllers/posts_controller.rb
141
+ - test/dummy/app/controllers/application_controller.rb
142
+ - test/dummy/config.ru
143
+ - test/dummy/config/locales/en.yml
144
+ - test/dummy/config/application.rb
145
+ - test/dummy/config/database.yml
146
+ - test/dummy/config/environments/development.rb
147
+ - test/dummy/config/environments/production.rb
148
+ - test/dummy/config/environments/test.rb
149
+ - test/dummy/config/initializers/inflections.rb
150
+ - test/dummy/config/initializers/secret_token.rb
151
+ - test/dummy/config/initializers/mime_types.rb
152
+ - test/dummy/config/initializers/backtrace_silencers.rb
153
+ - test/dummy/config/initializers/wrap_parameters.rb
154
+ - test/dummy/config/initializers/session_store.rb
155
+ - test/dummy/config/environment.rb
156
+ - test/dummy/config/boot.rb
157
+ - test/dummy/config/routes.rb
158
+ - test/meta_manager_test.rb
159
+ - test/models/meta_tag_test.rb
160
+ - test/models/category_test.rb
161
+ - test/test_helper.rb
162
+ - test/controllers/posts_controller_test.rb