manage_meta 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +8 -0
- data/Rakefile +21 -0
- data/lib/manage_meta/railtie.rb +5 -4
- data/test/manage_meta_test.rb +14 -1
- metadata +2 -2
data/README.markdown
CHANGED
@@ -4,11 +4,19 @@ ManageMeta
|
|
4
4
|
ManageMeta is yet another meta tag manager for Rails 3.x. Its features are: recognizes tags
|
5
5
|
should render as HTTP-EQUIV; supports the Google 'canonical' link; is extensible; is non-intrusive
|
6
6
|
|
7
|
+
NOTE: ManageMeta works by `include`ing itself into ActionController::Base via an `initializer`
|
8
|
+
which is enclosed in ManageMeta::Railtie. This works for Rails 3.0.x - and should also work
|
9
|
+
going forward - you're on your own for Rails 2.x
|
10
|
+
|
7
11
|
How to use it
|
8
12
|
-----------
|
9
13
|
|
10
14
|
Include the gem by adding this to your Gemfile file
|
11
15
|
|
16
|
+
`gem "manage_meta", ">=0.0.11"`
|
17
|
+
|
18
|
+
or
|
19
|
+
|
12
20
|
`gem "manage_meta", :git => "git://github.com/mikehoward/manage_meta.git"`
|
13
21
|
|
14
22
|
Then, in your controller actions, call *add_meta()* for each meta tag you want
|
data/Rakefile
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'rake'
|
2
2
|
|
3
|
+
# snarf gemspec and set version
|
4
|
+
x = eval File.new('manage_meta.gemspec').read
|
5
|
+
manage_meta_version = x.version.to_s
|
6
|
+
|
3
7
|
task :default => :test
|
4
8
|
|
5
9
|
desc "Run ManageMeta unit tests"
|
@@ -16,3 +20,20 @@ desc "build gem"
|
|
16
20
|
task :gem do
|
17
21
|
system 'gem build manage_meta.gemspec'
|
18
22
|
end
|
23
|
+
|
24
|
+
desc "commit changes"
|
25
|
+
task :commit do
|
26
|
+
system 'git add .'
|
27
|
+
system 'git commit -m "checkin"'
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "commit changes and tag as #{manage_meta_version}"
|
31
|
+
task :tag => :commit do
|
32
|
+
system "git tag #{manage_meta_version}"
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "distribute to github and rubygems"
|
36
|
+
task :distribute => [:tag, :gem] do
|
37
|
+
system "gem push manage_meta-#{manage_meta_version}.gem"
|
38
|
+
system "git push manage_meta"
|
39
|
+
end
|
data/lib/manage_meta/railtie.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module ManageMeta
|
2
2
|
class Railtie < Rails::Railtie
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
initializer "application_controller.initialize_manage_meta" do
|
4
|
+
ActiveSupport.on_load(:action_controller) do
|
5
|
+
include ManageMeta
|
6
|
+
end
|
6
7
|
end
|
7
8
|
end
|
8
|
-
end
|
9
|
+
end
|
data/test/manage_meta_test.rb
CHANGED
@@ -7,7 +7,6 @@ end
|
|
7
7
|
NoToS.send( :undef_method, :to_s )
|
8
8
|
|
9
9
|
class ManageMetaTest < Test::Unit::TestCase
|
10
|
-
include ManageMeta
|
11
10
|
|
12
11
|
# add refute methods for ruby 1.8.7
|
13
12
|
if !self.instance_methods.include? :refute_respond_to
|
@@ -19,6 +18,15 @@ class ManageMetaTest < Test::Unit::TestCase
|
|
19
18
|
assert ! expr, msg
|
20
19
|
end
|
21
20
|
end
|
21
|
+
|
22
|
+
unless self.respond_to? :helper_method
|
23
|
+
def self.helper_method *args
|
24
|
+
@@helper_args = args
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# include ManageMeta after setup
|
29
|
+
include ManageMeta
|
22
30
|
|
23
31
|
def test__manage_meta_init
|
24
32
|
refute self.instance_variables.map {|x| x.to_sym }.include?(:@manage_meta_meta_hash), "self does not contain @manage_meta_meta_hash"
|
@@ -155,4 +163,9 @@ class ManageMetaTest < Test::Unit::TestCase
|
|
155
163
|
assert_match(/content="a value"/, render_meta, "render_meta tag for foo has content 'a value'")
|
156
164
|
end
|
157
165
|
|
166
|
+
# test 'helper method called'
|
167
|
+
def test_helper_method_called
|
168
|
+
refute @@helper_args.nil?, "helper_method called with at least one argument"
|
169
|
+
end
|
170
|
+
|
158
171
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: manage_meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.12
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mike Howard
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-22 00:00:00 -06:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|