Sha256: f9e65e7e7ce58b9b9b89452355ae31701c243d254a3a1644016b40f1a50ed4f4
Contents?: true
Size: 814 Bytes
Versions: 38
Compression:
Stored size: 814 Bytes
Contents
require 'rails/generators/base' module Clearance module Generators class ViewsGenerator < Rails::Generators::Base source_root File.expand_path("../../../../..", __FILE__) def create_views views.each do |view| copy_file view end end def create_locales locales.each do |locale| copy_file locale end end private def views files_within_root('.', 'app/views/**/*.*') end def locales files_within_root('.', 'config/locales/**/*.*') end def files_within_root(prefix, glob) root = "#{self.class.source_root}/#{prefix}" Dir["#{root}/#{glob}"].sort.map do |full_path| full_path.sub(root, '.').gsub('/./', '/') end end end end end
Version data entries
38 entries across 38 versions & 1 rubygems