Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added plugin example

  • Loading branch information...
commit b351ef0b960ef7cfa58d351b862970d7d6258dd0 1 parent 85de3f8
@davebryson authored
View
20 code/myblog/vendor/plugins/mail_tag/MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2008 [name of plugin creator]
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
4 code/myblog/vendor/plugins/mail_tag/README
@@ -0,0 +1,4 @@
+MailTag
+=======
+
+Really simple plugin. For education purposes only!
View
22 code/myblog/vendor/plugins/mail_tag/Rakefile
@@ -0,0 +1,22 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the mail_tag plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the mail_tag plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'MailTag'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
View
1  code/myblog/vendor/plugins/mail_tag/init.rb
@@ -0,0 +1 @@
+ActionView::Base.send(:include, MailTag)
View
1  code/myblog/vendor/plugins/mail_tag/install.rb
@@ -0,0 +1 @@
+# Install hook code here
View
12 code/myblog/vendor/plugins/mail_tag/lib/mail_tag.rb
@@ -0,0 +1,12 @@
+module MailTag
+
+ # a simple (and dumb) helper as an example
+ def mail_to(addr)
+ if addr =~ /(.+)@(.+)\.(.{3})/
+ "<a href='mailto:#{addr}'>#{addr}</a>"
+ else
+ "Bad!"
+ end
+ end
+
+end
View
4 code/myblog/vendor/plugins/mail_tag/tasks/mail_tag_tasks.rake
@@ -0,0 +1,4 @@
+# desc "Explaining what the task does"
+# task :mail_tag do
+# # Task goes here
+# end
View
19 code/myblog/vendor/plugins/mail_tag/test/mail_tag_test.rb
@@ -0,0 +1,19 @@
+require 'test/unit'
+
+# Require our module
+require File.dirname(__FILE__) + '/../lib/mail_tag'
+
+class MailTagTest < Test::Unit::TestCase
+ include MailTag # include it
+
+ # Should pass
+ def test_tag_pass
+ assert_equal mail_to("bob@here.com"), "<a href='mailto:bob@here.com'>bob@here.com</a>"
+ end
+
+ # Better fail
+ def test_fail
+ assert_equal mail_to("bob_here.com"), "Bad!"
+ end
+
+end
View
1  code/myblog/vendor/plugins/mail_tag/uninstall.rb
@@ -0,0 +1 @@
+# Uninstall hook code here
Please sign in to comment.
Something went wrong with that request. Please try again.