Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding stuff

  • Loading branch information...
commit f32b024dbe91122b85f5489cbf4d058f363ce0a6 1 parent f370edf
Ben VandenBos authored
View
22 Rakefile
@@ -0,0 +1,22 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the render_partial_comments plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the render_partial_comments plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'RenderPartialComments'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
View
4 init.rb
@@ -0,0 +1,4 @@
+# Include hook code here
+
+require File.join(File.dirname(__FILE__), 'lib', 'render_partial_comment')
+
View
1  install.rb
@@ -0,0 +1 @@
+# Install hook code here
View
27 lib/render_partial_comments.rb
@@ -0,0 +1,27 @@
+# these should all be defined...
+ActionView::Base
+
+module ActionView::Base
+
+ private
+
+ def self.perform_partial_comments?
+ # TODO: make this some kind of configuration in environments
+ RAILS_ENV == 'development'
+ end
+
+ # don't even define this method if we don't want to
+ if preform_partial_comments?
+
+ # render_partial(partial_path, object_assigns = nil, local_assigns = {})
+ def render_partial_with_comments(partial_path, object_assigns = nil, local_assigns = {})
+ r = ''
+ r << %{<!-- render_start '#{template_path}' -->} if self.class.perform_partial_comments?
+ r << render_for_file_without_comments(template_path, state, layout, locals)
+ r << %{<!-- render_end '#{template_path}' -->} if self.class.perform_partial_comments?
+ r
+ end
+
+ alias_method_chain :render_partial, :comments
+ end
+end
View
1  uninstall.rb
@@ -0,0 +1 @@
+# Uninstall hook code here
Please sign in to comment.
Something went wrong with that request. Please try again.