Skip to content

Commit

Permalink
checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Howard committed Apr 22, 2011
1 parent f200709 commit 99d2e23
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 11 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
@@ -1,3 +1,16 @@
2011-04-22 Mike Howard <mike@clove.com

* version 0.0.12 (don't ask - I'm still learning git and ruby-gems)

* lib/manage_meta/railtie.rb: converted initialization to using a railtie and
an initializer which adds the initialization code to ActiveSupport's on_load chain.
* lib/manage_meta.rb: ripped out the monkey patch and conditionally require lib/manage_meta/railtie.rb

* Rakefile: expanded to do more tasks

* /tests/manage_meta_test.rb (test_helper_method_called): added test to insure that the ActiveController::Base
method 'helper_method' is called

2011-04-17 Mike Howard <mike@clove.com>

* lib/manage_meta/manage_meta.rb (included) restored 'included' to conditionally invoke 'helper_method'
Expand Down
8 changes: 8 additions & 0 deletions README.markdown
Expand Up @@ -4,11 +4,19 @@ ManageMeta
ManageMeta is yet another meta tag manager for Rails 3.x. Its features are: recognizes tags
should render as HTTP-EQUIV; supports the Google 'canonical' link; is extensible; is non-intrusive

NOTE: ManageMeta works by `include`ing itself into ActionController::Base via an `initializer`
which is enclosed in ManageMeta::Railtie. This works for Rails 3.0.x - and should also work
going forward - you're on your own for Rails 2.x

How to use it
-----------

Include the gem by adding this to your Gemfile file

`gem "manage_meta", ">=0.0.11"`

or

`gem "manage_meta", :git => "git://github.com/mikehoward/manage_meta.git"`

Then, in your controller actions, call *add_meta()* for each meta tag you want
Expand Down
20 changes: 20 additions & 0 deletions Rakefile
@@ -1,5 +1,9 @@
require 'rake'

# snarf gemspec and set version
x = eval File.new('manage_meta.gemspec').read
manage_meta_version = x.version.to_s

task :default => :test

desc "Run ManageMeta unit tests"
Expand All @@ -16,3 +20,19 @@ desc "build gem"
task :gem do
system 'gem build manage_meta.gemspec'
end

desc "commit changes"
task :commit do
system 'git commit -a -m "checkin"'
end

desc "commit changes and tag as #{manage_meta_version}"
task :tag => :commit do
system "git tag #{manage_meta_version}"
end

desc "distribute to github and rubygems"
task :distribute => [:tag, :gem] do
system "gem push manage_meta-#{manage_meta_version}.gem"
system "git push manage_meta"
end
1 change: 0 additions & 1 deletion TODO
@@ -1 +0,0 @@
TODO 2011-04-09 Mike add test to ensure helper_method macro is called when present and not when absent
7 changes: 0 additions & 7 deletions lib/manage_meta.rb
@@ -1,9 +1,2 @@
require 'manage_meta/manage_meta'
require 'manage_meta/railtie' if defined? Rails
puts "in #{__FILE__}: #{__LINE__}; self: #{self}"

# if defined? Rails
# class ApplicationController <ActionController::Base
# include ManageMeta
# end
# end
1 change: 0 additions & 1 deletion lib/manage_meta/manage_meta.rb
@@ -1,4 +1,3 @@
puts "in #{__FILE__}: #{__LINE__}. self: #{self}"
module ManageMeta
def self.included(mod)
begin
Expand Down
2 changes: 1 addition & 1 deletion manage_meta.gemspec
Expand Up @@ -8,5 +8,5 @@ Gem::Specification.new do |s|
s.summary = "ManageMeta - Yet Another Meta Tag manager for Rails 3"
s.description = "Provides (semi-)intellegent management of meta tags for Rails 3"
s.files = Dir["{lib,test}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.markdown"]
s.version = "0.0.11"
s.version = "0.0.12"
end
15 changes: 14 additions & 1 deletion test/manage_meta_test.rb
Expand Up @@ -7,7 +7,6 @@ class NoToS
NoToS.send( :undef_method, :to_s )

class ManageMetaTest < Test::Unit::TestCase
include ManageMeta

# add refute methods for ruby 1.8.7
if !self.instance_methods.include? :refute_respond_to
Expand All @@ -19,6 +18,15 @@ def refute(expr, msg = nil)
assert ! expr, msg
end
end

unless self.respond_to? :helper_method
def self.helper_method *args
@@helper_args = args
end
end

# include ManageMeta after setup
include ManageMeta

def test__manage_meta_init
refute self.instance_variables.map {|x| x.to_sym }.include?(:@manage_meta_meta_hash), "self does not contain @manage_meta_meta_hash"
Expand Down Expand Up @@ -155,4 +163,9 @@ def test_render_meta_renders_meta
assert_match(/content="a value"/, render_meta, "render_meta tag for foo has content 'a value'")
end

# test 'helper method called'
def test_helper_method_called
refute @@helper_args.nil?, "helper_method called with at least one argument"
end

end

0 comments on commit 99d2e23

Please sign in to comment.