Sha256: e277cc5900fc6c9ccf44af2b4f50bb47ba87b483a2f9ec9a5604a8ee5f5afd8f
Contents?: true
Size: 856 Bytes
Versions: 110
Compression:
Stored size: 856 Bytes
Contents
require 'rake' namespace :dad do namespace :generate do task :view => :environment do ARGV[1..-1].each do |arg| unless arg.index('=') task arg.to_sym do ; end if @resources.nil? @resources = arg.downcase end end end @resource = @resources.singularize @short_name = @resource.split('_').map(&:first).join @model_class = @resource.capitalize.constantize @tag_begin = '<%' @tag_end = '%>' 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) end end end end
Version data entries
110 entries across 110 versions & 1 rubygems