Class: Clearance::Generators::ViewsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Clearance::Generators::ViewsGenerator
- Defined in:
- lib/generators/clearance/views/views_generator.rb
Instance Method Summary collapse
- #create_locales ⇒ Object
- #create_views ⇒ Object
- #files_within_root(prefix, glob) ⇒ Object private
- #locales ⇒ Object private
- #views ⇒ Object private
Instance Method Details
#create_locales ⇒ Object
14 15 16 17 18 |
# File 'lib/generators/clearance/views/views_generator.rb', line 14 def create_locales locales.each do |locale| copy_file locale end end |
#create_views ⇒ Object
8 9 10 11 12 |
# File 'lib/generators/clearance/views/views_generator.rb', line 8 def create_views views.each do |view| copy_file view end end |
#files_within_root(prefix, glob) ⇒ Object (private)
30 31 32 33 34 35 36 |
# File 'lib/generators/clearance/views/views_generator.rb', line 30 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 |
#locales ⇒ Object (private)
26 27 28 |
# File 'lib/generators/clearance/views/views_generator.rb', line 26 def locales files_within_root('.', 'config/locales/**/*.*') end |
#views ⇒ Object (private)
22 23 24 |
# File 'lib/generators/clearance/views/views_generator.rb', line 22 def views files_within_root('.', 'app/views/**/*.*') end |