lib/tasks/generate/view.rake in daddy-0.3.2 vs lib/tasks/generate/view.rake in daddy-0.3.3
- old
+ new
@@ -1,9 +1,6 @@
-# coding: UTF-8
-
require 'rake'
-require 'erb'
namespace :dad do
namespace :generate do
task :view => :environment do
@@ -21,10 +18,10 @@
@short_name = @resource.split('_').map(&:first).join
@model_class = @resource.capitalize.constantize
@tag_begin = '<%'
@tag_end = '%>'
- Dir[File.join(File.dirname(__FILE__), 'templates/*.html.erb')].each do |template|
+ Dir[File.join(template_dir, 'app', 'views', '*.html.erb')].each do |template|
view_dir = "#{Rails.root}/app/views/#{@resources}"
FileUtils.mkdir_p(view_dir)
view_file = "#{view_dir}/#{File.basename(template)}"
File.write(view_file, ERB.new(File.read(template), 0, '-').result)